Skip to content

Commit bb956d0

Browse files
authored
chore: bzlmod (#162)
* chore: bzlmod - Upgrade to Bazel 6.2.0 since Bazel 5 has bzlmod bugs. TODO: update the GHA ci.yaml to test on Bazel 5 as well. - Introduce simple MODULE.bazel file - Add .bcr folder so the Publish to BCR app automates publishing on releases * chore: update goldens for Bazel 6 * chore: fixup BAZEL_TARGET rather than change assertion
1 parent 913676d commit bb956d0

File tree

19 files changed

+132
-24
lines changed

19 files changed

+132
-24
lines changed

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e2e/

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
5.4.0
1+
6.2.0
22
# The first line of this file is used by Bazelisk and Bazel to be sure
33
# the right version of Bazel is used to build and test this repo.
44
# This also defines which version is used on CI.

.bcr/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fixedReleaser:
2+
login: mattem
3+

.bcr/metadata.template.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"homepage": "https://docs.aspect.build/rules/aspect_rules_py",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "aspect-build",
7+
"name": "Aspect team"
8+
}
9+
],
10+
"repository": [
11+
"github:aspect-build/rules_py"
12+
],
13+
"versions": [],
14+
"yanked_versions": {}
15+
}

.bcr/presubmit.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bcr_test_module:
2+
module_path: "e2e/smoke"
3+
matrix:
4+
platform: ["debian10", "macos", "ubuntu2004", "windows"]
5+
tasks:
6+
run_tests:
7+
name: "Run test module"
8+
platform: ${{ platform }}
9+
test_targets:
10+
- "//..."

.bcr/source.template.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "**leave this alone**",
3+
"strip_prefix": "{REPO}-{VERSION}",
4+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz"
5+
}

.github/workflows/release_prep.sh

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,28 @@ git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
1212
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
1313

1414
cat << EOF
15-
WORKSPACE snippet:
15+
## Using [Bzlmod] with Bazel 6:
16+
17+
Add to your \`MODULE.bazel\` file:
18+
19+
\`\`\`starlark
20+
bazel_dep(name = "aspect_rules_py", version = "${TAG:1}")
21+
\`\`\`
22+
23+
And also register a Python toolchain, see rules_python. For example:
24+
25+
\`\`\`starlark
26+
EOF
27+
28+
awk 'f;/--SNIP--/{f=1}' e2e/smoke/MODULE.bazel
29+
30+
cat << EOF
31+
\`\`\`
32+
33+
[Bzlmod]: https://bazel.build/build/bzlmod
34+
35+
## Using WORKSPACE
36+
1637
\`\`\`starlark
1738
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1839
http_archive(
@@ -21,14 +42,7 @@ http_archive(
2142
strip_prefix = "${PREFIX}",
2243
url = "https://github.com/aspect-build/rules_py/releases/download/${TAG}/${ARCHIVE}",
2344
)
24-
25-
# Fetches the rules_py dependencies.
26-
# If you want to have a different version of some dependency,
27-
# you should fetch it *before* calling this.
28-
# Alternatively, you can skip calling this function, so long as you've
29-
# already fetched all the dependencies.
30-
load("@aspect_rules_py//py:repositories.bzl", "rules_py_dependencies")
31-
rules_py_dependencies()
32-
33-
\`\`\`
3445
EOF
46+
47+
awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel
48+
echo "\`\`\`"

MODULE.bazel

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"aspect-build/rules_py"
2+
3+
module(
4+
name = "aspect_rules_py",
5+
compatibility_level = 1,
6+
version = "0.0.0",
7+
)
8+
9+
# Lower-bound versions of direct dependencies.
10+
# When bumping, add a comment explaining what's required from the newer release.
11+
bazel_dep(name = "aspect_bazel_lib", version = "1.30.2")
12+
bazel_dep(name = "bazel_skylib", version = "1.4.0")
13+
bazel_dep(name = "rules_python", version = "0.19.0")

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,5 @@ _Need help?_ This ruleset has support provided by https://aspect.dev.
4444

4545
## Installation
4646

47-
From the release you wish to use:
47+
Follow instructions from the release you wish to use:
4848
<https://github.com/aspect-build/rules_py/releases>
49-
copy the WORKSPACE snippet into your `WORKSPACE` file.

e2e/smoke/.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.bazelversion

0 commit comments

Comments
 (0)