1*d4726bddSHONG Yifan"""A module defining dependencies of the `cargo-bazel` Rust target""" 2*d4726bddSHONG Yifan 3*d4726bddSHONG Yifanload("@rules_rust//rust:defs.bzl", "rust_common") 4*d4726bddSHONG Yifanload("//crate_universe:deps_bootstrap.bzl", "cargo_bazel_bootstrap") 5*d4726bddSHONG Yifanload("//crate_universe/3rdparty:third_party_deps.bzl", "third_party_deps") 6*d4726bddSHONG Yifanload("//crate_universe/3rdparty/crates:crates.bzl", _vendor_crate_repositories = "crate_repositories") 7*d4726bddSHONG Yifanload("//crate_universe/private:vendor_utils.bzl", "crates_vendor_deps") 8*d4726bddSHONG Yifan 9*d4726bddSHONG Yifandef crate_universe_dependencies(rust_version = rust_common.default_version, bootstrap = False, **kwargs): 10*d4726bddSHONG Yifan """Define dependencies of the `cargo-bazel` Rust target 11*d4726bddSHONG Yifan 12*d4726bddSHONG Yifan Args: 13*d4726bddSHONG Yifan rust_version (str, optional): The version of rust to use when generating dependencies. 14*d4726bddSHONG Yifan bootstrap (bool, optional): If true, a `cargo_bootstrap_repository` target will be generated. 15*d4726bddSHONG Yifan **kwargs: Arguments to pass through to cargo_bazel_bootstrap. 16*d4726bddSHONG Yifan 17*d4726bddSHONG Yifan Returns: 18*d4726bddSHONG Yifan list[struct(repo=str, is_dev_dep=bool)]: A list of the repositories 19*d4726bddSHONG Yifan defined by this macro. 20*d4726bddSHONG Yifan """ 21*d4726bddSHONG Yifan third_party_deps() 22*d4726bddSHONG Yifan 23*d4726bddSHONG Yifan if bootstrap: 24*d4726bddSHONG Yifan cargo_bazel_bootstrap(rust_version = rust_version, **kwargs) 25*d4726bddSHONG Yifan 26*d4726bddSHONG Yifan direct_deps = _vendor_crate_repositories() 27*d4726bddSHONG Yifan direct_deps.extend(crates_vendor_deps()) 28*d4726bddSHONG Yifan return direct_deps 29