Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected] #3183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions modules/aspect_rules_py/1.0.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"aspect-build/rules_py"

module(
name = "aspect_rules_py",
compatibility_level = 1,
version = "1.0.0",
)

# Lower-bound versions of direct dependencies.
# When bumping, add a comment explaining what's required from the newer release.

# py_image_layer requires 2.x for the `tar` rule.
# py_image_layer needs compute_unused_inputs attribute
# py_image_layer needs repo_mapping fix.
bazel_dep(name = "aspect_bazel_lib", version = "2.9.4")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "rules_python", version = "0.29.0")
bazel_dep(name = "platforms", version = "0.0.7")

# Custom python version for testing only
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
python.toolchain(
is_default = False,
python_version = "3.8.12",
)

tools = use_extension("//py:extensions.bzl", "py_tools")
tools.rules_py_tools()
use_repo(tools, "rules_py_tools")
use_repo(tools, "rules_py_pex_2_3_1")

register_toolchains(
"@rules_py_tools//:all",

# Register the "from source" toolchains last, so there's no accidental dependency on Rust
# For manual testing: comment these out to force use of pre-built binaries.
"@aspect_rules_py//py/private/toolchain/venv/...",
"@aspect_rules_py//py/private/toolchain/unpack/...",
)

# To allow Rust binaries in /py/tools to be built from source
# NOTE: when publishing to BCR, we patch these to be dev_dependency, as we publish pre-built binaries
# along with our releases.

bazel_dep(
name = "rules_rust",
version = "0.53.0",
dev_dependency = True
)

rust = use_extension(
"@rules_rust//rust:extensions.bzl",
"rust",
dev_dependency = True
)

rust.toolchain(
edition = "2021",
versions = ["1.81.0"],
)
use_repo(rust, "rust_toolchains")

register_toolchains(
"@rust_toolchains//:all",
dev_dependency = True
)

crate = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
dev_dependency = True
)

crate.from_cargo(
name = "crate_index",
cargo_lockfile = "//:Cargo.lock",
# Apparently not needed under bzlmod?
# lockfile = "//:Cargo.Bazel.lock",
manifests = [
"//:Cargo.toml",
"//py/tools/py:Cargo.toml",
"//py/tools/venv_bin:Cargo.toml",
"//py/tools/unpack_bin:Cargo.toml",
],
)

use_repo(crate, "crate_index")
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
===================================================================
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -2,9 +2,9 @@

module(
name = "aspect_rules_py",
compatibility_level = 1,
- version = "0.0.0",
+ version = "1.0.0",
)

# Lower-bound versions of direct dependencies.
# When bumping, add a comment explaining what's required from the newer release.
36 changes: 36 additions & 0 deletions modules/aspect_rules_py/1.0.0/patches/rust_dev_dep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/MODULE.bazel b/MODULE.bazel
index 841aed7..e1a1d6d 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -41,13 +41,13 @@ register_toolchains(
bazel_dep(
name = "rules_rust",
version = "0.53.0",
- # In released versions: dev_dependency = True
+ dev_dependency = True
)

rust = use_extension(
"@rules_rust//rust:extensions.bzl",
"rust",
- # In released versions: dev_dependency = True
+ dev_dependency = True
)

rust.toolchain(
@@ -58,13 +58,13 @@ use_repo(rust, "rust_toolchains")

register_toolchains(
"@rust_toolchains//:all",
- # In released versions: dev_dependency = True
+ dev_dependency = True
)

crate = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
- # In released versions: dev_dependency = True
+ dev_dependency = True
)

crate.from_cargo(
16 changes: 16 additions & 0 deletions modules/aspect_rules_py/1.0.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bcr_test_module:
module_path: "e2e/use_release"
matrix:
bazel: ["7.x"]
# TODO(#9): add windows to this list
platform: ["debian10", "macos", "ubuntu2004"]
tasks:
run_tests:
name: "Run test module"
bazel: ${{ bazel }}
platform: ${{ platform }}
test_flags:
# Bazel 6.x requires this flag set.
- --@aspect_rules_py//py:interpreter_version=3.8.12
test_targets:
- "//..."
10 changes: 10 additions & 0 deletions modules/aspect_rules_py/1.0.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"integrity": "sha256-LOSODz6q9zIEtiP5nyPUVpC4YqmUtbPCRkouNhsPxK4=",
"strip_prefix": "rules_py-1.0.0",
"url": "https://github.com/aspect-build/rules_py/releases/download/v1.0.0/rules_py-v1.0.0.tar.gz",
"patches": {
"rust_dev_dep.patch": "sha256-Y719sNLUsXsQfJYCVCPQyIL21y9z+at6VImeEi1/dG0=",
"module_dot_bazel_version.patch": "sha256-w2g7DXDeKk2gPSG7mi+u4W38VA+QR7rRnmEKBomCjqw="
},
"patch_strip": 1
}
3 changes: 2 additions & 1 deletion modules/aspect_rules_py/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"0.8.2",
"0.9.1",
"1.0.0-rc0",
"1.0.0-rc1"
"1.0.0-rc1",
"1.0.0"
],
"yanked_versions": {}
}
Loading