Skip to content

Commit fdd0fd0

Browse files
1 parent c921500 commit fdd0fd0

File tree

7 files changed

+203
-1
lines changed

7 files changed

+203
-1
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
"aspect-build/rules_py"
2+
3+
module(
4+
name = "aspect_rules_py",
5+
version = "1.5.1",
6+
compatibility_level = 1,
7+
)
8+
9+
# Lower-bound versions of direct dependencies.
10+
# When bumping, add a comment explaining what's required from the newer release.
11+
12+
# py_image_layer requires 2.x for the `tar` rule.
13+
# py_image_layer needs compute_unused_inputs attribute
14+
# py_image_layer needs repo_mapping fix.
15+
bazel_dep(name = "aspect_bazel_lib", version = "2.16.0")
16+
bazel_dep(name = "bazel_skylib", version = "1.4.2")
17+
bazel_dep(name = "rules_python", version = "0.29.0")
18+
bazel_dep(name = "platforms", version = "0.0.7")
19+
20+
bazel_lib = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
21+
bazel_lib.expand_template()
22+
23+
# Custom python version for testing only
24+
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
25+
python.toolchain(
26+
is_default = False,
27+
python_version = "3.9",
28+
)
29+
30+
tools = use_extension("//py:extensions.bzl", "py_tools")
31+
tools.rules_py_tools()
32+
use_repo(tools, "rules_py_tools")
33+
use_repo(tools, "rules_py_pex_2_3_1")
34+
35+
register_toolchains(
36+
"@rules_py_tools//:all",
37+
38+
# Register the "from source" toolchains last, so there's no accidental dependency on Rust
39+
# For manual testing: comment these out to force use of pre-built binaries.
40+
"@aspect_rules_py//py/private/toolchain/venv/...",
41+
"@aspect_rules_py//py/private/toolchain/unpack/...",
42+
)
43+
44+
# To allow Rust binaries in /py/tools to be built from source
45+
# NOTE: when publishing to BCR, we patch these to be dev_dependency, as we publish pre-built binaries
46+
# along with our releases.
47+
48+
bazel_dep(
49+
name = "rules_rust",
50+
version = "0.53.0",
51+
dev_dependency = True,
52+
)
53+
54+
rust = use_extension(
55+
"@rules_rust//rust:extensions.bzl",
56+
"rust",
57+
dev_dependency = True,
58+
)
59+
rust.toolchain(
60+
edition = "2021",
61+
versions = ["1.81.0"],
62+
)
63+
use_repo(rust, "rust_toolchains")
64+
65+
register_toolchains(
66+
"@rust_toolchains//:all",
67+
dev_dependency = True,
68+
)
69+
70+
crate = use_extension(
71+
"@rules_rust//crate_universe:extension.bzl",
72+
"crate",
73+
dev_dependency = True,
74+
)
75+
crate.from_cargo(
76+
name = "crate_index",
77+
cargo_lockfile = "//:Cargo.lock",
78+
# Apparently not needed under bzlmod?
79+
# lockfile = "//:Cargo.Bazel.lock",
80+
manifests = [
81+
"//:Cargo.toml",
82+
"//py/tools/py:Cargo.toml",
83+
"//py/tools/unpack_bin:Cargo.toml",
84+
"//py/tools/venv_bin:Cargo.toml",
85+
"//py/tools/venv_shim:Cargo.toml",
86+
],
87+
)
88+
use_repo(crate, "crate_index")
89+
90+
# For building test images with py_image_layer
91+
bazel_dep(name = "container_structure_test", version = "1.19.3", dev_dependency = True)
92+
git_override(
93+
module_name = "container_structure_test",
94+
commit = "56c7201716d770c0f820a9c19207ba2ea77c34f8",
95+
remote = "https://github.com/GoogleContainerTools/container-structure-test.git",
96+
)
97+
98+
bazel_dep(name = "rules_oci", version = "2.0.1", dev_dependency = True)
99+
100+
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
101+
oci.pull(
102+
name = "ubuntu",
103+
digest = "sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab",
104+
image = "ubuntu",
105+
platforms = [
106+
"linux/arm64/v8",
107+
"linux/amd64",
108+
],
109+
tag = "latest",
110+
)
111+
use_repo(oci, "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8")
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"mediaType": "application/vnd.build.bazel.registry.attestation+json;version=1.0.0",
3+
"attestations": {
4+
"source.json": {
5+
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.5.1/source.json.intoto.jsonl",
6+
"integrity": "sha256-M59Rk97vDrx2vVIC3zjhhIO26OsHH4AczJlbw8K8Z/M="
7+
},
8+
"MODULE.bazel": {
9+
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.5.1/MODULE.bazel.intoto.jsonl",
10+
"integrity": "sha256-qcKi+x5UfupJIM+xlkm1q+owzaBLuMkzYMQUZkIIcgc="
11+
},
12+
"rules_py-v1.5.1.tar.gz": {
13+
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.5.1/rules_py-v1.5.1.tar.gz.intoto.jsonl",
14+
"integrity": "sha256-AZU0e8Ltch9QpOrLbtZhF2yFkxH8zTZfPrdnbrTS57w="
15+
}
16+
}
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
===================================================================
2+
--- a/MODULE.bazel
3+
+++ b/MODULE.bazel
4+
@@ -1,9 +1,9 @@
5+
"aspect-build/rules_py"
6+
7+
module(
8+
name = "aspect_rules_py",
9+
- version = "0.0.0",
10+
+ version = "1.5.1",
11+
compatibility_level = 1,
12+
)
13+
14+
# Lower-bound versions of direct dependencies.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/MODULE.bazel b/MODULE.bazel
2+
index 967dad2..5022390 100644
3+
--- a/MODULE.bazel
4+
+++ b/MODULE.bazel
5+
@@ -45,13 +45,13 @@ register_toolchains(
6+
bazel_dep(
7+
name = "rules_rust",
8+
version = "0.53.0",
9+
- # In released versions: dev_dependency = True
10+
+ dev_dependency = True,
11+
)
12+
13+
rust = use_extension(
14+
"@rules_rust//rust:extensions.bzl",
15+
"rust",
16+
- # In released versions: dev_dependency = True
17+
+ dev_dependency = True,
18+
)
19+
rust.toolchain(
20+
edition = "2021",
21+
@@ -61,13 +61,13 @@ use_repo(rust, "rust_toolchains")
22+
23+
register_toolchains(
24+
"@rust_toolchains//:all",
25+
- # In released versions: dev_dependency = True
26+
+ dev_dependency = True,
27+
)
28+
29+
crate = use_extension(
30+
"@rules_rust//crate_universe:extension.bzl",
31+
"crate",
32+
- # In released versions: dev_dependency = True
33+
+ dev_dependency = True,
34+
)
35+
crate.from_cargo(
36+
name = "crate_index",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
bcr_test_module:
2+
module_path: "e2e/use_release"
3+
matrix:
4+
bazel: ["8.x", "7.x"]
5+
# TODO(#9): add windows to this list
6+
platform: ["debian10", "macos", "ubuntu2004"]
7+
tasks:
8+
run_tests:
9+
name: "Run test module"
10+
bazel: ${{ bazel }}
11+
platform: ${{ platform }}
12+
test_targets:
13+
- "//..."
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"integrity": "sha256-d2FUe2K7aC23IR+Jei9P4TGtKr1hKVUJEO3MMXBrECk=",
3+
"strip_prefix": "rules_py-1.5.1",
4+
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.5.1/rules_py-v1.5.1.tar.gz",
5+
"patches": {
6+
"rust_dev_dep.patch": "sha256-1PopCaD4O1SjCtQt2WJhXdRyn/rJKF9M8H8adwaW2bY=",
7+
"module_dot_bazel_version.patch": "sha256-9N75u0nWORO1oidGp1Be9u1IERDT7KKZGcGKQzo0lkU="
8+
},
9+
"patch_strip": 1
10+
}

modules/aspect_rules_py/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"1.3.3",
4848
"1.3.4",
4949
"1.4.0",
50-
"1.5.0"
50+
"1.5.0",
51+
"1.5.1"
5152
],
5253
"yanked_versions": {}
5354
}

0 commit comments

Comments
 (0)