Split github_tools into its own bazel repo. (#3632)

The pip dependencies in github_tools are the reason the
MODULE.bazel.lock is platform-dependent. Following complaints about the
platform-dependence, split apart github_tools from the rest of the bazel
repo and make it not track the lockfile: while there's an incremental
safety risk due to not tracking checksums, it's unlikely the tools there
would ever be part of a Carbon release process. If we eventually add
Python tools that need pip to the release, it might be desirable to go
back to re-unify the bazezl repos.

This does make running pr_comments incrementally more inconvenient
because a "bazel run" needs to be run from the github_tools subdir.

As a consequence of separating the dependency, this means tests will not
be continuously run in github_tools. They're now a separate repo, and we
cannot add a dependency without restoring the platform-dependent issue.
I think pr_comments is sufficiently low value and unchanging that it is
not worth building separate CI for it.

Cleans up some legacy references to third_party/llvm-project, since now
github_tools needs to be added to the main bazelignore.
This commit is contained in:
Jon Ross-Perkins
2024-01-22 21:34:02 +00:00
committed by GitHub
parent de2316bd0c
commit 3822c1b526
9 changed files with 67 additions and 1416 deletions
+3 -3
View File
@@ -4,6 +4,6 @@
# Carbon creates some non-standard bazel directories, so ignore them.
bazel-carbon-lang
third_party/llvm-project/libcxx/utils/google-benchmark
third_party/llvm-project/utils/bazel/examples
third_party/llvm-project/utils/bazel/llvm-project-overlay
# See github_tools/MODULE.bazel.
github_tools
+4
View File
@@ -5,6 +5,10 @@
# Directories and symlinks generated by bazel.
/bazel-*
# See github_tools/MODULE.bazel.
/github_tools/bazel-*
/github_tools/MODULE.bazel.lock
# Directories created by python.
**/__pycache__/
-9
View File
@@ -167,12 +167,3 @@ python.toolchain(
python_version = "3.11",
)
use_repo(python, "python_versions")
# Create a central repo that knows about the pip dependencies.
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "py_deps",
python_version = "3.11",
requirements_lock = "//github_tools:requirements.txt",
)
use_repo(pip, "py_deps")
+20 -1399
View File
File diff suppressed because one or more lines are too long
+30
View File
@@ -0,0 +1,30 @@
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Bazel modules.
This is set up as a separate bazel repo from the main Carbon directory in order
to split up the pip dependency, which makes MODULE.bazel.lock
platform-dependent. We don't commit the MODULE.bazel.lock for github_tools
because it's low-value, and would shift the platform dependence costs.
"""
module(name = "github_tools")
bazel_dep(name = "rules_python", version = "0.27.1")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.11",
)
use_repo(python, "python_versions")
# Create a central repo that knows about the pip dependencies.
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "py_deps",
python_version = "3.11",
requirements_lock = "//:requirements.txt",
)
use_repo(pip, "py_deps")
+5
View File
@@ -0,0 +1,5 @@
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
workspace(name = "github_tools")
+1 -1
View File
@@ -9,7 +9,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import unittest
from unittest import mock
from github_tools import github_helpers
import github_helpers
_TEST_QUERY = """
+2 -2
View File
@@ -10,8 +10,8 @@ import os
import unittest
from unittest import mock
from github_tools import github_helpers
from github_tools import pr_comments
import github_helpers
import pr_comments
class TestPRComments(unittest.TestCase):
+2 -2
View File
@@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# bazel run //github_tools:requirements.update
# bazel run //:requirements.update
#
certifi==2023.11.17 \
--hash=sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1 \
@@ -103,7 +103,7 @@ charset-normalizer==3.3.2 \
gql==2.0.0 \
--hash=sha256:35032ddd4bfe6b8f3169f806b022168932385d751eacc5c5f7122e0b3f4d6b88 \
--hash=sha256:fe8d3a08047f77362ddfcfddba7cae377da2dd66f5e61c59820419c9283d4fb5
# via -r github_tools/requirements.in
# via -r requirements.in
graphql-core==2.3.2 \
--hash=sha256:44c9bac4514e5e30c5a595fac8e3c76c1975cae14db215e8174c7fe995825bad \
--hash=sha256:aac46a9ac524c9855910c14c48fc5d60474def7f99fd10245e76608eba7af746