generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMODULE.bazel
104 lines (89 loc) · 3.1 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
"aspect-build/rules_py"
module(
name = "aspect_rules_py",
version = "0.0.0",
compatibility_level = 1,
)
# 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.10.0")
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")
bazel_lib = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib.expand_template()
# 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",
# 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.81.0"],
)
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")
# For building test images with py_image_layer
bazel_dep(name = "container_structure_test", version = "1.19.1", dev_dependency = True)
bazel_dep(name = "rules_oci", version = "2.0.1", dev_dependency = True)
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
oci.pull(
name = "ubuntu",
digest = "sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab",
image = "ubuntu",
platforms = [
"linux/arm64/v8",
"linux/amd64",
],
tag = "latest",
)
use_repo(oci, "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8")