# Drake maintainers use this repository to instrument the rust_toolchain
# downloads. It is only used by the `../upgrade.sh` script run by Drake
# toolchain maintainers, not by general Drake developers nor users.

workspace(name = "upgrade")

# Load Drake's version of bazel_skylib.

local_repository(
    name = "drake",
    path = "../../../..",
)

load("@drake//tools/workspace:mirrors.bzl", "DEFAULT_MIRRORS")
load("@drake//tools/workspace/bazel_skylib:repository.bzl", "bazel_skylib_repository")  # noqa

bazel_skylib_repository(
    name = "bazel_skylib",
    mirrors = DEFAULT_MIRRORS,
)

# Load Drake's version of rules_rust, with a patch to instrument the downloads.

load("@drake//tools/workspace/rules_rust:repository.bzl", "rules_rust_repository")

rules_rust_repository(
    name = "rules_rust",
    extra_patches = ["@upgrade//:rules_rust_tracing.patch"],
    mirrors = DEFAULT_MIRRORS,
)

# Register the default toolchains from rules_rust.

load("@rules_rust//rust:defs.bzl", "rust_common")
load("@rules_rust//rust:repositories.bzl", "rust_register_toolchains")

rust_register_toolchains(
    extra_target_triples = [],
    rustfmt_version = rust_common.default_version,
    versions = [rust_common.default_version],
)
