Skip to content

Commit 188e7be

Browse files
1 parent 9efd67a commit 188e7be

File tree

7 files changed

+197
-1
lines changed

7 files changed

+197
-1
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
"aspect-build/rules_py"
2+
3+
module(
4+
name = "aspect_rules_py",
5+
version = "1.4.0",
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.8.12",
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.1", dev_dependency = True)
92+
bazel_dep(name = "rules_oci", version = "2.0.1", dev_dependency = True)
93+
94+
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
95+
oci.pull(
96+
name = "ubuntu",
97+
digest = "sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab",
98+
image = "ubuntu",
99+
platforms = [
100+
"linux/arm64/v8",
101+
"linux/amd64",
102+
],
103+
tag = "latest",
104+
)
105+
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.4.0/source.json.intoto.jsonl",
6+
"integrity": "sha256-uE8xGQjxelVJzIovFFjh55exxxGfF7QEi7nviMvf4JA="
7+
},
8+
"MODULE.bazel": {
9+
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.4.0/MODULE.bazel.intoto.jsonl",
10+
"integrity": "sha256-LfHJYvnN9V0XgF6kl/L98k64bvBFCbosasomxKvripk="
11+
},
12+
"rules_py-v1.4.0.tar.gz": {
13+
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.4.0/rules_py-v1.4.0.tar.gz.intoto.jsonl",
14+
"integrity": "sha256-PfwVm7WEw6bzwUTtwWNaVLzIgKrhlGPxdKFeHngMfUY="
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.4.0",
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-jpofAOS6Vpb56Tp3Cmwd6GNUTM5InfkYCfw6QCfM/dw=",
3+
"strip_prefix": "rules_py-1.4.0",
4+
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.4.0/rules_py-v1.4.0.tar.gz",
5+
"patches": {
6+
"rust_dev_dep.patch": "sha256-1PopCaD4O1SjCtQt2WJhXdRyn/rJKF9M8H8adwaW2bY=",
7+
"module_dot_bazel_version.patch": "sha256-L4TAvGoK4bJpUtG2yz8e805KHE7831ZtpizhtpHUMsw="
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
@@ -45,7 +45,8 @@
4545
"1.3.1",
4646
"1.3.2",
4747
"1.3.3",
48-
"1.3.4"
48+
"1.3.4",
49+
"1.4.0"
4950
],
5051
"yanked_versions": {}
5152
}

0 commit comments

Comments
 (0)