1"""Bzlmod module extensions that are only used internally""" 2 3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4load("//bindgen:repositories.bzl", "rust_bindgen_dependencies") 5load("//crate_universe:repositories.bzl", "crate_universe_dependencies") 6load("//proto/prost:repositories.bzl", "rust_prost_dependencies") 7load("//rust/private:repository_utils.bzl", "TINYJSON_KWARGS") 8load("//test:deps.bzl", "rules_rust_test_deps") 9load("//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies") 10load("//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_dependencies") 11 12def _internal_deps_impl(module_ctx): 13 # This should contain the subset of WORKSPACE.bazel that defines 14 # repositories. 15 16 # We don't want rules_rust_dependencies, as they contain things like 17 # rules_cc, which is already declared in MODULE.bazel. 18 direct_deps = [struct(repo = "rules_rust_tinyjson", is_dev_dep = False)] 19 http_archive(**TINYJSON_KWARGS) 20 21 direct_deps.extend(crate_universe_dependencies()) 22 direct_deps.extend(rust_prost_dependencies(bzlmod = True)) 23 direct_deps.extend(rust_bindgen_dependencies()) 24 direct_deps.extend(rust_analyzer_dependencies()) 25 direct_deps.extend(rust_wasm_bindgen_dependencies()) 26 direct_deps.extend(rules_rust_test_deps()) 27 28 http_archive( 29 name = "bazelci_rules", 30 sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", 31 strip_prefix = "bazelci_rules-1.0.0", 32 url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz", 33 ) 34 direct_deps.append(struct(repo = "bazelci_rules", is_dev_dep = True)) 35 36 # is_dev_dep is ignored here. It's not relevant for internal_deps, as dev 37 # dependencies are only relevant for module extensions that can be used 38 # by other MODULES. 39 return module_ctx.extension_metadata( 40 root_module_direct_deps = [repo.repo for repo in direct_deps], 41 root_module_direct_dev_deps = [], 42 ) 43 44# This is named a single character to reduce the size of path names when running build scripts, to reduce the chance 45# of hitting the 260 character windows path name limit. 46i = module_extension( 47 doc = "Dependencies for rules_rust", 48 implementation = _internal_deps_impl, 49) 50