Squashed 'third_party/rules_rust/' changes from bf59038cac..078c6908fc

078c6908fc add cc_common.link support for rust_library and rust_test (#1490)
c07aef0287 Skip supplying rpaths on Fuchsia (#1511)
6ee7c80bdb Propagate rustc_env{,_files} from rust_test.crate (#1443)
1cd0788d2a Apply get_lib_name correctly to the C++ runtime libraries (#1508)
90808f0dc4 Minor cleanup to documentation (#1505)
735640f2df Enable rust-analyzer tests on windows. (#1506)
0f34573166 Updated rules_rust to version 0.9.0 (#1503)
9b61b49934 Promoted crate_universe to non-experimental (#1504)
76360dd354 Implement rules archive release artifact in github action. (#1501)
4e5fac5980 Do not pass `--Clink-arg=-l` for libstd and libtest (#1500)
6c38934636 pipelining: add the ability to disable pipelining for a single rule. (#1499)
867fc37c17 rules_rust: enable pipelined compilation. (#1275)
c97f255dfe Delete deprecated targets (#1496)
43b42884a7 Updated examples to use crate_universe (#1494)
0ffde973e8 Updated `//util/import` to use crate_universe (#1492)
83a03ab03e Updated proto rules to fetch dependencies using crate_universe (#1491)
67e204ff22 fix: `rust_doc_test` failure to find params file (#1418)
0fc834bdfa Updated all toolchain_type definitions to be named `toolchain_type`. (#1479)
3be056a7a3 toolchain files: ensure test depends on std (#1486)
228ebfa6eb Updated rules_rust to version `0.8.1`. (#1484)
685dfda497 Fixed use of rust-analyzer with rust_static_library and rust_shared_library (#1482)
2d7f94543f Fix rust-analyzer being unable to find rust sysroot sources. (#1483)
81a77acde2 Updated rules_rust to version `0.8.0`. (#1472)
caad908848 Give useful error on missing workspace manifest (#1475)
0e86b9dd30 Added `rust_analyzer_toolchain` and repository rules for creating one (#1455)
838e4ea828 Update docs on lockfiles (#1477)
fce1222628 Fix typo in function name (#1478)
1929bfbc3e Added Rust version 1.62.1 (#1476)
9a8e878d3d Fix `rust_binary_without_process_wrapper` build with `--stamp` (#1473)
25baabc205 Updated bindgen version (#1470)
8c9d5c7051 Updated rust-analyzer generator to use clap (#1471)
6d8009dbc8 Update `//bindgen` to use `crate_universe` (#1440)
67c97d44ff Updated `tools/rust_analyzer` to use `crate_universe`. (#1448)
6c285eb28e Updated `wasm_bindgen` rules dependencies. (#1464)
82a437cc17 Fixed crate_universe lockfile checks for crates_repository rule (#1468)
e83d5f3c77 Limit coverage to requested files (#1467)
daff327ea7 Stamp only binaries by default (#1452)
adc80a301d Cleanup crate_universe dependency macros (#1460)
824b121acc Updated header of crate_universe generated files to include a regen command (#1461)
d44e1d8363 feat: add `rustc_flags` attr to `rust_doc` rule (#1458)
6b54feb0ff add a way to distinguish proc-macro deps (#1420)
6070b3c9f4 Fixed missing items in distro artifact (#1450)
1e83e74159 do not add proc-macro deps to transitive_link_search_paths (#1424)
ced94dec1b Fix @libgit2 (#1457)
03d1d5e4ac Add extra_rustc_flag and extra_exec_rustc_flag (#1413)
711adc7985 crate_universe: shorten `crate_universe_crate_index` to `cui` (#1454)
8cb9247f18 Replaced small genrules with uses of bazel_skylib (#1451)
38e841aece Upgrade stardoc (#1444)
674762f66a Updated toolchain repository rules to represent one toolchain per repo (#1442)
b22a6e1416 Re-enable disabled windows jobs in CI (#1353)
2fb94c48fd docs: Update homepage to use latest version (#1441)
389c58fcb1 Updated rules_rust to version `0.7.0`. (#1436)
60f26d49d8 exclude `BUILD` and `WORKSPACE` files from generated crate_universe targets (#1437)
26344d4cd7 Have rust_test put its compilation outputs in a subdirectory (#1434)
8b0f644122 Updated crate_universe version to `0.4.0`. (#1435)
adf92b1534 update crate_universe `--repin` args to not require values. (#1433)
da75146d0a Do not attempt to instrument rust code for coverage if rust_toolchain.llvm-cov is None (#1432)
bde2c36821 Added Rust 1.62.0 (#1427)
7056f22bd0 Fixed crate_universe not finding target library names for "rlib"s (#1429)
3d65214d23 crate_universe support for individually updating packages. (#1426)
5a9d999db9 Updated `attr.label` attribute defaults to use `Label` constructor (#1422)
52fc70145a Added `TemplateVariableInfo` to `rust_toolchain`. (#1416)
7465c1aa29 Add test coverage support (#1324)
c5c3603da6 Bump the min supported bazel version (#1414)
937bdc9d05 Add a `cargo_dep_env` rule for setting build.rs environment variables (#1415)
91466fc0d1 Updated `rules_rust` version to `0.6.0`. (#1397)
97264b79d5 Update wasm_bindgen to use crate universe. (#1398)
d3197a65c5 Updated crate_universe version (to `0.3.0`) and dependencies (#1409)
a15e67d666 Deleted "extra workspace member" functionality from crate_universe (#1406)
5910a7585a Use a vec, not set for rustc_flags for crate_universe annotations (#1404)
3aa88ab067 Deleted deprecated `rust_analyzer` rule. (#1405)
7adf7210d0 cargo: Fix handling of relative sysroots (#1371)
57607239ec Enable rustfmt CI for Windows. (#1403)
30e68b49be Added more "ignore" tags to rustfmt and clippy rules. (#1400)
53ad14eead Added support for vendoring external manifests (#1381)
ff243c6ef0 Reorganized rustfmt source tree (#1399)
94e0044afe Refactored the Rustfmt tool to work cross-platform (#1375)
8fca438124 Ran clang-format on all C++ sources (#1396)
e765719e29 Added TemplateVariableInfo to rust_toolchain (#1377)
81590f4b6a Fixed Clippy bug with `--@rules_rust//:clippy_flags`. (#1392)
d77b9f7c6a Use  `target_compatible_with` to make `macos` with `Xcode` happy (#1391)
ec27dbe310 Added comments to internal function (#1378)
a9dd2f9200 Removed deprecated file (#1380)
16175c881c Renamed toolchain files targets (#1376)
c7cb5bd7a8 Support crates that have mix of generated and nongenerated inputs (#1340)
521e649ff4 Avoid using common substrings as encodings. (#1370)
28ac6b133d Use a more compact encoding in the `import` macro. (#1365)
3a099bfa97 Fix incorrect assertion in test_env_launcher test (#1368)
4661093fb1 Use target instead of rule in rust_register_toolchains edition docs (#1366)
652f2802e3 Add `env` attribute to `rust_toolchain`. (#1363)
9520f37f1e Update rules_perl in examples (#1364)
1b451c301e Add armv7-linux-androideabi tier 2 triple (#1362)
0265c293f1 Ensure crate_features to be included correctly in rust_project.json (#1356)
121d65fe6a Updated `rules_rust` version to `0.5.0` (#1360)
aca4ec1a0f crate_universe: fix typo (#1314)
69ca2611c5 Don't leak native dependencies of proc_macro (#1359)
4c7f08b8b9 Fixed missing docs (#1358)
e48bec94de feat: build script toolchains annotations (#1344)
ffb946f4b7 Ensure memchr is linked after libobject (#1349)
edca1d8042 Add developing notes for crate_universe (#1351)
120f911d2f Updated rust_bindgen dependencies API (#1354)
42c4528a5f Added Rust 1.61.0 (#1347)
c05e0c6ab1 Fixed fetch_shas script to correctly include .gz and .xz extensions (#1355)
9770b0dd75 Update apple_support (#1346)
87eb807e67 Added support for Rust 1.61.0 to crate_universe (#1348)
84c1d42128 Temporarily disable windows job in CI. (#1352)
421d30e4ff Remove unnecessary `crate_name` usage in `rust_test_suite`. (#1345)
10185339dd Build `rust_test` targets with `crate` using the same crate name as the underlying library target. (#1332)
0049ce3884 Add support for riscv32 targets (#1323)
3aa6de3c63 remove experimental_use_whole_archive_for_native_deps (#1338)
a066bfed46 Replace slashes with underscores in default crate names. (#1336)
1b91e592d5 Revert "Replace slashes with underscores in default crate names. (#1334)" (#1335)
51f8e302e9 "sandwich" rlibs between native deps in linker order (#1333)
df354904a1 Replace slashes with underscores in default crate names. (#1334)
21eed19188 Bump version to 0.4.0 (#1329)
d3d9abac4d Support . workspace member (#1326)
fccaae3055 Error calling `all_crate_deps` without `Cargo.toml` (#1327)
d7c532cb78 Updated wasm_bindgen dependencies API (#1313)
fb4d5546ea Updated wasm_bindgen rules to only require core `rules_nodejs` rules (#1311)
1590670ae1 Prevents running of clippy on bindgen targets (#1320)
73d0164a34 Add support for aarch64-apple-ios-sim (#1304)
61eee54c73 Add bazel-* directories in cargo_manifest_dir/external_crate to gitignore (#1279)
42f78f25e1 crate_universe: Improved documentation (#1305)
bddc4bd94a Silence warnings for example/test dependencies (#1312)
b04fe3b21f Use tinyjson from crates.io instead of github.com. (#1309)
1cab691d14 Remove doc about STATIC_RUST_URL env var. (#1306)
d86e06a884 Don't propagate non-shared transitive linker inputs from `rust_static|shared_library` (#1299)
5abeb93333 Don't emit `CrateInfo` from `rust_static_library` and `rust_shared_library` (#1298)
0175a1b7aa fix for using a nightly channel after https://github.com/bazelbuild/rules_rust/commit/841fc6fb82141576d91aecb1d3f2656d58b0ab71 (#1302)
e07881fa22 Updated crate_universe docs (#1301)
c63ad973f1 rustc: fix a conditional (#1300)
a6f332fcbe Use __EXEC_ROOT__ paths for genfiles in rust_analyzer aspect (#1293)
97de47df51 Remove 'triple' field from triple struct in favor of 'str' (#1297)
58627f59eb Make get_host_triple public to get a triple from Bazel's repository_ctx (#1289)
612f4362bc Updated `rules_rust` version to `0.3.1` (#1296)
26fa5a15de Fixed build issues in release artifact (#1295)
48bb32f817 crate_universe: Added tests for serialized config files. (#1291)
841fc6fb82 Enable xz archives (#1284)
f7cb22efa6 feat(#514): pass extra flags to clippy (#1264)
e9f8b48711 Updated `rules_rust` version to `0.3.0` (#1288)
c900e1c66c Revert "Add workaround for arm vs armv7 android issue (#1259)" (#1290)
01ebef2fb9 Remove DEFAULT_RUST_EDITION (#1256)
03a70796ab Outside of examples, fill in all `edition` attrs (#1257)
207ee4fbcf feat: support extra deps in rust_doc_test (#1286)
4e7d114a8e Fix typo in render config doc (#1281)
db17f291d3 Fix crate annotation anchor (#1282)
fdb6851a92 Fix target name in `rust_test` example. (#1280)
4fb6e40147 Don't leak additive build file content across crates (#1278)
965044ae2b Remove `rust_test` example which doesn't build. (#1267)
f6e7e0a93f add a stopgap experimental_use_whole_archive_for_native_deps attribute (#1269)
34fd46756a process_wrapper: add support for terminating rustc after it emits rmeta. (#1207)
b778fca0ac crate_universe: propagate build_script_tools (#1266)
f6f27a8734 Add workaround for arm vs armv7 android issue (#1259)
c3f56c2d50 Add the BUILD.bazel file to the wasm_bindgen distro filegroup target (#1246) (#1261)
1f2e6231de Set edition for process_wrapper and cargo_build_script_runner (#1254)
55790492ac Updated Rust to 1.60.0 (#1247)
b594f90f17 Workaround for issue in linux Cargo binaries (#1252)
8f0dd9042e rust_test_suite: ensure crate names are valid (#1248)
4144ddeb9c Updating `rules_rust` version to `0.2.1` (#1243)
65cad76a52 Fixed proto package in release artifact (#1241)
4d8de6e361 Updated repository pin in the docs (#1240)
e5a3970754 Updating `rules_rust` version to `0.2.0` (#1235)
d061bf640e Updated `crate_universe` version to `0.2.0` (#1239)
c0505da0d2 Replace `rust_repositories` with `rust_register_toolchains` in docs (#1237)
145ad7609f Fixed `crates_repository` deleting `.cargo/config.toml` files. (#1227)
20066b05e2 fix: distribute `//tools/rust_analyzer` (#1234)
b58ce89603 Enabled `rust_doc_test` for `crate_universe` (#1232)
d2e2470cbf Fix some unit tests to run from another workspace (#1226)
b03aee039a Fixed `crate_universe` clippy defects (#1228)
41b39f0c99 add bots using lld (and examples with clang as a drive by) (#1221)
84e98e4d2f don't emit --codegen={metadata,extra-filename} for rust_static_library and rust_shared_library (#1222)
e48c834a40 Renamed `crate_index` repository to `crate_universe_crate_index` (#1217)
99b4b2574f fix use of stamping in rust_binary_without_process_wrapper (#1218)
8df4517d37 Add NUM_JOBS env var to cargo build scripts (#1216)
628e85e70f Restrucutred `crate_universe` dependency macros (#1208)
e3d67a0a10 Updated docs to guide users to using releases (#1213)
fd912e644c Updated crate_universe docs. (#1212)
cde4c0826c Delete deprecated `rules` targets (#1210)
26e01c8386 cache the release archive in release actions (#1201)
3205c9d846 Updated crate_universe setup guide (#1202)
c078494678 Don't leak deps from rust_proc_macro (#1206)
7c865ffeb1 Build `_import_macro_dep` in `exec` mode (#1203)
635da93206 Updating `rules_rust` version to `0.1.0`. (#1198)
6c797c9070 disable advanced features of C++ rules (#1200)
86d47a1bba Tweak import macro bootstrap to trick rust analyzer aspect (#1179)
80d197205a Added release workflow (#1195)
cd44b3670a Added support for producing distribution archives (#1194)
a665447989 Traverse custom alias-like rules in the rust analyzer aspect (#1190)
4504983fa9 Add a test showing that rust_analayzer aspect traverses aliases (#1188)
297dd18215 Updated `crate_universe` to version `0.1.0`. (#1197)
0d9c7d5e1b Specify root target for rust_analyzer test (#1189)
4a0352fecd Updated `crate_universe` dependencies (#1196)
5126479254 Fixed crate_universe release tools (#1193)
e840400eb6 Remove last remains of use_process_wrapper flag. (#1192)
eb7db68d96 Fix iOS linker arguments (#1186)
de726a10c9 Create internal rust_binary rule instead of using transitions (#1187)
5e6ad9f638 Regenerated `cargo-raze` outputs with v0.15.0 (#1184)
980b662843 add static_library to get_preferred_artifact with pic (#1183)
97fd329540 Populate CFLAGS and CXXFLAGS when invoking build script. (#1081)

git-subtree-dir: third_party/rules_rust
git-subtree-split: 078c6908fc32c168b58e72cc3884dd8e30419e3a
Signed-off-by: Brian Silverman <bsilver16384@gmail.com>
Change-Id: Ifc218edaa852263bd76835ee7de44de07c08aec2
diff --git a/examples/sys/basic/3rdparty/BUILD.bazel b/examples/sys/basic/3rdparty/BUILD.bazel
new file mode 100644
index 0000000..8516755
--- /dev/null
+++ b/examples/sys/basic/3rdparty/BUILD.bazel
@@ -0,0 +1,20 @@
+load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_vendor")
+
+crates_vendor(
+    name = "crates_vendor",
+    annotations = {
+        "bzip2-sys": [crate.annotation(
+            gen_build_script = True,
+        )],
+    },
+    cargo_lockfile = "Cargo.Bazel.lock",
+    generate_build_scripts = False,
+    mode = "remote",
+    packages = {
+        "bzip2": crate.spec(
+            version = "=0.3.3",
+        ),
+    },
+    repository_name = "basic_sys",
+    tags = ["manual"],
+)
diff --git a/examples/sys/basic/Cargo.lock b/examples/sys/basic/3rdparty/Cargo.Bazel.lock
similarity index 64%
rename from examples/sys/basic/Cargo.lock
rename to examples/sys/basic/3rdparty/Cargo.Bazel.lock
index 7a14e37..39f301a 100644
--- a/examples/sys/basic/Cargo.lock
+++ b/examples/sys/basic/3rdparty/Cargo.Bazel.lock
@@ -1,5 +1,7 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+version = 3
+
 [[package]]
 name = "bzip2"
 version = "0.3.3"
@@ -12,9 +14,9 @@
 
 [[package]]
 name = "bzip2-sys"
-version = "0.1.9+1.0.8"
+version = "0.1.11+1.0.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad3b39a260062fca31f7b0b12f207e8f2590a67d32ec7d59c20484b07ea7285e"
+checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
 dependencies = [
  "cc",
  "libc",
@@ -23,25 +25,25 @@
 
 [[package]]
 name = "cc"
-version = "1.0.60"
+version = "1.0.73"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
+checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
 
 [[package]]
-name = "libc"
-version = "0.2.77"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
-
-[[package]]
-name = "pkg-config"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
-
-[[package]]
-name = "rules_rust_examples_basic_sys"
+name = "direct-cargo-bazel-deps"
 version = "0.0.1"
 dependencies = [
  "bzip2",
 ]
+
+[[package]]
+name = "libc"
+version = "0.2.126"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
+
+[[package]]
+name = "pkg-config"
+version = "0.3.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
diff --git a/examples/sys/basic/3rdparty/crates/BUILD.bazel b/examples/sys/basic/3rdparty/crates/BUILD.bazel
new file mode 100644
index 0000000..f78524b
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/BUILD.bazel
@@ -0,0 +1,41 @@
+###############################################################################
+# @generated
+# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
+# regenerate this file, run the following:
+#
+#     bazel run //sys/basic/3rdparty:crates_vendor
+###############################################################################
+
+package(default_visibility = ["//visibility:public"])
+
+exports_files(
+    [
+        "cargo-bazel.json",
+        "defs.bzl",
+        "crates.bzl",
+    ] + glob([
+        "*.bazel",
+    ]),
+)
+
+filegroup(
+    name = "srcs",
+    srcs = glob([
+        "*.bazel",
+        "*.bzl",
+    ]),
+)
+
+# Workspace Member Dependencies
+alias(
+    name = "bzip2",
+    actual = "@basic_sys__bzip2-0.3.3//:bzip2",
+    tags = ["manual"],
+)
+
+# Binaries
+alias(
+    name = "cc__gcc-shim",
+    actual = "@basic_sys__cc-1.0.73//:gcc-shim__bin",
+    tags = ["manual"],
+)
diff --git a/examples/sys/basic/3rdparty/crates/BUILD.bzip2-0.3.3.bazel b/examples/sys/basic/3rdparty/crates/BUILD.bzip2-0.3.3.bazel
new file mode 100644
index 0000000..e790651
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/BUILD.bzip2-0.3.3.bazel
@@ -0,0 +1,92 @@
+###############################################################################
+# @generated
+# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
+# regenerate this file, run the following:
+#
+#     bazel run //sys/basic/3rdparty:crates_vendor
+###############################################################################
+
+load(
+    "@bazel_skylib//lib:selects.bzl",
+    "selects",
+)
+
+# buildifier: disable=bzl-visibility
+load("@rules_rust//crate_universe/private:selects.bzl", "select_with_or")
+load(
+    "@rules_rust//rust:defs.bzl",
+    "rust_library",
+)
+
+package(default_visibility = ["//visibility:public"])
+
+# licenses([
+#     "TODO",  # MIT/Apache-2.0
+# ])
+
+rust_library(
+    name = "bzip2",
+    srcs = glob(
+        include = [
+            "**/*.rs",
+        ],
+        exclude = [
+        ],
+    ),
+    aliases = selects.with_or({
+        "//conditions:default": {
+        },
+    }),
+    compile_data = glob(
+        include = ["**"],
+        exclude = [
+            "BUILD",
+            "BUILD.bazel",
+            "WORKSPACE",
+            "WORKSPACE.bazel",
+        ],
+    ) + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    crate_features = [
+    ],
+    crate_root = "src/lib.rs",
+    data = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    edition = "2015",
+    proc_macro_deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_env = {
+    },
+    rustc_env_files = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_flags = [
+        # In most cases, warnings in 3rd party crates are not interesting as
+        # they're out of the control of consumers. The flag here silences
+        # warnings. For more details see:
+        # https://doc.rust-lang.org/rustc/lints/levels.html
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-bazel",
+        "manual",
+        "noclippy",
+        "norustfmt",
+    ],
+    version = "0.3.3",
+    deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+            "@basic_sys__bzip2-sys-0.1.11-1.0.8//:bzip2_sys",
+            "@basic_sys__libc-0.2.126//:libc",
+        ],
+    }),
+)
diff --git a/examples/sys/basic/3rdparty/crates/BUILD.bzip2-sys-0.1.11+1.0.8.bazel b/examples/sys/basic/3rdparty/crates/BUILD.bzip2-sys-0.1.11+1.0.8.bazel
new file mode 100644
index 0000000..34b0c06
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/BUILD.bzip2-sys-0.1.11+1.0.8.bazel
@@ -0,0 +1,178 @@
+###############################################################################
+# @generated
+# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
+# regenerate this file, run the following:
+#
+#     bazel run //sys/basic/3rdparty:crates_vendor
+###############################################################################
+
+load(
+    "@bazel_skylib//lib:selects.bzl",
+    "selects",
+)
+load(
+    "@rules_rust//cargo:defs.bzl",
+    "cargo_build_script",
+)
+
+# buildifier: disable=bzl-visibility
+load("@rules_rust//crate_universe/private:selects.bzl", "select_with_or")
+load(
+    "@rules_rust//rust:defs.bzl",
+    "rust_library",
+)
+
+package(default_visibility = ["//visibility:public"])
+
+# licenses([
+#     "TODO",  # MIT/Apache-2.0
+# ])
+
+rust_library(
+    name = "bzip2_sys",
+    srcs = glob(
+        include = [
+            "**/*.rs",
+        ],
+        exclude = [
+        ],
+    ),
+    aliases = selects.with_or({
+        "//conditions:default": {
+        },
+    }),
+    compile_data = glob(
+        include = ["**"],
+        exclude = [
+            "BUILD",
+            "BUILD.bazel",
+            "WORKSPACE",
+            "WORKSPACE.bazel",
+        ],
+    ) + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    crate_features = [
+    ],
+    crate_root = "lib.rs",
+    data = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    edition = "2015",
+    proc_macro_deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_env = {
+    },
+    rustc_env_files = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_flags = [
+        # In most cases, warnings in 3rd party crates are not interesting as
+        # they're out of the control of consumers. The flag here silences
+        # warnings. For more details see:
+        # https://doc.rust-lang.org/rustc/lints/levels.html
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-bazel",
+        "manual",
+        "noclippy",
+        "norustfmt",
+    ],
+    version = "0.1.11+1.0.8",
+    deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+            "@basic_sys__bzip2-sys-0.1.11-1.0.8//:build_script_build",
+            "@basic_sys__libc-0.2.126//:libc",
+        ],
+    }),
+)
+
+cargo_build_script(
+    # See comment associated with alias. Do not change this name
+    name = "bzip2-sys_build_script",
+    srcs = glob(
+        include = [
+            "**/*.rs",
+        ],
+        exclude = [
+        ],
+    ),
+    aliases = selects.with_or({
+        "//conditions:default": {
+        },
+    }),
+    build_script_env = {
+    },
+    compile_data = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    crate_features = [
+    ],
+    crate_name = "build_script_build",
+    crate_root = "build.rs",
+    data = glob(["**"]) + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    edition = "2015",
+    links = "bzip2",
+    proc_macro_deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_env = {
+    },
+    rustc_env_files = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_flags = [
+        # In most cases, warnings in 3rd party crates are not interesting as
+        # they're out of the control of consumers. The flag here silences
+        # warnings. For more details see:
+        # https://doc.rust-lang.org/rustc/lints/levels.html
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-bazel",
+        "manual",
+        "noclippy",
+        "norustfmt",
+    ],
+    tools = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    version = "0.1.11+1.0.8",
+    visibility = ["//visibility:private"],
+    deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+            "@basic_sys__cc-1.0.73//:cc",
+            "@basic_sys__pkg-config-0.3.25//:pkg_config",
+        ],
+    }),
+)
+
+alias(
+    # Because `cargo_build_script` does some invisible target name mutating to
+    # determine the package and crate name for a build script, the Bazel
+    # target namename of any build script cannot be the Cargo canonical name
+    # of `build_script_build` without losing out on having certain Cargo
+    # environment variables set.
+    name = "build_script_build",
+    actual = "bzip2-sys_build_script",
+    tags = [
+        "manual",
+    ],
+)
diff --git a/examples/sys/basic/3rdparty/crates/BUILD.cc-1.0.73.bazel b/examples/sys/basic/3rdparty/crates/BUILD.cc-1.0.73.bazel
new file mode 100644
index 0000000..94dad1f
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/BUILD.cc-1.0.73.bazel
@@ -0,0 +1,157 @@
+###############################################################################
+# @generated
+# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
+# regenerate this file, run the following:
+#
+#     bazel run //sys/basic/3rdparty:crates_vendor
+###############################################################################
+
+load(
+    "@bazel_skylib//lib:selects.bzl",
+    "selects",
+)
+
+# buildifier: disable=bzl-visibility
+load("@rules_rust//crate_universe/private:selects.bzl", "select_with_or")
+load(
+    "@rules_rust//rust:defs.bzl",
+    "rust_binary",
+    "rust_library",
+)
+
+package(default_visibility = ["//visibility:public"])
+
+# licenses([
+#     "TODO",  # MIT/Apache-2.0
+# ])
+
+rust_library(
+    name = "cc",
+    srcs = glob(
+        include = [
+            "**/*.rs",
+        ],
+        exclude = [
+        ],
+    ),
+    aliases = selects.with_or({
+        "//conditions:default": {
+        },
+    }),
+    compile_data = glob(
+        include = ["**"],
+        exclude = [
+            "BUILD",
+            "BUILD.bazel",
+            "WORKSPACE",
+            "WORKSPACE.bazel",
+        ],
+    ) + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    crate_features = [
+    ],
+    crate_root = "src/lib.rs",
+    data = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    edition = "2018",
+    proc_macro_deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_env = {
+    },
+    rustc_env_files = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_flags = [
+        # In most cases, warnings in 3rd party crates are not interesting as
+        # they're out of the control of consumers. The flag here silences
+        # warnings. For more details see:
+        # https://doc.rust-lang.org/rustc/lints/levels.html
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-bazel",
+        "manual",
+        "noclippy",
+        "norustfmt",
+    ],
+    version = "1.0.73",
+    deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+)
+
+rust_binary(
+    name = "gcc-shim__bin",
+    srcs = glob(
+        include = [
+            "**/*.rs",
+        ],
+        exclude = [
+        ],
+    ),
+    aliases = selects.with_or({
+        "//conditions:default": {
+        },
+    }),
+    compile_data = glob(
+        include = ["**"],
+        exclude = [
+            "BUILD",
+            "BUILD.bazel",
+            "WORKSPACE",
+            "WORKSPACE.bazel",
+        ],
+    ) + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    crate_features = [
+    ],
+    crate_root = "src/bin/gcc-shim.rs",
+    data = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    edition = "2018",
+    proc_macro_deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_env = {
+    },
+    rustc_env_files = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_flags = [
+        # In most cases, warnings in 3rd party crates are not interesting as
+        # they're out of the control of consumers. The flag here silences
+        # warnings. For more details see:
+        # https://doc.rust-lang.org/rustc/lints/levels.html
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-bazel",
+        "manual",
+        "noclippy",
+        "norustfmt",
+    ],
+    version = "1.0.73",
+    deps = [
+        ":cc",
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+)
diff --git a/examples/sys/basic/3rdparty/crates/BUILD.libc-0.2.126.bazel b/examples/sys/basic/3rdparty/crates/BUILD.libc-0.2.126.bazel
new file mode 100644
index 0000000..84344d1
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/BUILD.libc-0.2.126.bazel
@@ -0,0 +1,92 @@
+###############################################################################
+# @generated
+# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
+# regenerate this file, run the following:
+#
+#     bazel run //sys/basic/3rdparty:crates_vendor
+###############################################################################
+
+load(
+    "@bazel_skylib//lib:selects.bzl",
+    "selects",
+)
+
+# buildifier: disable=bzl-visibility
+load("@rules_rust//crate_universe/private:selects.bzl", "select_with_or")
+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(
+        include = [
+            "**/*.rs",
+        ],
+        exclude = [
+        ],
+    ),
+    aliases = selects.with_or({
+        "//conditions:default": {
+        },
+    }),
+    compile_data = glob(
+        include = ["**"],
+        exclude = [
+            "BUILD",
+            "BUILD.bazel",
+            "WORKSPACE",
+            "WORKSPACE.bazel",
+        ],
+    ) + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    crate_features = [
+        "default",
+        "std",
+    ],
+    crate_root = "src/lib.rs",
+    data = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    edition = "2015",
+    proc_macro_deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_env = {
+    },
+    rustc_env_files = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_flags = [
+        # In most cases, warnings in 3rd party crates are not interesting as
+        # they're out of the control of consumers. The flag here silences
+        # warnings. For more details see:
+        # https://doc.rust-lang.org/rustc/lints/levels.html
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-bazel",
+        "manual",
+        "noclippy",
+        "norustfmt",
+    ],
+    version = "0.2.126",
+    deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+)
diff --git a/examples/sys/basic/3rdparty/crates/BUILD.pkg-config-0.3.25.bazel b/examples/sys/basic/3rdparty/crates/BUILD.pkg-config-0.3.25.bazel
new file mode 100644
index 0000000..cb28873
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/BUILD.pkg-config-0.3.25.bazel
@@ -0,0 +1,90 @@
+###############################################################################
+# @generated
+# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
+# regenerate this file, run the following:
+#
+#     bazel run //sys/basic/3rdparty:crates_vendor
+###############################################################################
+
+load(
+    "@bazel_skylib//lib:selects.bzl",
+    "selects",
+)
+
+# buildifier: disable=bzl-visibility
+load("@rules_rust//crate_universe/private:selects.bzl", "select_with_or")
+load(
+    "@rules_rust//rust:defs.bzl",
+    "rust_library",
+)
+
+package(default_visibility = ["//visibility:public"])
+
+# licenses([
+#     "TODO",  # MIT OR Apache-2.0
+# ])
+
+rust_library(
+    name = "pkg_config",
+    srcs = glob(
+        include = [
+            "**/*.rs",
+        ],
+        exclude = [
+        ],
+    ),
+    aliases = selects.with_or({
+        "//conditions:default": {
+        },
+    }),
+    compile_data = glob(
+        include = ["**"],
+        exclude = [
+            "BUILD",
+            "BUILD.bazel",
+            "WORKSPACE",
+            "WORKSPACE.bazel",
+        ],
+    ) + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    crate_features = [
+    ],
+    crate_root = "src/lib.rs",
+    data = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    edition = "2015",
+    proc_macro_deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_env = {
+    },
+    rustc_env_files = select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+    rustc_flags = [
+        # In most cases, warnings in 3rd party crates are not interesting as
+        # they're out of the control of consumers. The flag here silences
+        # warnings. For more details see:
+        # https://doc.rust-lang.org/rustc/lints/levels.html
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-bazel",
+        "manual",
+        "noclippy",
+        "norustfmt",
+    ],
+    version = "0.3.25",
+    deps = [
+    ] + select_with_or({
+        "//conditions:default": [
+        ],
+    }),
+)
diff --git a/examples/sys/basic/3rdparty/crates/crates.bzl b/examples/sys/basic/3rdparty/crates/crates.bzl
new file mode 100644
index 0000000..ba569c7
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/crates.bzl
@@ -0,0 +1,25 @@
+###############################################################################
+# @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("@examples//sys/basic/3rdparty/crates:defs.bzl", _crate_repositories = "crate_repositories")
+
+# buildifier: disable=bzl-visibility
+load("@rules_rust//crate_universe/private:crates_vendor.bzl", "crates_vendor_remote_repository")
+
+def crate_repositories():
+    maybe(
+        crates_vendor_remote_repository,
+        name = "basic_sys",
+        build_file = Label("@examples//sys/basic/3rdparty/crates:BUILD.bazel"),
+        defs_module = Label("@examples//sys/basic/3rdparty/crates:defs.bzl"),
+    )
+
+    _crate_repositories()
diff --git a/examples/sys/basic/3rdparty/crates/defs.bzl b/examples/sys/basic/3rdparty/crates/defs.bzl
new file mode 100644
index 0000000..3f110a1
--- /dev/null
+++ b/examples/sys/basic/3rdparty/crates/defs.bzl
@@ -0,0 +1,411 @@
+###############################################################################
+# @generated
+# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
+# regenerate this file, run the following:
+#
+#     bazel run //sys/basic/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 dependnecies 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, normla 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({_CONDITIONS[condition]: deps.values()})
+
+    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, normla 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": common_items}
+    for condition, deps in aliases.items():
+        condition_triples = _CONDITIONS[condition]
+        if condition_triples in crate_aliases:
+            crate_aliases[condition_triples].update(deps)
+        else:
+            crate_aliases.update({_CONDITIONS[condition]: dict(deps.items() + common_items)})
+
+    return selects.with_or(crate_aliases)
+
+###############################################################################
+# WORKSPACE MEMBER DEPS AND ALIASES
+###############################################################################
+
+_NORMAL_DEPENDENCIES = {
+    "": {
+        _COMMON_CONDITION: {
+            "bzip2": "@basic_sys__bzip2-0.3.3//:bzip2",
+        },
+    },
+}
+
+_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 = {
+}
+
+###############################################################################
+
+def crate_repositories():
+    """A macro for defining repositories for all generated crates"""
+    maybe(
+        http_archive,
+        name = "basic_sys__bzip2-0.3.3",
+        sha256 = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b",
+        type = "tar.gz",
+        urls = ["https://crates.io/api/v1/crates/bzip2/0.3.3/download"],
+        strip_prefix = "bzip2-0.3.3",
+        build_file = Label("@examples//sys/basic/3rdparty/crates:BUILD.bzip2-0.3.3.bazel"),
+    )
+
+    maybe(
+        http_archive,
+        name = "basic_sys__bzip2-sys-0.1.11-1.0.8",
+        sha256 = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc",
+        type = "tar.gz",
+        urls = ["https://crates.io/api/v1/crates/bzip2-sys/0.1.11+1.0.8/download"],
+        strip_prefix = "bzip2-sys-0.1.11+1.0.8",
+        build_file = Label("@examples//sys/basic/3rdparty/crates:BUILD.bzip2-sys-0.1.11+1.0.8.bazel"),
+    )
+
+    maybe(
+        http_archive,
+        name = "basic_sys__cc-1.0.73",
+        sha256 = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11",
+        type = "tar.gz",
+        urls = ["https://crates.io/api/v1/crates/cc/1.0.73/download"],
+        strip_prefix = "cc-1.0.73",
+        build_file = Label("@examples//sys/basic/3rdparty/crates:BUILD.cc-1.0.73.bazel"),
+    )
+
+    maybe(
+        http_archive,
+        name = "basic_sys__libc-0.2.126",
+        sha256 = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836",
+        type = "tar.gz",
+        urls = ["https://crates.io/api/v1/crates/libc/0.2.126/download"],
+        strip_prefix = "libc-0.2.126",
+        build_file = Label("@examples//sys/basic/3rdparty/crates:BUILD.libc-0.2.126.bazel"),
+    )
+
+    maybe(
+        http_archive,
+        name = "basic_sys__pkg-config-0.3.25",
+        sha256 = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae",
+        type = "tar.gz",
+        urls = ["https://crates.io/api/v1/crates/pkg-config/0.3.25/download"],
+        strip_prefix = "pkg-config-0.3.25",
+        build_file = Label("@examples//sys/basic/3rdparty/crates:BUILD.pkg-config-0.3.25.bazel"),
+    )
diff --git a/examples/sys/basic/BUILD.bazel b/examples/sys/basic/BUILD.bazel
index 142aa89..8971c66 100644
--- a/examples/sys/basic/BUILD.bazel
+++ b/examples/sys/basic/BUILD.bazel
@@ -22,7 +22,7 @@
     edition = "2018",
     # Note the `cargo-raze` dependencies here need to have been loaded
     # in the WORKSPACE file. See `//sys:sys_deps.bzl` for rmore details.
-    deps = ["//sys/basic/raze:bzip2"],
+    deps = ["//sys/basic/3rdparty/crates:bzip2"],
 )
 
 sh_test(
diff --git a/examples/sys/basic/Cargo.toml b/examples/sys/basic/Cargo.toml
deleted file mode 100644
index 61b97fc..0000000
--- a/examples/sys/basic/Cargo.toml
+++ /dev/null
@@ -1,21 +0,0 @@
-[package]
-name = "rules_rust_examples_basic_sys"
-version = "0.0.1"
-
-[[bin]]
-name = "rules_rust_examples_basic_sys"
-path = "src/main.rs"
-
-[dependencies]
-bzip2 = "=0.3.3"
-
-[package.metadata.raze]
-workspace_path = "//sys/basic/raze"
-genmode = "Remote"
-gen_workspace_prefix = "basic_sys"
-rust_rules_workspace_name = "rules_rust"
-package_aliases_dir = "raze"
-default_gen_buildrs = false
-
-[package.metadata.raze.crates.bzip2-sys.'0.1.9+1.0.8']
-gen_buildrs = true
diff --git a/examples/sys/basic/raze/BUILD.bazel b/examples/sys/basic/raze/BUILD.bazel
deleted file mode 100644
index ade3349..0000000
--- a/examples/sys/basic/raze/BUILD.bazel
+++ /dev/null
@@ -1,30 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-package(default_visibility = ["//visibility:public"])
-
-licenses([
-    "notice",  # See individual crates for specific licenses
-])
-
-# Aliased targets
-alias(
-    name = "bzip2",
-    actual = "@basic_sys__bzip2__0_3_3//:bzip2",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-# Export file for Stardoc support
-exports_files(
-    [
-        "crates.bzl",
-    ],
-    visibility = ["//visibility:public"],
-)
diff --git a/examples/sys/basic/raze/crates.bzl b/examples/sys/basic/raze/crates.bzl
deleted file mode 100644
index beacc3e..0000000
--- a/examples/sys/basic/raze/crates.bzl
+++ /dev/null
@@ -1,62 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")  # buildifier: disable=load
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")  # buildifier: disable=load
-load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")  # buildifier: disable=load
-
-def basic_sys_fetch_remote_crates():
-    """This function defines a collection of repos and should be called in a WORKSPACE file"""
-    maybe(
-        http_archive,
-        name = "basic_sys__bzip2__0_3_3",
-        url = "https://crates.io/api/v1/crates/bzip2/0.3.3/download",
-        type = "tar.gz",
-        sha256 = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b",
-        strip_prefix = "bzip2-0.3.3",
-        build_file = Label("//sys/basic/raze/remote:BUILD.bzip2-0.3.3.bazel"),
-    )
-
-    maybe(
-        http_archive,
-        name = "basic_sys__bzip2_sys__0_1_9_1_0_8",
-        url = "https://crates.io/api/v1/crates/bzip2-sys/0.1.9+1.0.8/download",
-        type = "tar.gz",
-        sha256 = "ad3b39a260062fca31f7b0b12f207e8f2590a67d32ec7d59c20484b07ea7285e",
-        strip_prefix = "bzip2-sys-0.1.9+1.0.8",
-        build_file = Label("//sys/basic/raze/remote:BUILD.bzip2-sys-0.1.9+1.0.8.bazel"),
-    )
-
-    maybe(
-        http_archive,
-        name = "basic_sys__cc__1_0_60",
-        url = "https://crates.io/api/v1/crates/cc/1.0.60/download",
-        type = "tar.gz",
-        sha256 = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c",
-        strip_prefix = "cc-1.0.60",
-        build_file = Label("//sys/basic/raze/remote:BUILD.cc-1.0.60.bazel"),
-    )
-
-    maybe(
-        http_archive,
-        name = "basic_sys__libc__0_2_77",
-        url = "https://crates.io/api/v1/crates/libc/0.2.77/download",
-        type = "tar.gz",
-        sha256 = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235",
-        strip_prefix = "libc-0.2.77",
-        build_file = Label("//sys/basic/raze/remote:BUILD.libc-0.2.77.bazel"),
-    )
-
-    maybe(
-        http_archive,
-        name = "basic_sys__pkg_config__0_3_18",
-        url = "https://crates.io/api/v1/crates/pkg-config/0.3.18/download",
-        type = "tar.gz",
-        sha256 = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33",
-        strip_prefix = "pkg-config-0.3.18",
-        build_file = Label("//sys/basic/raze/remote:BUILD.pkg-config-0.3.18.bazel"),
-    )
diff --git a/examples/sys/basic/raze/remote/BUILD.bazel b/examples/sys/basic/raze/remote/BUILD.bazel
deleted file mode 100644
index e69de29..0000000
--- a/examples/sys/basic/raze/remote/BUILD.bazel
+++ /dev/null
diff --git a/examples/sys/basic/raze/remote/BUILD.bzip2-0.3.3.bazel b/examples/sys/basic/raze/remote/BUILD.bzip2-0.3.3.bazel
deleted file mode 100644
index 403de65..0000000
--- a/examples/sys/basic/raze/remote/BUILD.bzip2-0.3.3.bazel
+++ /dev/null
@@ -1,57 +0,0 @@
-"""
-@generated
-cargo-raze crate build file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-# buildifier: disable=load
-load("@bazel_skylib//lib:selects.bzl", "selects")
-
-# buildifier: disable=load
-load(
-    "@rules_rust//rust:defs.bzl",
-    "rust_binary",
-    "rust_library",
-    "rust_proc_macro",
-    "rust_test",
-)
-
-package(default_visibility = [
-    # Public for visibility by "@raze__crate__version//" targets.
-    #
-    # Prefer access through "//sys/basic/raze", which limits external
-    # visibility to explicit Cargo.toml dependencies.
-    "//visibility:public",
-])
-
-licenses([
-    "notice",  # MIT from expression "MIT OR Apache-2.0"
-])
-
-# Generated Targets
-
-rust_library(
-    name = "bzip2",
-    srcs = glob(["**/*.rs"]),
-    crate_features = [
-    ],
-    crate_root = "src/lib.rs",
-    data = [],
-    edition = "2015",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "0.3.3",
-    # buildifier: leave-alone
-    deps = [
-        "@basic_sys__bzip2_sys__0_1_9_1_0_8//:bzip2_sys",
-        "@basic_sys__libc__0_2_77//:libc",
-    ],
-)
-
-# Unsupported target "tokio" with type "test" omitted
diff --git a/examples/sys/basic/raze/remote/BUILD.bzip2-sys-0.1.9+1.0.8.bazel b/examples/sys/basic/raze/remote/BUILD.bzip2-sys-0.1.9+1.0.8.bazel
deleted file mode 100644
index 2401d2c..0000000
--- a/examples/sys/basic/raze/remote/BUILD.bzip2-sys-0.1.9+1.0.8.bazel
+++ /dev/null
@@ -1,87 +0,0 @@
-"""
-@generated
-cargo-raze crate build file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-# buildifier: disable=load
-load("@bazel_skylib//lib:selects.bzl", "selects")
-
-# buildifier: disable=load
-load(
-    "@rules_rust//rust:defs.bzl",
-    "rust_binary",
-    "rust_library",
-    "rust_proc_macro",
-    "rust_test",
-)
-
-package(default_visibility = [
-    # Public for visibility by "@raze__crate__version//" targets.
-    #
-    # Prefer access through "//sys/basic/raze", which limits external
-    # visibility to explicit Cargo.toml dependencies.
-    "//visibility:public",
-])
-
-licenses([
-    "notice",  # MIT from expression "MIT OR Apache-2.0"
-])
-
-# Generated Targets
-# buildifier: disable=out-of-order-load
-# buildifier: disable=load-on-top
-load(
-    "@rules_rust//cargo:cargo_build_script.bzl",
-    "cargo_build_script",
-)
-
-cargo_build_script(
-    name = "bzip2_sys_build_script",
-    srcs = glob(["**/*.rs"]),
-    build_script_env = {
-    },
-    crate_features = [
-    ],
-    crate_root = "build.rs",
-    data = glob(["**"]),
-    edition = "2015",
-    links = "bzip2",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "0.1.9+1.0.8",
-    visibility = ["//visibility:private"],
-    deps = [
-        "@basic_sys__cc__1_0_60//:cc",
-        "@basic_sys__pkg_config__0_3_18//:pkg_config",
-    ],
-)
-
-rust_library(
-    name = "bzip2_sys",
-    srcs = glob(["**/*.rs"]),
-    crate_features = [
-    ],
-    crate_root = "lib.rs",
-    data = [],
-    edition = "2015",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "0.1.9+1.0.8",
-    # buildifier: leave-alone
-    deps = [
-        ":bzip2_sys_build_script",
-        "@basic_sys__libc__0_2_77//:libc",
-    ],
-)
diff --git a/examples/sys/basic/raze/remote/BUILD.cc-1.0.60.bazel b/examples/sys/basic/raze/remote/BUILD.cc-1.0.60.bazel
deleted file mode 100644
index ad826c1..0000000
--- a/examples/sys/basic/raze/remote/BUILD.cc-1.0.60.bazel
+++ /dev/null
@@ -1,85 +0,0 @@
-"""
-@generated
-cargo-raze crate build file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-# buildifier: disable=load
-load("@bazel_skylib//lib:selects.bzl", "selects")
-
-# buildifier: disable=load
-load(
-    "@rules_rust//rust:defs.bzl",
-    "rust_binary",
-    "rust_library",
-    "rust_proc_macro",
-    "rust_test",
-)
-
-package(default_visibility = [
-    # Public for visibility by "@raze__crate__version//" targets.
-    #
-    # Prefer access through "//sys/basic/raze", which limits external
-    # visibility to explicit Cargo.toml dependencies.
-    "//visibility:public",
-])
-
-licenses([
-    "notice",  # MIT from expression "MIT OR Apache-2.0"
-])
-
-# Generated Targets
-
-rust_binary(
-    # Prefix bin name to disambiguate from (probable) collision with lib name
-    # N.B.: The exact form of this is subject to change.
-    name = "cargo_bin_gcc_shim",
-    srcs = glob(["**/*.rs"]),
-    crate_features = [
-    ],
-    crate_root = "src/bin/gcc-shim.rs",
-    data = [],
-    edition = "2018",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "1.0.60",
-    # buildifier: leave-alone
-    deps = [
-        ":cc",
-    ],
-)
-
-rust_library(
-    name = "cc",
-    srcs = glob(["**/*.rs"]),
-    crate_features = [
-    ],
-    crate_root = "src/lib.rs",
-    data = [],
-    edition = "2018",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "1.0.60",
-    # buildifier: leave-alone
-    deps = [
-    ],
-)
-
-# Unsupported target "cc_env" with type "test" omitted
-
-# Unsupported target "cflags" with type "test" omitted
-
-# Unsupported target "cxxflags" with type "test" omitted
-
-# Unsupported target "test" with type "test" omitted
diff --git a/examples/sys/basic/raze/remote/BUILD.libc-0.2.77.bazel b/examples/sys/basic/raze/remote/BUILD.libc-0.2.77.bazel
deleted file mode 100644
index 4b8aed7..0000000
--- a/examples/sys/basic/raze/remote/BUILD.libc-0.2.77.bazel
+++ /dev/null
@@ -1,59 +0,0 @@
-"""
-@generated
-cargo-raze crate build file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-# buildifier: disable=load
-load("@bazel_skylib//lib:selects.bzl", "selects")
-
-# buildifier: disable=load
-load(
-    "@rules_rust//rust:defs.bzl",
-    "rust_binary",
-    "rust_library",
-    "rust_proc_macro",
-    "rust_test",
-)
-
-package(default_visibility = [
-    # Public for visibility by "@raze__crate__version//" targets.
-    #
-    # Prefer access through "//sys/basic/raze", which limits external
-    # visibility to explicit Cargo.toml dependencies.
-    "//visibility:public",
-])
-
-licenses([
-    "notice",  # MIT from expression "MIT OR Apache-2.0"
-])
-
-# Generated Targets
-
-# Unsupported target "build-script-build" with type "custom-build" omitted
-
-rust_library(
-    name = "libc",
-    srcs = glob(["**/*.rs"]),
-    crate_features = [
-        "default",
-        "std",
-    ],
-    crate_root = "src/lib.rs",
-    data = [],
-    edition = "2015",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "0.2.77",
-    # buildifier: leave-alone
-    deps = [
-    ],
-)
-
-# Unsupported target "const_fn" with type "test" omitted
diff --git a/examples/sys/basic/raze/remote/BUILD.pkg-config-0.3.18.bazel b/examples/sys/basic/raze/remote/BUILD.pkg-config-0.3.18.bazel
deleted file mode 100644
index 0121432..0000000
--- a/examples/sys/basic/raze/remote/BUILD.pkg-config-0.3.18.bazel
+++ /dev/null
@@ -1,55 +0,0 @@
-"""
-@generated
-cargo-raze crate build file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-# buildifier: disable=load
-load("@bazel_skylib//lib:selects.bzl", "selects")
-
-# buildifier: disable=load
-load(
-    "@rules_rust//rust:defs.bzl",
-    "rust_binary",
-    "rust_library",
-    "rust_proc_macro",
-    "rust_test",
-)
-
-package(default_visibility = [
-    # Public for visibility by "@raze__crate__version//" targets.
-    #
-    # Prefer access through "//sys/basic/raze", which limits external
-    # visibility to explicit Cargo.toml dependencies.
-    "//visibility:public",
-])
-
-licenses([
-    "notice",  # MIT from expression "MIT OR Apache-2.0"
-])
-
-# Generated Targets
-
-rust_library(
-    name = "pkg_config",
-    srcs = glob(["**/*.rs"]),
-    crate_features = [
-    ],
-    crate_root = "src/lib.rs",
-    data = [],
-    edition = "2015",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "0.3.18",
-    # buildifier: leave-alone
-    deps = [
-    ],
-)
-
-# Unsupported target "test" with type "test" omitted