fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreAdded support for compact windows repository names, avoiding MAX_PATH (#3023)8e962a16

main
2.3 KiB56 linesraw
1"""Bzlmod module extensions that are only used internally"""
2
3load("//crate_universe:deps_bootstrap.bzl", "cargo_bazel_bootstrap")
4load("//crate_universe:repositories.bzl", "crate_universe_dependencies")
5load("//crate_universe/tools/cross_installer:cross_installer_deps.bzl", "cross_installer_deps")
6
7def _internal_deps_impl(module_ctx):
8    direct_deps = []
9
10    direct_deps.extend(crate_universe_dependencies())
11    direct_deps.extend(cargo_bazel_bootstrap(
12        rust_toolchain_cargo_template = "@rust_host_tools//:bin/{tool}",
13        rust_toolchain_rustc_template = "@rust_host_tools//:bin/{tool}",
14        compressed_windows_toolchain_names = False,
15    ))
16
17    # is_dev_dep is ignored here. It's not relevant for internal_deps, as dev
18    # dependencies are only relevant for module extensions that can be used
19    # by other MODULES.
20    return module_ctx.extension_metadata(
21        root_module_direct_deps = [repo.repo for repo in direct_deps],
22        root_module_direct_dev_deps = [],
23    )
24
25# This is named a single character to reduce the size of path names when running build scripts, to reduce the chance
26# of hitting the 260 character windows path name limit.
27# TODO: https://github.com/bazelbuild/rules_rust/issues/1120
28cu = module_extension(
29    doc = "Dependencies for crate_universe.",
30    implementation = _internal_deps_impl,
31)
32
33def _internal_dev_deps_impl(module_ctx):
34    direct_deps = []
35
36    direct_deps.extend(cross_installer_deps(
37        rust_toolchain_cargo_template = "@rust_host_tools//:bin/{tool}",
38        rust_toolchain_rustc_template = "@rust_host_tools//:bin/{tool}",
39        compressed_windows_toolchain_names = False,
40    ))
41
42    # is_dev_dep is ignored here. It's not relevant for internal_deps, as dev
43    # dependencies are only relevant for module extensions that can be used
44    # by other MODULES.
45    return module_ctx.extension_metadata(
46        root_module_direct_deps = [],
47        root_module_direct_dev_deps = [repo.repo for repo in direct_deps],
48    )
49
50# This is named a single character to reduce the size of path names when running build scripts, to reduce the chance
51# of hitting the 260 character windows path name limit.
52# TODO: https://github.com/bazelbuild/rules_rust/issues/1120
53cu_dev = module_extension(
54    doc = "Development dependencies for crate_universe.",
55    implementation = _internal_dev_deps_impl,
56)