-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: bzlmod support * feat: get bzlmod working in root and examples folders * chore: code review comment
- Loading branch information
Showing
8 changed files
with
95 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
build --//:mypy=//third_party:mypy | ||
common --enable_bzlmod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,31 @@ on: | |
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
bzlmodEnabled: [true, false] | ||
folder: [".", "examples"] | ||
exclude: | ||
# No point keeping the root workspace compatible with --noenable_bzlmod | ||
- folder: "." | ||
bzlmodEnabled: false | ||
defaults: | ||
run: | ||
working-directory: ${{ matrix.folder }} | ||
|
||
steps: | ||
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it | ||
- uses: actions/checkout@v4 | ||
- uses: p0deje/[email protected] | ||
with: | ||
bazelrc: common --announce_rc --color=yes --enable_bzlmod=${{ matrix.bzlmodEnabled }} | ||
- name: Run tests | ||
run: bazel test //... | ||
|
||
integration-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run integration tests | ||
run: ./test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"Bazel dependencies under bzlmod" | ||
|
||
module( | ||
name = "mypy_integration", | ||
# Replaced with the tag during BCR publishing | ||
version = "0.0.0", | ||
compatibility_level = 1, | ||
) | ||
|
||
# Lower-bound dependency versions. | ||
# Only increase these when needed, otherwise users get warnings from Bazel about how the selected | ||
# version is greater than the one they specified. | ||
bazel_dep(name = "rules_python", version = "0.27.1") | ||
bazel_dep(name = "bazel_skylib", version = "1.5.0") | ||
|
||
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True) | ||
|
||
python = use_extension( | ||
"@rules_python//python/extensions:python.bzl", | ||
"python", | ||
dev_dependency = True, | ||
) | ||
python.toolchain(python_version = "3.8") | ||
|
||
pip = use_extension( | ||
"@rules_python//python/extensions:pip.bzl", | ||
"pip", | ||
dev_dependency = True, | ||
) | ||
pip.parse( | ||
hub_name = "mypy_integration_pip_deps", | ||
python_version = "3.8", | ||
requirements_lock = "//third_party:requirements.txt", | ||
) | ||
use_repo(pip, "mypy_integration_pip_deps") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,2 @@ | ||
workspace(name = "bazel_mypy_integration") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("//repositories:repositories.bzl", mypy_integration_repositories = "repositories") | ||
|
||
mypy_integration_repositories() | ||
|
||
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") | ||
|
||
py_repositories() | ||
|
||
python_register_toolchains( | ||
name = "python3_8", | ||
python_version = "3.8", | ||
) | ||
|
||
load("@python3_8//:defs.bzl", python_interpreter = "interpreter") | ||
load("@rules_python//python:pip.bzl", "pip_parse") | ||
|
||
pip_parse( | ||
name = "mypy_integration_pip_deps", | ||
python_interpreter_target = python_interpreter, | ||
requirements_lock = "//third_party:requirements.txt", | ||
) | ||
|
||
load("@mypy_integration_pip_deps//:requirements.bzl", install_mypy_deps = "install_deps") | ||
|
||
install_mypy_deps() | ||
|
||
http_archive( | ||
name = "buildifier_prebuilt", | ||
sha256 = "8ada9d88e51ebf5a1fdff37d75ed41d51f5e677cdbeafb0a22dda54747d6e07e", | ||
strip_prefix = "buildifier-prebuilt-6.4.0", | ||
urls = [ | ||
"http://github.com/keith/buildifier-prebuilt/archive/6.4.0.tar.gz", | ||
], | ||
) | ||
|
||
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps") | ||
|
||
buildifier_prebuilt_deps() | ||
|
||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") | ||
|
||
bazel_skylib_workspace() | ||
|
||
load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains") | ||
|
||
buildifier_prebuilt_register_toolchains() | ||
|
||
http_archive( | ||
name = "com_google_protobuf", | ||
sha256 = "d19643d265b978383352b3143f04c0641eea75a75235c111cc01a1350173180e", | ||
strip_prefix = "protobuf-25.3", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v25.3.tar.gz", | ||
"https://github.com/protocolbuffers/protobuf/archive/v25.3.tar.gz", | ||
], | ||
) | ||
|
||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") | ||
|
||
protobuf_deps() | ||
# Marker file that this is the root of a Bazel workspace. | ||
# Dependencies appear in MODULE.bazel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
build --@mypy_integration//:mypy=//tools/typing:mypy | ||
common --java_runtime_version=remotejdk_11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"Bazel dependencies, used under --enable_bzlmod" | ||
|
||
module( | ||
name = "mypy-integration-examples", | ||
version = "0.0.0", | ||
compatibility_level = 1, | ||
) | ||
|
||
bazel_dep(name = "mypy_integration", version = "0.0.0") | ||
bazel_dep(name = "rules_java", version = "7.4.0") | ||
bazel_dep(name = "rules_python", version = "0.27.1") | ||
|
||
local_path_override( | ||
module_name = "mypy_integration", | ||
path = "..", | ||
) | ||
|
||
python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
python.toolchain(python_version = "3.8") | ||
|
||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
pip.parse( | ||
hub_name = "my_deps", | ||
python_version = "3.8", | ||
requirements_lock = "//third_party:requirements.txt", | ||
) | ||
pip.parse( | ||
hub_name = "my_mypy_deps", | ||
python_version = "3.8", | ||
requirements_lock = "//tools/typing:mypy_requirements.txt", | ||
) | ||
use_repo(pip, "my_deps", "my_mypy_deps") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Under --enable_bzlmod, this file shadows WORKSPACE |