forked from aspect-build/rules_py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MODULE.bazel
83 lines (69 loc) · 2.31 KB
/
MODULE.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"aspect-build/rules_py"
module(
name = "aspect_rules_py",
compatibility_level = 1,
version = "0.0.0",
)
# Lower-bound versions of direct dependencies.
# When bumping, add a comment explaining what's required from the newer release.
bazel_dep(name = "aspect_bazel_lib", version = "2.9.1") # py_image_layer requires 2.x for the `tar` rule.
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.38.0",
# In released versions: dev_dependency = True
)
rust = use_extension(
"@rules_rust//rust:extensions.bzl",
"rust",
# In released versions: dev_dependency = True
)
rust.toolchain(
edition = "2021",
versions = ["1.74.1"],
)
use_repo(rust, "rust_toolchains")
register_toolchains(
"@rust_toolchains//:all",
# In released versions: dev_dependency = True
)
crate = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
# In released versions: 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")