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