diff options
author | scentini <rosica@google.com> | 2024-01-11 11:19:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-11 10:19:23 +0000 |
commit | caa3959740d0f4133ef9ceabf8fa27ed809fb87e (patch) | |
tree | 97cd7d5f7f040d752ad58cf17b115394ccd10980 | |
parent | b2e52a20c93d2d976f208a4bbf70472552a2c08e (diff) | |
download | bazelbuild-rules_rust-caa3959740d0f4133ef9ceabf8fa27ed809fb87e.tar.gz |
Drop import macro (#2411)
As discussed over at
https://github.com/bazelbuild/rules_rust/issues/2383
30 files changed, 3 insertions, 3311 deletions
diff --git a/MODULE.bazel b/MODULE.bazel index 1cce1034..e487ff58 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -100,12 +100,6 @@ use_repo( "rules_rust_test_load_arbitrary_tool", "rules_rust_tinyjson", "rules_rust_toolchain_test_target_json", - "rules_rust_util_import__aho-corasick-0.7.15", - "rules_rust_util_import__lazy_static-1.4.0", - "rules_rust_util_import__proc-macro2-1.0.33", - "rules_rust_util_import__quickcheck-1.0.3", - "rules_rust_util_import__quote-1.0.10", - "rules_rust_util_import__syn-1.0.82", "rules_rust_wasm_bindgen__anyhow-1.0.71", "rules_rust_wasm_bindgen__assert_cmd-1.0.8", "rules_rust_wasm_bindgen__diff-0.1.13", diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 3dc6262f..b520a3c3 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -45,10 +45,6 @@ load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies") rust_analyzer_dependencies() -load("@rules_rust//util/import:deps.bzl", "import_deps") - -import_deps() - load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories") rust_wasm_bindgen_repositories() diff --git a/rust/private/extensions.bzl b/rust/private/extensions.bzl index 542d70fa..490008c5 100644 --- a/rust/private/extensions.bzl +++ b/rust/private/extensions.bzl @@ -7,7 +7,6 @@ load("//proto/prost:repositories.bzl", "rust_prost_dependencies") load("//rust/private:repository_utils.bzl", "TINYJSON_KWARGS") load("//test:deps.bzl", "rules_rust_test_deps") load("//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies") -load("//util/import:deps.bzl", "import_deps") load("//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_dependencies") def _internal_deps_impl(module_ctx): @@ -23,7 +22,6 @@ def _internal_deps_impl(module_ctx): direct_deps.extend(rust_prost_dependencies(bzlmod = True)) direct_deps.extend(rust_bindgen_dependencies()) direct_deps.extend(rust_analyzer_dependencies()) - direct_deps.extend(import_deps()) direct_deps.extend(rust_wasm_bindgen_dependencies()) direct_deps.extend(rules_rust_test_deps()) diff --git a/util/import/3rdparty/BUILD.bazel b/util/import/3rdparty/BUILD.bazel deleted file mode 100644 index cf1a1b08..00000000 --- a/util/import/3rdparty/BUILD.bazel +++ /dev/null @@ -1,40 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("//crate_universe:defs.bzl", "crate", "crates_vendor") - -crates_vendor( - name = "crates_vendor", - cargo_lockfile = "Cargo.Bazel.lock", - generate_build_scripts = True, - mode = "remote", - packages = { - "aho-corasick": crate.spec( - version = "=0.7.15", - ), - "lazy_static": crate.spec( - version = "=1.4.0", - ), - "proc-macro2": crate.spec( - version = "=1.0.33", - ), - "quickcheck": crate.spec( - version = "=1.0.3", - ), - "quote": crate.spec( - version = "=1.0.10", - ), - "syn": crate.spec( - version = "=1.0.82", - ), - }, - repository_name = "rules_rust_util_import", - tags = ["manual"], -) - -bzl_library( - name = "bzl_lib", - srcs = [ - "//util/import/3rdparty/crates:crates.bzl", - "//util/import/3rdparty/crates:defs.bzl", - ], - visibility = ["//util/import:__pkg__"], -) diff --git a/util/import/3rdparty/Cargo.Bazel.lock b/util/import/3rdparty/Cargo.Bazel.lock deleted file mode 100644 index 86c30238..00000000 --- a/util/import/3rdparty/Cargo.Bazel.lock +++ /dev/null @@ -1,165 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -dependencies = [ - "memchr", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "direct-cargo-bazel-deps" -version = "0.0.1" -dependencies = [ - "aho-corasick", - "lazy_static", - "proc-macro2", - "quickcheck", - "quote", - "syn", -] - -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "proc-macro2" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quickcheck" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" -dependencies = [ - "env_logger", - "log", - "rand", -] - -[[package]] -name = "quote" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "regex" -version = "1.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "syn" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" diff --git a/util/import/3rdparty/crates/BUILD.aho-corasick-0.7.15.bazel b/util/import/3rdparty/crates/BUILD.aho-corasick-0.7.15.bazel deleted file mode 100644 index d9067e64..00000000 --- a/util/import/3rdparty/crates/BUILD.aho-corasick-0.7.15.bazel +++ /dev/null @@ -1,83 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # Unlicense/MIT -# ]) - -rust_library( - name = "aho_corasick", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "default", - "std", - ], - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=aho-corasick", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.7.15", - deps = [ - "@rules_rust_util_import__memchr-2.5.0//:memchr", - ], -) diff --git a/util/import/3rdparty/crates/BUILD.bazel b/util/import/3rdparty/crates/BUILD.bazel deleted file mode 100644 index 36d3718a..00000000 --- a/util/import/3rdparty/crates/BUILD.bazel +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -package(default_visibility = ["//visibility:public"]) - -exports_files( - [ - "cargo-bazel.json", - "crates.bzl", - "defs.bzl", - ] + glob(["*.bazel"]), -) - -filegroup( - name = "srcs", - srcs = glob([ - "*.bazel", - "*.bzl", - ]), -) - -# Workspace Member Dependencies -alias( - name = "aho-corasick", - actual = "@rules_rust_util_import__aho-corasick-0.7.15//:aho_corasick", - tags = ["manual"], -) - -alias( - name = "lazy_static", - actual = "@rules_rust_util_import__lazy_static-1.4.0//:lazy_static", - tags = ["manual"], -) - -alias( - name = "proc-macro2", - actual = "@rules_rust_util_import__proc-macro2-1.0.33//:proc_macro2", - tags = ["manual"], -) - -alias( - name = "quickcheck", - actual = "@rules_rust_util_import__quickcheck-1.0.3//:quickcheck", - tags = ["manual"], -) - -alias( - name = "quote", - actual = "@rules_rust_util_import__quote-1.0.10//:quote", - tags = ["manual"], -) - -alias( - name = "syn", - actual = "@rules_rust_util_import__syn-1.0.82//:syn", - tags = ["manual"], -) diff --git a/util/import/3rdparty/crates/BUILD.cfg-if-1.0.0.bazel b/util/import/3rdparty/crates/BUILD.cfg-if-1.0.0.bazel deleted file mode 100644 index 7479adee..00000000 --- a/util/import/3rdparty/crates/BUILD.cfg-if-1.0.0.bazel +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT/Apache-2.0 -# ]) - -rust_library( - name = "cfg_if", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=cfg-if", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "1.0.0", -) diff --git a/util/import/3rdparty/crates/BUILD.env_logger-0.8.4.bazel b/util/import/3rdparty/crates/BUILD.env_logger-0.8.4.bazel deleted file mode 100644 index f94e8a38..00000000 --- a/util/import/3rdparty/crates/BUILD.env_logger-0.8.4.bazel +++ /dev/null @@ -1,83 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT/Apache-2.0 -# ]) - -rust_library( - name = "env_logger", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "regex", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=env_logger", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.8.4", - deps = [ - "@rules_rust_util_import__log-0.4.17//:log", - "@rules_rust_util_import__regex-1.4.6//:regex", - ], -) diff --git a/util/import/3rdparty/crates/BUILD.getrandom-0.2.8.bazel b/util/import/3rdparty/crates/BUILD.getrandom-0.2.8.bazel deleted file mode 100644 index 067bd49e..00000000 --- a/util/import/3rdparty/crates/BUILD.getrandom-0.2.8.bazel +++ /dev/null @@ -1,147 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "getrandom", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=getrandom", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.2.8", - deps = [ - "@rules_rust_util_import__cfg-if-1.0.0//:cfg_if", - ] + select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:aarch64-apple-ios": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:aarch64-fuchsia": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:aarch64-linux-android": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:armv7-linux-androideabi": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:i686-apple-darwin": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:i686-linux-android": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:i686-unknown-freebsd": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:wasm32-wasi": [ - "@rules_rust_util_import__wasi-0.11.0-wasi-snapshot-preview1//:wasi", # cfg(target_os = "wasi") - ], - "@rules_rust//rust/platform:x86_64-apple-darwin": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:x86_64-apple-ios": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:x86_64-fuchsia": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:x86_64-linux-android": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [ - "@rules_rust_util_import__libc-0.2.139//:libc", # cfg(unix) - ], - "//conditions:default": [], - }), -) diff --git a/util/import/3rdparty/crates/BUILD.lazy_static-1.4.0.bazel b/util/import/3rdparty/crates/BUILD.lazy_static-1.4.0.bazel deleted file mode 100644 index 1dd6f332..00000000 --- a/util/import/3rdparty/crates/BUILD.lazy_static-1.4.0.bazel +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT/Apache-2.0 -# ]) - -rust_library( - name = "lazy_static", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=lazy_static", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "1.4.0", -) diff --git a/util/import/3rdparty/crates/BUILD.libc-0.2.139.bazel b/util/import/3rdparty/crates/BUILD.libc-0.2.139.bazel deleted file mode 100644 index 11a4f8ea..00000000 --- a/util/import/3rdparty/crates/BUILD.libc-0.2.139.bazel +++ /dev/null @@ -1,117 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//cargo:defs.bzl", "cargo_build_script") -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "libc", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=libc", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.2.139", - deps = [ - "@rules_rust_util_import__libc-0.2.139//:build_script_build", - ], -) - -cargo_build_script( - name = "libc_build_script", - srcs = glob(["**/*.rs"]), - crate_name = "build_script_build", - crate_root = "build.rs", - data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-bazel", - "crate-name=libc", - "manual", - "noclippy", - "norustfmt", - ], - version = "0.2.139", - visibility = ["//visibility:private"], -) - -alias( - name = "build_script_build", - actual = "libc_build_script", - tags = ["manual"], -) diff --git a/util/import/3rdparty/crates/BUILD.log-0.4.17.bazel b/util/import/3rdparty/crates/BUILD.log-0.4.17.bazel deleted file mode 100644 index fa161070..00000000 --- a/util/import/3rdparty/crates/BUILD.log-0.4.17.bazel +++ /dev/null @@ -1,124 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//cargo:defs.bzl", "cargo_build_script") -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "log", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "std", - ], - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=log", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.4.17", - deps = [ - "@rules_rust_util_import__cfg-if-1.0.0//:cfg_if", - "@rules_rust_util_import__log-0.4.17//:build_script_build", - ], -) - -cargo_build_script( - name = "log_build_script", - srcs = glob(["**/*.rs"]), - crate_features = [ - "std", - ], - crate_name = "build_script_build", - crate_root = "build.rs", - data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-bazel", - "crate-name=log", - "manual", - "noclippy", - "norustfmt", - ], - version = "0.4.17", - visibility = ["//visibility:private"], -) - -alias( - name = "build_script_build", - actual = "log_build_script", - tags = ["manual"], -) diff --git a/util/import/3rdparty/crates/BUILD.memchr-2.5.0.bazel b/util/import/3rdparty/crates/BUILD.memchr-2.5.0.bazel deleted file mode 100644 index 26787ceb..00000000 --- a/util/import/3rdparty/crates/BUILD.memchr-2.5.0.bazel +++ /dev/null @@ -1,127 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//cargo:defs.bzl", "cargo_build_script") -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # Unlicense/MIT -# ]) - -rust_library( - name = "memchr", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "default", - "std", - "use_std", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=memchr", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "2.5.0", - deps = [ - "@rules_rust_util_import__memchr-2.5.0//:build_script_build", - ], -) - -cargo_build_script( - name = "memchr_build_script", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "std", - "use_std", - ], - crate_name = "build_script_build", - crate_root = "build.rs", - data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-bazel", - "crate-name=memchr", - "manual", - "noclippy", - "norustfmt", - ], - version = "2.5.0", - visibility = ["//visibility:private"], -) - -alias( - name = "build_script_build", - actual = "memchr_build_script", - tags = ["manual"], -) diff --git a/util/import/3rdparty/crates/BUILD.proc-macro2-1.0.33.bazel b/util/import/3rdparty/crates/BUILD.proc-macro2-1.0.33.bazel deleted file mode 100644 index 0a0f7c08..00000000 --- a/util/import/3rdparty/crates/BUILD.proc-macro2-1.0.33.bazel +++ /dev/null @@ -1,126 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//cargo:defs.bzl", "cargo_build_script") -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "proc_macro2", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "default", - "proc-macro", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=proc-macro2", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "1.0.33", - deps = [ - "@rules_rust_util_import__proc-macro2-1.0.33//:build_script_build", - "@rules_rust_util_import__unicode-xid-0.2.4//:unicode_xid", - ], -) - -cargo_build_script( - name = "proc-macro2_build_script", - srcs = glob(["**/*.rs"]), - crate_features = [ - "default", - "proc-macro", - ], - crate_name = "build_script_build", - crate_root = "build.rs", - data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-bazel", - "crate-name=proc-macro2", - "manual", - "noclippy", - "norustfmt", - ], - version = "1.0.33", - visibility = ["//visibility:private"], -) - -alias( - name = "build_script_build", - actual = "proc-macro2_build_script", - tags = ["manual"], -) diff --git a/util/import/3rdparty/crates/BUILD.quickcheck-1.0.3.bazel b/util/import/3rdparty/crates/BUILD.quickcheck-1.0.3.bazel deleted file mode 100644 index f679468c..00000000 --- a/util/import/3rdparty/crates/BUILD.quickcheck-1.0.3.bazel +++ /dev/null @@ -1,88 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # Unlicense/MIT -# ]) - -rust_library( - name = "quickcheck", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "default", - "env_logger", - "log", - "regex", - "use_logging", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=quickcheck", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "1.0.3", - deps = [ - "@rules_rust_util_import__env_logger-0.8.4//:env_logger", - "@rules_rust_util_import__log-0.4.17//:log", - "@rules_rust_util_import__rand-0.8.5//:rand", - ], -) diff --git a/util/import/3rdparty/crates/BUILD.quote-1.0.10.bazel b/util/import/3rdparty/crates/BUILD.quote-1.0.10.bazel deleted file mode 100644 index aac4f429..00000000 --- a/util/import/3rdparty/crates/BUILD.quote-1.0.10.bazel +++ /dev/null @@ -1,83 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "quote", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "default", - "proc-macro", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=quote", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "1.0.10", - deps = [ - "@rules_rust_util_import__proc-macro2-1.0.33//:proc_macro2", - ], -) diff --git a/util/import/3rdparty/crates/BUILD.rand-0.8.5.bazel b/util/import/3rdparty/crates/BUILD.rand-0.8.5.bazel deleted file mode 100644 index 97d6b784..00000000 --- a/util/import/3rdparty/crates/BUILD.rand-0.8.5.bazel +++ /dev/null @@ -1,83 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "rand", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "getrandom", - "small_rng", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=rand", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.8.5", - deps = [ - "@rules_rust_util_import__rand_core-0.6.4//:rand_core", - ], -) diff --git a/util/import/3rdparty/crates/BUILD.rand_core-0.6.4.bazel b/util/import/3rdparty/crates/BUILD.rand_core-0.6.4.bazel deleted file mode 100644 index a2d153a7..00000000 --- a/util/import/3rdparty/crates/BUILD.rand_core-0.6.4.bazel +++ /dev/null @@ -1,82 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "rand_core", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "getrandom", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=rand_core", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.6.4", - deps = [ - "@rules_rust_util_import__getrandom-0.2.8//:getrandom", - ], -) diff --git a/util/import/3rdparty/crates/BUILD.regex-1.4.6.bazel b/util/import/3rdparty/crates/BUILD.regex-1.4.6.bazel deleted file mode 100644 index 8ff5008f..00000000 --- a/util/import/3rdparty/crates/BUILD.regex-1.4.6.bazel +++ /dev/null @@ -1,91 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "regex", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "aho-corasick", - "memchr", - "perf", - "perf-cache", - "perf-dfa", - "perf-inline", - "perf-literal", - "std", - ], - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=regex", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "1.4.6", - deps = [ - "@rules_rust_util_import__aho-corasick-0.7.15//:aho_corasick", - "@rules_rust_util_import__memchr-2.5.0//:memchr", - "@rules_rust_util_import__regex-syntax-0.6.28//:regex_syntax", - ], -) diff --git a/util/import/3rdparty/crates/BUILD.regex-syntax-0.6.28.bazel b/util/import/3rdparty/crates/BUILD.regex-syntax-0.6.28.bazel deleted file mode 100644 index aab31683..00000000 --- a/util/import/3rdparty/crates/BUILD.regex-syntax-0.6.28.bazel +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "regex_syntax", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=regex-syntax", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.6.28", -) diff --git a/util/import/3rdparty/crates/BUILD.syn-1.0.82.bazel b/util/import/3rdparty/crates/BUILD.syn-1.0.82.bazel deleted file mode 100644 index db5084b8..00000000 --- a/util/import/3rdparty/crates/BUILD.syn-1.0.82.bazel +++ /dev/null @@ -1,138 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//cargo:defs.bzl", "cargo_build_script") -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "syn", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "clone-impls", - "default", - "derive", - "parsing", - "printing", - "proc-macro", - "quote", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=syn", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "1.0.82", - deps = [ - "@rules_rust_util_import__proc-macro2-1.0.33//:proc_macro2", - "@rules_rust_util_import__quote-1.0.10//:quote", - "@rules_rust_util_import__syn-1.0.82//:build_script_build", - "@rules_rust_util_import__unicode-xid-0.2.4//:unicode_xid", - ], -) - -cargo_build_script( - name = "syn_build_script", - srcs = glob(["**/*.rs"]), - crate_features = [ - "clone-impls", - "default", - "derive", - "parsing", - "printing", - "proc-macro", - "quote", - ], - crate_name = "build_script_build", - crate_root = "build.rs", - data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-bazel", - "crate-name=syn", - "manual", - "noclippy", - "norustfmt", - ], - version = "1.0.82", - visibility = ["//visibility:private"], -) - -alias( - name = "build_script_build", - actual = "syn_build_script", - tags = ["manual"], -) diff --git a/util/import/3rdparty/crates/BUILD.unicode-xid-0.2.4.bazel b/util/import/3rdparty/crates/BUILD.unicode-xid-0.2.4.bazel deleted file mode 100644 index 4fc289bf..00000000 --- a/util/import/3rdparty/crates/BUILD.unicode-xid-0.2.4.bazel +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # MIT OR Apache-2.0 -# ]) - -rust_library( - name = "unicode_xid", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "default", - ], - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=unicode-xid", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.2.4", -) diff --git a/util/import/3rdparty/crates/BUILD.wasi-0.11.0+wasi-snapshot-preview1.bazel b/util/import/3rdparty/crates/BUILD.wasi-0.11.0+wasi-snapshot-preview1.bazel deleted file mode 100644 index e236728e..00000000 --- a/util/import/3rdparty/crates/BUILD.wasi-0.11.0+wasi-snapshot-preview1.bazel +++ /dev/null @@ -1,80 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### - -load("@rules_rust//rust:defs.bzl", "rust_library") - -package(default_visibility = ["//visibility:public"]) - -# licenses([ -# "TODO", # Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT -# ]) - -rust_library( - name = "wasi", - srcs = glob(["**/*.rs"]), - compile_data = glob( - include = ["**"], - exclude = [ - "**/* *", - ".tmp_git_root/**/*", - "BUILD", - "BUILD.bazel", - "WORKSPACE", - "WORKSPACE.bazel", - ], - ), - crate_features = [ - "default", - "std", - ], - crate_root = "src/lib.rs", - edition = "2018", - rustc_flags = ["--cap-lints=allow"], - tags = [ - "cargo-bazel", - "crate-name=wasi", - "manual", - "noclippy", - "norustfmt", - ], - target_compatible_with = select({ - "@rules_rust//rust/platform:aarch64-apple-darwin": [], - "@rules_rust//rust/platform:aarch64-apple-ios": [], - "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], - "@rules_rust//rust/platform:aarch64-fuchsia": [], - "@rules_rust//rust/platform:aarch64-linux-android": [], - "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], - "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:armv7-linux-androideabi": [], - "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], - "@rules_rust//rust/platform:i686-apple-darwin": [], - "@rules_rust//rust/platform:i686-linux-android": [], - "@rules_rust//rust/platform:i686-pc-windows-msvc": [], - "@rules_rust//rust/platform:i686-unknown-freebsd": [], - "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], - "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], - "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], - "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], - "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], - "@rules_rust//rust/platform:thumbv7em-none-eabi": [], - "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], - "@rules_rust//rust/platform:wasm32-unknown-unknown": [], - "@rules_rust//rust/platform:wasm32-wasi": [], - "@rules_rust//rust/platform:x86_64-apple-darwin": [], - "@rules_rust//rust/platform:x86_64-apple-ios": [], - "@rules_rust//rust/platform:x86_64-fuchsia": [], - "@rules_rust//rust/platform:x86_64-linux-android": [], - "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], - "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], - "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], - "@rules_rust//rust/platform:x86_64-unknown-none": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - version = "0.11.0+wasi-snapshot-preview1", -) diff --git a/util/import/3rdparty/crates/crates.bzl b/util/import/3rdparty/crates/crates.bzl deleted file mode 100644 index 39f5ab56..00000000 --- a/util/import/3rdparty/crates/crates.bzl +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################### -# @generated -# This file is auto-generated by the cargo-bazel tool. -# -# DO NOT MODIFY: Local changes may be replaced in future executions. -############################################################################### -"""Rules for defining repositories for remote `crates_vendor` repositories""" - -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -# buildifier: disable=bzl-visibility -load("@rules_rust//crate_universe/private:crates_vendor.bzl", "crates_vendor_remote_repository") - -# buildifier: disable=bzl-visibility -load("@rules_rust//util/import/3rdparty/crates:defs.bzl", _crate_repositories = "crate_repositories") - -def crate_repositories(): - """Generates repositories for vendored crates. - - Returns: - A list of repos visible to the module through the module extension. - """ - maybe( - crates_vendor_remote_repository, - name = "rules_rust_util_import", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.bazel"), - defs_module = Label("@rules_rust//util/import/3rdparty/crates:defs.bzl"), - ) - - direct_deps = [struct(repo = "rules_rust_util_import", is_dev_dep = False)] - direct_deps.extend(_crate_repositories()) - return direct_deps diff --git a/util/import/3rdparty/crates/defs.bzl b/util/import/3rdparty/crates/defs.bzl deleted file mode 100644 index fcabf384..00000000 --- a/util/import/3rdparty/crates/defs.bzl +++ /dev/null @@ -1,596 +0,0 @@ -############################################################################### -# @generated -# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To -# regenerate this file, run the following: -# -# bazel run @//util/import/3rdparty:crates_vendor -############################################################################### -""" -# `crates_repository` API - -- [aliases](#aliases) -- [crate_deps](#crate_deps) -- [all_crate_deps](#all_crate_deps) -- [crate_repositories](#crate_repositories) - -""" - -load("@bazel_skylib//lib:selects.bzl", "selects") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -############################################################################### -# MACROS API -############################################################################### - -# An identifier that represent common dependencies (unconditional). -_COMMON_CONDITION = "" - -def _flatten_dependency_maps(all_dependency_maps): - """Flatten a list of dependency maps into one dictionary. - - Dependency maps have the following structure: - - ```python - DEPENDENCIES_MAP = { - # The first key in the map is a Bazel package - # name of the workspace this file is defined in. - "workspace_member_package": { - - # Not all dependencies are supported for all platforms. - # the condition key is the condition required to be true - # on the host platform. - "condition": { - - # An alias to a crate target. # The label of the crate target the - # Aliases are only crate names. # package name refers to. - "package_name": "@full//:label", - } - } - } - ``` - - Args: - all_dependency_maps (list): A list of dicts as described above - - Returns: - dict: A dictionary as described above - """ - dependencies = {} - - for workspace_deps_map in all_dependency_maps: - for pkg_name, conditional_deps_map in workspace_deps_map.items(): - if pkg_name not in dependencies: - non_frozen_map = dict() - for key, values in conditional_deps_map.items(): - non_frozen_map.update({key: dict(values.items())}) - dependencies.setdefault(pkg_name, non_frozen_map) - continue - - for condition, deps_map in conditional_deps_map.items(): - # If the condition has not been recorded, do so and continue - if condition not in dependencies[pkg_name]: - dependencies[pkg_name].setdefault(condition, dict(deps_map.items())) - continue - - # Alert on any miss-matched dependencies - inconsistent_entries = [] - for crate_name, crate_label in deps_map.items(): - existing = dependencies[pkg_name][condition].get(crate_name) - if existing and existing != crate_label: - inconsistent_entries.append((crate_name, existing, crate_label)) - dependencies[pkg_name][condition].update({crate_name: crate_label}) - - return dependencies - -def crate_deps(deps, package_name = None): - """Finds the fully qualified label of the requested crates for the package where this macro is called. - - Args: - deps (list): The desired list of crate targets. - package_name (str, optional): The package name of the set of dependencies to look up. - Defaults to `native.package_name()`. - - Returns: - list: A list of labels to generated rust targets (str) - """ - - if not deps: - return [] - - if package_name == None: - package_name = native.package_name() - - # Join both sets of dependencies - dependencies = _flatten_dependency_maps([ - _NORMAL_DEPENDENCIES, - _NORMAL_DEV_DEPENDENCIES, - _PROC_MACRO_DEPENDENCIES, - _PROC_MACRO_DEV_DEPENDENCIES, - _BUILD_DEPENDENCIES, - _BUILD_PROC_MACRO_DEPENDENCIES, - ]).pop(package_name, {}) - - # Combine all conditional packages so we can easily index over a flat list - # TODO: Perhaps this should actually return select statements and maintain - # the conditionals of the dependencies - flat_deps = {} - for deps_set in dependencies.values(): - for crate_name, crate_label in deps_set.items(): - flat_deps.update({crate_name: crate_label}) - - missing_crates = [] - crate_targets = [] - for crate_target in deps: - if crate_target not in flat_deps: - missing_crates.append(crate_target) - else: - crate_targets.append(flat_deps[crate_target]) - - if missing_crates: - fail("Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`".format( - missing_crates, - package_name, - dependencies, - )) - - return crate_targets - -def all_crate_deps( - normal = False, - normal_dev = False, - proc_macro = False, - proc_macro_dev = False, - build = False, - build_proc_macro = False, - package_name = None): - """Finds the fully qualified label of all requested direct crate dependencies \ - for the package where this macro is called. - - If no parameters are set, all normal dependencies are returned. Setting any one flag will - otherwise impact the contents of the returned list. - - Args: - normal (bool, optional): If True, normal dependencies are included in the - output list. - normal_dev (bool, optional): If True, normal dev dependencies will be - included in the output list.. - proc_macro (bool, optional): If True, proc_macro dependencies are included - in the output list. - proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are - included in the output list. - build (bool, optional): If True, build dependencies are included - in the output list. - build_proc_macro (bool, optional): If True, build proc_macro dependencies are - included in the output list. - package_name (str, optional): The package name of the set of dependencies to look up. - Defaults to `native.package_name()` when unset. - - Returns: - list: A list of labels to generated rust targets (str) - """ - - if package_name == None: - package_name = native.package_name() - - # Determine the relevant maps to use - all_dependency_maps = [] - if normal: - all_dependency_maps.append(_NORMAL_DEPENDENCIES) - if normal_dev: - all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES) - if proc_macro: - all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES) - if proc_macro_dev: - all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES) - if build: - all_dependency_maps.append(_BUILD_DEPENDENCIES) - if build_proc_macro: - all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES) - - # Default to always using normal dependencies - if not all_dependency_maps: - all_dependency_maps.append(_NORMAL_DEPENDENCIES) - - dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None) - - if not dependencies: - if dependencies == None: - fail("Tried to get all_crate_deps for package " + package_name + " but that package had no Cargo.toml file") - else: - return [] - - crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values()) - for condition, deps in dependencies.items(): - crate_deps += selects.with_or({ - tuple(_CONDITIONS[condition]): deps.values(), - "//conditions:default": [], - }) - - return crate_deps - -def aliases( - normal = False, - normal_dev = False, - proc_macro = False, - proc_macro_dev = False, - build = False, - build_proc_macro = False, - package_name = None): - """Produces a map of Crate alias names to their original label - - If no dependency kinds are specified, `normal` and `proc_macro` are used by default. - Setting any one flag will otherwise determine the contents of the returned dict. - - Args: - normal (bool, optional): If True, normal dependencies are included in the - output list. - normal_dev (bool, optional): If True, normal dev dependencies will be - included in the output list.. - proc_macro (bool, optional): If True, proc_macro dependencies are included - in the output list. - proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are - included in the output list. - build (bool, optional): If True, build dependencies are included - in the output list. - build_proc_macro (bool, optional): If True, build proc_macro dependencies are - included in the output list. - package_name (str, optional): The package name of the set of dependencies to look up. - Defaults to `native.package_name()` when unset. - - Returns: - dict: The aliases of all associated packages - """ - if package_name == None: - package_name = native.package_name() - - # Determine the relevant maps to use - all_aliases_maps = [] - if normal: - all_aliases_maps.append(_NORMAL_ALIASES) - if normal_dev: - all_aliases_maps.append(_NORMAL_DEV_ALIASES) - if proc_macro: - all_aliases_maps.append(_PROC_MACRO_ALIASES) - if proc_macro_dev: - all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES) - if build: - all_aliases_maps.append(_BUILD_ALIASES) - if build_proc_macro: - all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES) - - # Default to always using normal aliases - if not all_aliases_maps: - all_aliases_maps.append(_NORMAL_ALIASES) - all_aliases_maps.append(_PROC_MACRO_ALIASES) - - aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None) - - if not aliases: - return dict() - - common_items = aliases.pop(_COMMON_CONDITION, {}).items() - - # If there are only common items in the dictionary, immediately return them - if not len(aliases.keys()) == 1: - return dict(common_items) - - # Build a single select statement where each conditional has accounted for the - # common set of aliases. - crate_aliases = {"//conditions:default": dict(common_items)} - for condition, deps in aliases.items(): - condition_triples = _CONDITIONS[condition] - for triple in condition_triples: - if triple in crate_aliases: - crate_aliases[triple].update(deps) - else: - crate_aliases.update({triple: dict(deps.items() + common_items)}) - - return select(crate_aliases) - -############################################################################### -# WORKSPACE MEMBER DEPS AND ALIASES -############################################################################### - -_NORMAL_DEPENDENCIES = { - "": { - _COMMON_CONDITION: { - "aho-corasick": "@rules_rust_util_import__aho-corasick-0.7.15//:aho_corasick", - "lazy_static": "@rules_rust_util_import__lazy_static-1.4.0//:lazy_static", - "proc-macro2": "@rules_rust_util_import__proc-macro2-1.0.33//:proc_macro2", - "quickcheck": "@rules_rust_util_import__quickcheck-1.0.3//:quickcheck", - "quote": "@rules_rust_util_import__quote-1.0.10//:quote", - "syn": "@rules_rust_util_import__syn-1.0.82//:syn", - }, - }, -} - -_NORMAL_ALIASES = { - "": { - _COMMON_CONDITION: { - }, - }, -} - -_NORMAL_DEV_DEPENDENCIES = { - "": { - }, -} - -_NORMAL_DEV_ALIASES = { - "": { - }, -} - -_PROC_MACRO_DEPENDENCIES = { - "": { - }, -} - -_PROC_MACRO_ALIASES = { - "": { - }, -} - -_PROC_MACRO_DEV_DEPENDENCIES = { - "": { - }, -} - -_PROC_MACRO_DEV_ALIASES = { - "": { - }, -} - -_BUILD_DEPENDENCIES = { - "": { - }, -} - -_BUILD_ALIASES = { - "": { - }, -} - -_BUILD_PROC_MACRO_DEPENDENCIES = { - "": { - }, -} - -_BUILD_PROC_MACRO_ALIASES = { - "": { - }, -} - -_CONDITIONS = { - "aarch64-apple-darwin": ["@rules_rust//rust/platform:aarch64-apple-darwin"], - "aarch64-apple-ios": ["@rules_rust//rust/platform:aarch64-apple-ios"], - "aarch64-apple-ios-sim": ["@rules_rust//rust/platform:aarch64-apple-ios-sim"], - "aarch64-fuchsia": ["@rules_rust//rust/platform:aarch64-fuchsia"], - "aarch64-linux-android": ["@rules_rust//rust/platform:aarch64-linux-android"], - "aarch64-pc-windows-msvc": ["@rules_rust//rust/platform:aarch64-pc-windows-msvc"], - "aarch64-unknown-linux-gnu": ["@rules_rust//rust/platform:aarch64-unknown-linux-gnu"], - "arm-unknown-linux-gnueabi": ["@rules_rust//rust/platform:arm-unknown-linux-gnueabi"], - "armv7-linux-androideabi": ["@rules_rust//rust/platform:armv7-linux-androideabi"], - "armv7-unknown-linux-gnueabi": ["@rules_rust//rust/platform:armv7-unknown-linux-gnueabi"], - "cfg(target_os = \"wasi\")": ["@rules_rust//rust/platform:wasm32-wasi"], - "cfg(unix)": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-apple-ios", "@rules_rust//rust/platform:aarch64-apple-ios-sim", "@rules_rust//rust/platform:aarch64-fuchsia", "@rules_rust//rust/platform:aarch64-linux-android", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:arm-unknown-linux-gnueabi", "@rules_rust//rust/platform:armv7-linux-androideabi", "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi", "@rules_rust//rust/platform:i686-apple-darwin", "@rules_rust//rust/platform:i686-linux-android", "@rules_rust//rust/platform:i686-unknown-freebsd", "@rules_rust//rust/platform:i686-unknown-linux-gnu", "@rules_rust//rust/platform:powerpc-unknown-linux-gnu", "@rules_rust//rust/platform:s390x-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-apple-ios", "@rules_rust//rust/platform:x86_64-fuchsia", "@rules_rust//rust/platform:x86_64-linux-android", "@rules_rust//rust/platform:x86_64-unknown-freebsd", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], - "i686-apple-darwin": ["@rules_rust//rust/platform:i686-apple-darwin"], - "i686-linux-android": ["@rules_rust//rust/platform:i686-linux-android"], - "i686-pc-windows-msvc": ["@rules_rust//rust/platform:i686-pc-windows-msvc"], - "i686-unknown-freebsd": ["@rules_rust//rust/platform:i686-unknown-freebsd"], - "i686-unknown-linux-gnu": ["@rules_rust//rust/platform:i686-unknown-linux-gnu"], - "powerpc-unknown-linux-gnu": ["@rules_rust//rust/platform:powerpc-unknown-linux-gnu"], - "riscv32imc-unknown-none-elf": ["@rules_rust//rust/platform:riscv32imc-unknown-none-elf"], - "riscv64gc-unknown-none-elf": ["@rules_rust//rust/platform:riscv64gc-unknown-none-elf"], - "s390x-unknown-linux-gnu": ["@rules_rust//rust/platform:s390x-unknown-linux-gnu"], - "thumbv7em-none-eabi": ["@rules_rust//rust/platform:thumbv7em-none-eabi"], - "thumbv8m.main-none-eabi": ["@rules_rust//rust/platform:thumbv8m.main-none-eabi"], - "wasm32-unknown-unknown": ["@rules_rust//rust/platform:wasm32-unknown-unknown"], - "wasm32-wasi": ["@rules_rust//rust/platform:wasm32-wasi"], - "x86_64-apple-darwin": ["@rules_rust//rust/platform:x86_64-apple-darwin"], - "x86_64-apple-ios": ["@rules_rust//rust/platform:x86_64-apple-ios"], - "x86_64-fuchsia": ["@rules_rust//rust/platform:x86_64-fuchsia"], - "x86_64-linux-android": ["@rules_rust//rust/platform:x86_64-linux-android"], - "x86_64-pc-windows-msvc": ["@rules_rust//rust/platform:x86_64-pc-windows-msvc"], - "x86_64-unknown-freebsd": ["@rules_rust//rust/platform:x86_64-unknown-freebsd"], - "x86_64-unknown-linux-gnu": ["@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], - "x86_64-unknown-none": ["@rules_rust//rust/platform:x86_64-unknown-none"], -} - -############################################################################### - -def crate_repositories(): - """A macro for defining repositories for all generated crates. - - Returns: - A list of repos visible to the module through the module extension. - """ - maybe( - http_archive, - name = "rules_rust_util_import__aho-corasick-0.7.15", - sha256 = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/aho-corasick/0.7.15/download"], - strip_prefix = "aho-corasick-0.7.15", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.aho-corasick-0.7.15.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__cfg-if-1.0.0", - sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/cfg-if/1.0.0/download"], - strip_prefix = "cfg-if-1.0.0", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.cfg-if-1.0.0.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__env_logger-0.8.4", - sha256 = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/env_logger/0.8.4/download"], - strip_prefix = "env_logger-0.8.4", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.env_logger-0.8.4.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__getrandom-0.2.8", - sha256 = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/getrandom/0.2.8/download"], - strip_prefix = "getrandom-0.2.8", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.getrandom-0.2.8.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__lazy_static-1.4.0", - sha256 = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/lazy_static/1.4.0/download"], - strip_prefix = "lazy_static-1.4.0", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.lazy_static-1.4.0.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__libc-0.2.139", - sha256 = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/libc/0.2.139/download"], - strip_prefix = "libc-0.2.139", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.libc-0.2.139.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__log-0.4.17", - sha256 = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/log/0.4.17/download"], - strip_prefix = "log-0.4.17", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.log-0.4.17.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__memchr-2.5.0", - sha256 = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/memchr/2.5.0/download"], - strip_prefix = "memchr-2.5.0", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.memchr-2.5.0.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__proc-macro2-1.0.33", - sha256 = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.33/download"], - strip_prefix = "proc-macro2-1.0.33", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.proc-macro2-1.0.33.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__quickcheck-1.0.3", - sha256 = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/quickcheck/1.0.3/download"], - strip_prefix = "quickcheck-1.0.3", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.quickcheck-1.0.3.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__quote-1.0.10", - sha256 = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/quote/1.0.10/download"], - strip_prefix = "quote-1.0.10", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.quote-1.0.10.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__rand-0.8.5", - sha256 = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/rand/0.8.5/download"], - strip_prefix = "rand-0.8.5", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.rand-0.8.5.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__rand_core-0.6.4", - sha256 = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/rand_core/0.6.4/download"], - strip_prefix = "rand_core-0.6.4", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.rand_core-0.6.4.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__regex-1.4.6", - sha256 = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/regex/1.4.6/download"], - strip_prefix = "regex-1.4.6", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.regex-1.4.6.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__regex-syntax-0.6.28", - sha256 = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/regex-syntax/0.6.28/download"], - strip_prefix = "regex-syntax-0.6.28", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.regex-syntax-0.6.28.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__syn-1.0.82", - sha256 = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/syn/1.0.82/download"], - strip_prefix = "syn-1.0.82", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.syn-1.0.82.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__unicode-xid-0.2.4", - sha256 = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/unicode-xid/0.2.4/download"], - strip_prefix = "unicode-xid-0.2.4", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.unicode-xid-0.2.4.bazel"), - ) - - maybe( - http_archive, - name = "rules_rust_util_import__wasi-0.11.0-wasi-snapshot-preview1", - sha256 = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423", - type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/wasi/0.11.0+wasi-snapshot-preview1/download"], - strip_prefix = "wasi-0.11.0+wasi-snapshot-preview1", - build_file = Label("@rules_rust//util/import/3rdparty/crates:BUILD.wasi-0.11.0+wasi-snapshot-preview1.bazel"), - ) - - return [ - struct(repo = "rules_rust_util_import__aho-corasick-0.7.15", is_dev_dep = False), - struct(repo = "rules_rust_util_import__lazy_static-1.4.0", is_dev_dep = False), - struct(repo = "rules_rust_util_import__proc-macro2-1.0.33", is_dev_dep = False), - struct(repo = "rules_rust_util_import__quickcheck-1.0.3", is_dev_dep = False), - struct(repo = "rules_rust_util_import__quote-1.0.10", is_dev_dep = False), - struct(repo = "rules_rust_util_import__syn-1.0.82", is_dev_dep = False), - ] diff --git a/util/import/BUILD.bazel b/util/import/BUILD.bazel index 5e83a6c0..cdb8f220 100644 --- a/util/import/BUILD.bazel +++ b/util/import/BUILD.bazel @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_binary") -load("//rust:defs.bzl", "rust_library", "rust_proc_macro", "rust_test") +load("//rust:defs.bzl", "rust_proc_macro") # buildifier: disable=bzl-visibility load("//rust/private:transitions.bzl", "alias_with_import_macro_bootstrapping_mode") @@ -15,38 +15,7 @@ rust_proc_macro( "import.rs", ], crate_name = "import", - edition = "2018", - deps = [ - ":import_internal", - "//util/import/3rdparty/crates:syn", - ], -) - -rust_library( - name = "import_internal", - srcs = [ - "import_internal.rs", - ], - edition = "2018", - deps = [ - "//util/import/3rdparty/crates:aho-corasick", - "//util/import/3rdparty/crates:lazy_static", - "//util/import/3rdparty/crates:proc-macro2", - "//util/import/3rdparty/crates:quote", - "//util/import/3rdparty/crates:syn", - "//util/label", - ], -) - -rust_test( - name = "import_internal_test", - crate = ":import_internal", - edition = "2018", - # TODO: https://github.com/bazelbuild/rules_rust/issues/1672 - tags = ["manual"], - deps = [ - "//util/import/3rdparty/crates:quickcheck", - ], + edition = "2021", ) alias( diff --git a/util/import/deps.bzl b/util/import/deps.bzl deleted file mode 100644 index 83f883a1..00000000 --- a/util/import/deps.bzl +++ /dev/null @@ -1,11 +0,0 @@ -""" -The dependencies for running the gen_rust_project binary. -""" - -load("//util/import/3rdparty/crates:defs.bzl", "crate_repositories") - -def import_deps(): - return crate_repositories() - -# For legacy support -gen_rust_project_dependencies = import_deps diff --git a/util/import/import.rs b/util/import/import.rs index fff5e782..2b420eb5 100644 --- a/util/import/import.rs +++ b/util/import/import.rs @@ -1,19 +1 @@ -use syn::parse_macro_input; - -fn mode() -> import_internal::Mode { - match std::env::var("RULES_RUST_THIRD_PARTY_DIR") - .ok() - .and_then(|dir| dir.strip_prefix("//").map(|s| s.to_string())) - { - Some(third_party_dir) => import_internal::Mode::RenameFirstPartyCrates { third_party_dir }, - _ => import_internal::Mode::NoRenaming, - } -} - -#[proc_macro] -pub fn import(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - let input = parse_macro_input!(input as import_internal::ImportMacroInput); - import_internal::expand_imports(input, &mode()) - .unwrap_or_else(|errors| errors.into_iter().map(|e| e.into_compile_error()).collect()) - .into() -} +// Placeholder for Google's internal import macro diff --git a/util/import/import_internal.rs b/util/import/import_internal.rs deleted file mode 100644 index eb4350c7..00000000 --- a/util/import/import_internal.rs +++ /dev/null @@ -1,582 +0,0 @@ -use std::iter; -use std::vec; - -use aho_corasick::AhoCorasick; -use lazy_static::lazy_static; -use proc_macro2::{Span, TokenStream}; -use quote::quote_spanned; -use syn::parse::{Parse, ParseStream}; -use syn::{Error, Ident, Lit, LitStr, Result, Token}; - -/// The possible renaming modes for this macro. -pub enum Mode { - /// No renaming will be done; the expansion will replace each label with - /// just the target. - NoRenaming, - /// First-party crates will be renamed, and third-party crates will not be. - /// The expansion will replace first-party labels with an encoded version, - /// and third-party labels with just their target. - RenameFirstPartyCrates { third_party_dir: String }, -} - -/// A special case of label::Label, which must be absolute and must not specify -/// a repository. -#[derive(Debug, PartialEq, Eq)] -pub struct AbsoluteLabel<'s> { - package_name: &'s str, - name: &'s str, -} - -impl<'s> AbsoluteLabel<'s> { - /// Parses a string as an absolute Bazel label. Labels must be for the - /// current repository. - pub fn parse(label: &'s str, span: &'s Span) -> Result<Self> { - if let Ok(label::Label { - repository_name: None, - package_name: Some(package_name), - name, - }) = label::analyze(label) - { - Ok(AbsoluteLabel { package_name, name }) - } else { - Err(Error::new( - *span, - "Bazel labels must be of the form '//package[:target]'", - )) - } - } - - /// Returns true iff this label should be renamed. - fn should_rename(&self, mode: &Mode) -> bool { - match mode { - Mode::NoRenaming => false, - Mode::RenameFirstPartyCrates { third_party_dir } => { - !self.package_name.starts_with(third_party_dir) - } - } - } - - /// Returns the appropriate (encoded) alias to use, if this label is being - /// renamed; otherwise, returns None. - fn target_as_alias(&self, mode: &Mode) -> Option<String> { - self.should_rename(mode).then(|| encode(self.name)) - } - - /// Returns the full crate name, encoded if necessary. - pub fn crate_name(&self, mode: &Mode) -> String { - if self.should_rename(mode) { - encode(&format!("{}:{}", self.package_name, self.name)) - } else { - self.name.to_string() - } - } -} - -lazy_static! { - // The (unencoded, encoded) pairings here must match those in - // //rust/private/utils.bzl exactly. - static ref ENCODINGS: Vec<(&'static str, &'static str)> = - vec![ - (":", "x"), - ("!", "excl"), - ("%", "prc"), - ("@", "ao"), - ("^", "caret"), - ("`", "bt"), - (" ", "sp"), - ("\"", "dq"), - ("#", "octo"), - ("$", "dllr"), - ("&", "amp"), - ("'", "sq"), - ("(", "lp"), - (")", "rp"), - ("*", "astr"), - ("-", "d"), - ("+", "pl"), - (",", "cm"), - (";", "sm"), - ("<", "la"), - ("=", "eq"), - (">", "ra"), - ("?", "qm"), - ("[", "lbk"), - ("]", "rbk"), - ("{", "lbe"), - ("|", "pp"), - ("}", "rbe"), - ("~", "td"), - ("/", "y"), - (".", "pd"), - ]; - - // Transformations are stored as "(unencoded, encoded)" tuples. - // Target names can include: - // !%-@^_` "#$&'()*-+,;<=>?[]{|}~/. - // - // Package names are alphanumeric, plus [_/-]. - // - // Packages and targets are separated by colons. - static ref SUBSTITUTIONS: (Vec<String>, Vec<String>) = - iter::once(("_z".to_string(), "_zz_".to_string())) - .chain(ENCODINGS.iter() - .flat_map(|pair| { - vec![ - (format!("_{}_", &pair.1), format!("_z{}_", &pair.1)), - (pair.0.to_string(), format!("_{}_", &pair.1)), - ].into_iter() - }) - ) - .unzip(); - - static ref ENCODER: AhoCorasick = AhoCorasick::new(&SUBSTITUTIONS.0); - static ref DECODER: AhoCorasick = AhoCorasick::new(&SUBSTITUTIONS.1); -} - -/// Encodes a string using the above encoding scheme. -fn encode(s: &str) -> String { - ENCODER.replace_all(s, &SUBSTITUTIONS.1) -} - -struct Import { - label: LitStr, - alias: Option<Ident>, -} - -impl Import { - fn try_into_statement(self, mode: &Mode) -> Result<proc_macro2::TokenStream> { - let label_literal = &self.label.value(); - let span = self.label.span(); - let label = AbsoluteLabel::parse(label_literal, &span)?; - let crate_name = &label.crate_name(mode); - - let crate_ident = Ident::new(crate_name, span); - let alias = self - .alias - .or_else(|| { - label - .target_as_alias(mode) - .map(|alias| Ident::new(&alias, span)) - }) - .filter(|alias| alias != crate_name); - - Ok(if let Some(alias) = alias { - quote_spanned! {span=> extern crate #crate_ident as #alias; } - } else { - quote_spanned! {span=> extern crate #crate_ident;} - }) - } -} - -pub struct ImportMacroInput { - imports: Vec<Import>, -} - -impl Parse for ImportMacroInput { - fn parse(input: ParseStream) -> Result<Self> { - let mut imports: Vec<Import> = Vec::new(); - - while !input.is_empty() { - let label = match Lit::parse(input) - .map_err(|_| input.error("expected Bazel label as a string literal"))? - { - Lit::Str(label) => label, - lit => { - return Err(input.error(format!( - "expected Bazel label as string literal, found '{}' literal", - quote::quote! {#lit} - ))); - } - }; - let alias = if input.peek(Token![as]) { - <Token![as]>::parse(input)?; - Some( - Ident::parse(input) - .map_err(|_| input.error("alias must be a valid Rust identifier"))?, - ) - } else { - None - }; - imports.push(Import { label, alias }); - <syn::Token![;]>::parse(input)?; - } - - Ok(Self { imports }) - } -} - -pub fn expand_imports( - input: ImportMacroInput, - mode: &Mode, -) -> std::result::Result<TokenStream, Vec<syn::Error>> { - let (statements, errs): (Vec<_>, Vec<_>) = input - .imports - .into_iter() - .map(|i| i.try_into_statement(mode)) - .partition(Result::is_ok); - - if !errs.is_empty() { - Err(errs.into_iter().map(Result::unwrap_err).collect()) - } else { - Ok(statements.into_iter().map(Result::unwrap).collect()) - } -} - -#[cfg(test)] -mod tests { - use crate::*; - use quickcheck::quickcheck; - use syn::parse_quote; - - /// Decodes a string that was encoded using `encode`. - fn decode(s: &str) -> String { - DECODER.replace_all(s, &SUBSTITUTIONS.0) - } - - #[test] - fn test_expand_imports_without_renaming() -> std::result::Result<(), Vec<syn::Error>> { - let mode = Mode::NoRenaming; - - // Nothing to do. - let expanded = expand_imports(parse_quote! {}, &mode)?; - assert_eq!(expanded.to_string(), ""); - - // Package and a target. - let expanded = expand_imports(parse_quote! { "//some_project:utils"; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate utils ;"); - - // Package and a target, with a no-op alias. - let expanded = expand_imports(parse_quote! { "//some_project:utils"; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate utils ;"); - - // Package and a target, with an alias. - let expanded = expand_imports(parse_quote! { "//some_project:utils" as my_utils; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate utils as my_utils ;"); - - // Package and an implicit target. - let expanded = expand_imports(parse_quote! { "//some_project/utils"; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate utils ;"); - - // Package and an implicit target, with a no-op alias. - let expanded = expand_imports(parse_quote! { "//some_project/utils" as utils; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate utils ;"); - - // Package and an implicit target, with an alias. - let expanded = expand_imports(parse_quote! { "//some_project:utils" as my_utils; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate utils as my_utils ;"); - - // A third-party target. - let expanded = - expand_imports(parse_quote! { "//third_party/rust/serde/v1:serde"; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate serde ;"); - - // A third-party target with a no-op alias. - let expanded = expand_imports( - parse_quote! { "//third_party/rust/serde/v1:serde" as serde; }, - &mode, - )?; - assert_eq!(expanded.to_string(), "extern crate serde ;"); - - // A third-party target with an alias. - let expanded = expand_imports( - parse_quote! { "//third_party/rust/serde/v1:serde" as my_serde; }, - &mode, - )?; - assert_eq!(expanded.to_string(), "extern crate serde as my_serde ;"); - - // Multiple targets. - let expanded = expand_imports( - parse_quote! { "//some_project:utils"; "//third_party/rust/serde/v1:serde"; }, - &mode, - )?; - assert_eq!( - expanded.to_string(), - "extern crate utils ; extern crate serde ;" - ); - - Ok(()) - } - - #[test] - fn test_expand_imports_with_renaming() -> std::result::Result<(), Vec<syn::Error>> { - let mode = Mode::RenameFirstPartyCrates { - third_party_dir: "third_party/rust".to_string(), - }; - - // Nothing to do. - let expanded = expand_imports(parse_quote! {}, &mode)?; - assert_eq!(expanded.to_string(), ""); - - // Package and a target. - let expanded = expand_imports(parse_quote! { "//some_project:utils"; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_x_utils as utils ;" - ); - - // Package and a target, with a no-op alias. - let expanded = expand_imports(parse_quote! { "//some_project:utils" as utils; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_x_utils as utils ;" - ); - - // Package and a target, with an alias. - let expanded = expand_imports(parse_quote! { "//some_project:utils" as my_utils; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_x_utils as my_utils ;" - ); - - // Package and an implicit target. - let expanded = expand_imports(parse_quote! { "//some_project/utils"; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_y_utils_x_utils as utils ;" - ); - - // Package and an implicit target, with a no-op alias. - let expanded = expand_imports(parse_quote! { "//some_project/utils" as utils; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_y_utils_x_utils as utils ;" - ); - - // Package and an implicit target, with an alias. - let expanded = expand_imports(parse_quote! { "//some_project/utils" as my_utils; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_y_utils_x_utils as my_utils ;" - ); - - // A third-party target. - let expanded = - expand_imports(parse_quote! { "//third_party/rust/serde/v1:serde"; }, &mode)?; - assert_eq!(expanded.to_string(), "extern crate serde ;"); - - // A third-party target with a no-op alias. - let expanded = expand_imports( - parse_quote! { "//third_party/rust/serde/v1:serde" as serde; }, - &mode, - )?; - assert_eq!(expanded.to_string(), "extern crate serde ;"); - - // A third-party target with an alias. - let expanded = expand_imports( - parse_quote! { "//third_party/rust/serde/v1:serde" as my_serde; }, - &mode, - )?; - assert_eq!(expanded.to_string(), "extern crate serde as my_serde ;"); - - // Multiple targets. - let expanded = expand_imports( - parse_quote! { "//some_project:utils"; "//third_party/rust/serde/v1:serde"; }, - &mode, - )?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_x_utils as utils ; extern crate serde ;" - ); - - // Problematic target name. - let expanded = expand_imports(parse_quote! { "//some_project:thing-types"; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_x_thing_d_types as thing_d_types ;" - ); - - // Problematic target name with alias. - let expanded = expand_imports( - parse_quote! { "//some_project:thing-types" as types; }, - &mode, - )?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_x_thing_d_types as types ;" - ); - - // Problematic package name. - let expanded = expand_imports(parse_quote! { "//some_project-prototype:utils"; }, &mode)?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_d_prototype_x_utils as utils ;" - ); - - // Problematic package and target names. - let expanded = expand_imports( - parse_quote! { "//some_project-prototype:thing-types"; }, - &mode, - )?; - assert_eq!( - expanded.to_string(), - "extern crate some_project_d_prototype_x_thing_d_types as thing_d_types ;" - ); - - Ok(()) - } - - #[test] - fn test_expansion_failures() -> Result<()> { - let mode = Mode::NoRenaming; - - // Missing leading "//", not a valid label. - let errs = expand_imports(parse_quote! { "some_project:utils"; }, &mode).unwrap_err(); - assert_eq!( - errs.into_iter() - .map(|e| e.to_string()) - .collect::<Vec<String>>(), - vec!["Bazel labels must be of the form '//package[:target]'"] - ); - - // Valid label, but relative. - let errs = expand_imports(parse_quote! { ":utils"; }, &mode).unwrap_err(); - assert_eq!( - errs.into_iter() - .map(|e| e.to_string()) - .collect::<Vec<String>>(), - vec!["Bazel labels must be of the form '//package[:target]'"] - ); - - // Valid label, but a wildcard. - let errs = expand_imports(parse_quote! { "some_project/..."; }, &mode).unwrap_err(); - assert_eq!( - errs.into_iter() - .map(|e| e.to_string()) - .collect::<Vec<String>>(), - vec!["Bazel labels must be of the form '//package[:target]'"] - ); - - // Valid label, but only in Bazel (not in Bazel). - let errs = - expand_imports(parse_quote! { "@repository//some_project:utils"; }, &mode).unwrap_err(); - assert_eq!( - errs.into_iter() - .map(|e| e.to_string()) - .collect::<Vec<String>>(), - vec!["Bazel labels must be of the form '//package[:target]'"] - ); - - Ok(()) - } - - #[test] - fn test_macro_input_parsing_errors() -> Result<()> { - // Label is not a string literal. - assert_eq!( - syn::parse_str::<ImportMacroInput>("some_project:utils;") - .err() - .unwrap() - .to_string(), - "expected Bazel label as a string literal" - ); - - // Label is the wrong kind of literal. - assert_eq!( - syn::parse_str::<ImportMacroInput>("true;") - .err() - .unwrap() - .to_string(), - "expected Bazel label as string literal, found 'true' literal" - ); - assert_eq!( - syn::parse_str::<ImportMacroInput>("123;") - .err() - .unwrap() - .to_string(), - "expected Bazel label as string literal, found '123' literal" - ); - - // Alias is not a valid identifier. - assert_eq!( - syn::parse_str::<ImportMacroInput>(r#""some_project:utils" as "!@#$%";"#) - .err() - .unwrap() - .to_string(), - "alias must be a valid Rust identifier" - ); - - Ok(()) - } - - #[test] - fn test_label_parsing() -> Result<()> { - assert_eq!( - AbsoluteLabel::parse("//some_project:utils", &Span::call_site())?, - AbsoluteLabel { - package_name: "some_project", - name: "utils" - }, - ); - assert_eq!( - AbsoluteLabel::parse("//some_project/utils", &Span::call_site())?, - AbsoluteLabel { - package_name: "some_project/utils", - name: "utils" - }, - ); - assert_eq!( - AbsoluteLabel::parse("//some_project", &Span::call_site())?, - AbsoluteLabel { - package_name: "some_project", - name: "some_project" - }, - ); - - Ok(()) - } - - #[test] - fn test_substitutions_concatenate() -> Result<()> { - // Every combination of orig + orig, orig + encoded, encoded + orig, and - // encoded + encoded round trips the encoding successfully. - for s in SUBSTITUTIONS.0.iter().chain(SUBSTITUTIONS.1.iter()) { - for t in SUBSTITUTIONS.0.iter().chain(SUBSTITUTIONS.1.iter()) { - let concatenated = format!("{}{}", s, t); - assert_eq!(&decode(&encode(&concatenated)), &concatenated); - } - } - - Ok(()) - } - - #[test] - fn test_encode() -> Result<()> { - assert_eq!(encode("some_project:utils"), "some_project_x_utils"); - assert_eq!(&encode("_zpd_"), "_zz_pd_"); - - // All the encodings should be what we expect. - for (orig, encoded) in SUBSTITUTIONS.0.iter().zip(SUBSTITUTIONS.1.iter()) { - assert_eq!(&encode(orig), encoded); - } - - Ok(()) - } - - #[test] - fn test_decode() -> Result<()> { - assert_eq!(decode("some_project_x_utils"), "some_project:utils"); - assert_eq!(decode("_zz_pd_"), "_zpd_"); - - // All the decodings should be what we expect. - for (orig, encoded) in SUBSTITUTIONS.0.iter().zip(SUBSTITUTIONS.1.iter()) { - assert_eq!(&decode(encoded), orig); - } - - Ok(()) - } - - #[test] - fn test_substitutions_compose() -> Result<()> { - for s in SUBSTITUTIONS.0.iter().chain(SUBSTITUTIONS.1.iter()) { - assert_eq!(&decode(&encode(s)), s); - } - - Ok(()) - } - - quickcheck! { - fn composition_is_identity(s: String) -> bool { - s == decode(&encode(&s)) - } - } -} |