|
| 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.40.0") |
| 12 | +bazel_dep(name = "bazel_skylib", version = "1.4.2") |
| 13 | +bazel_dep(name = "rules_python", version = "0.29.0") |
| 14 | +bazel_dep(name = "platforms", version = "0.0.7") |
| 15 | + |
| 16 | +tools = use_extension("//py:extensions.bzl", "py_tools") |
| 17 | +tools.rules_py_tools() |
| 18 | +use_repo(tools, "rules_py_tools") |
| 19 | + |
| 20 | +register_toolchains( |
| 21 | + "@rules_py_tools//:all", |
| 22 | + |
| 23 | + # Register the "from source" toolchains last, so there's no accidental dependency on Rust |
| 24 | + # For manual testing: comment these out to force use of pre-built binaries. |
| 25 | + "@aspect_rules_py//py/private/toolchain/venv/...", |
| 26 | + "@aspect_rules_py//py/private/toolchain/unpack/...", |
| 27 | +) |
| 28 | + |
| 29 | +# To allow Rust binaries in /py/tools to be built from source |
| 30 | +# NOTE: when publishing to BCR, we patch these to be dev_dependency, as we publish pre-built binaries |
| 31 | +# along with our releases. |
| 32 | + |
| 33 | +bazel_dep( |
| 34 | + name = "rules_rust", |
| 35 | + version = "0.38.0", |
| 36 | + # In released versions: dev_dependency = True |
| 37 | +) |
| 38 | + |
| 39 | +rust = use_extension( |
| 40 | + "@rules_rust//rust:extensions.bzl", |
| 41 | + "rust", |
| 42 | + # In released versions: dev_dependency = True |
| 43 | +) |
| 44 | + |
| 45 | +rust.toolchain( |
| 46 | + edition = "2021", |
| 47 | + versions = ["1.74.1"], |
| 48 | +) |
| 49 | +use_repo(rust, "rust_toolchains") |
| 50 | + |
| 51 | +register_toolchains( |
| 52 | + "@rust_toolchains//:all", |
| 53 | + # In released versions: dev_dependency = True |
| 54 | +) |
| 55 | + |
| 56 | +crate = use_extension( |
| 57 | + "@rules_rust//crate_universe:extension.bzl", |
| 58 | + "crate", |
| 59 | + # In released versions: dev_dependency = True |
| 60 | +) |
| 61 | + |
| 62 | +crate.from_cargo( |
| 63 | + name = "crate_index", |
| 64 | + cargo_lockfile = "//:Cargo.lock", |
| 65 | + # Apparently not needed under bzlmod? |
| 66 | + # lockfile = "//:Cargo.Bazel.lock", |
| 67 | + manifests = [ |
| 68 | + "//:Cargo.toml", |
| 69 | + "//py/tools/py:Cargo.toml", |
| 70 | + "//py/tools/venv_bin:Cargo.toml", |
| 71 | + "//py/tools/unpack_bin:Cargo.toml", |
| 72 | + ], |
| 73 | +) |
| 74 | + |
| 75 | +use_repo(crate, "crate_index") |
0 commit comments