diff --git a/examples/crate_universe/vendor_local_patching/.gitignore b/examples/crate_universe/vendor_local_patching/.gitignore new file mode 100644 index 0000000000..190f3d14e2 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/.gitignore @@ -0,0 +1,3 @@ +# Ignore everything but the `BUILD` files within the vendored directories +vendor/*/* +!vendor/*/BUILD.bazel diff --git a/examples/crate_universe/vendor_local_patching/BUILD.bazel b/examples/crate_universe/vendor_local_patching/BUILD.bazel new file mode 100644 index 0000000000..e17b7860ce --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/BUILD.bazel @@ -0,0 +1,26 @@ +load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_vendor") +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test") + +crates_vendor( + name = "vendor", + cargo_lockfile = ":Cargo.lock", + manifests = [":Cargo.toml"], + mode = "local", + # We don't support wasi + supported_platform_triples = [ + "x86_64-unknown-linux-gnu", + "aarch64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "x86_64-fuchsia", + "aarch64-fuchsia", + ], + vendor_path = "vendor", +) + +rust_binary( + name = "bin", + srcs = ["src/main.rs"], + deps = ["//vendor_local_patching/vendor:rand"], + edition = "2021", +) diff --git a/examples/crate_universe/vendor_local_patching/Cargo.lock b/examples/crate_universe/vendor_local_patching/Cargo.lock new file mode 100644 index 0000000000..b446c336b5 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/Cargo.lock @@ -0,0 +1,73 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[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 = "libc" +version = "0.2.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" + +[[package]] +name = "my_third_party" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "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 = "wasi" +version = "0.11.0+wasi-snapshot-preview1" diff --git a/examples/crate_universe/vendor_local_patching/Cargo.toml b/examples/crate_universe/vendor_local_patching/Cargo.toml new file mode 100644 index 0000000000..05802449da --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "my_third_party" +version = "0.1.0" + +[dependencies] +rand = "0.8.5" + +[patch.crates-io] +wasi = { path = "empty_wasi" } diff --git a/examples/crate_universe/vendor_local_patching/empty_wasi/BUILD.bazel b/examples/crate_universe/vendor_local_patching/empty_wasi/BUILD.bazel new file mode 100644 index 0000000000..6fa96718db --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/empty_wasi/BUILD.bazel @@ -0,0 +1,7 @@ +filegroup( + name = "wasi", + srcs = glob(["**/*.rs"]), + visibility = ["//visibility:public"], +) + +exports_files(["src/lib.rs"]) diff --git a/examples/crate_universe/vendor_local_patching/empty_wasi/Cargo.toml b/examples/crate_universe/vendor_local_patching/empty_wasi/Cargo.toml new file mode 100644 index 0000000000..f77ae02a6c --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/empty_wasi/Cargo.toml @@ -0,0 +1,3 @@ +[package] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" diff --git a/examples/crate_universe/vendor_local_patching/empty_wasi/src/lib.rs b/examples/crate_universe/vendor_local_patching/empty_wasi/src/lib.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/crate_universe/vendor_local_patching/src/main.rs b/examples/crate_universe/vendor_local_patching/src/main.rs new file mode 100644 index 0000000000..a1faf7fafd --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("random number: {}", rand::random::()); +} diff --git a/examples/crate_universe/vendor_local_patching/vendor/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/BUILD.bazel new file mode 100644 index 0000000000..ca475f893b --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/BUILD.bazel @@ -0,0 +1,31 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching:vendor +############################################################################### + +package(default_visibility = ["//visibility:public"]) + +exports_files( + [ + "cargo-bazel.json", + "defs.bzl", + ] + glob(["*.bazel"]), +) + +filegroup( + name = "srcs", + srcs = glob([ + "*.bazel", + "*.bzl", + ]), +) + +# Workspace Member Dependencies +alias( + name = "rand", + actual = "//vendor_local_patching/vendor/rand-0.8.5:rand", + tags = ["manual"], +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/cfg-if-1.0.0/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/cfg-if-1.0.0/BUILD.bazel new file mode 100644 index 0000000000..bdfa2768c4 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/cfg-if-1.0.0/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 @//vendor_local_patching: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 = [ + "**/* *", + "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", + ], + version = "1.0.0", +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/defs.bzl b/examples/crate_universe/vendor_local_patching/vendor/defs.bzl new file mode 100644 index 0000000000..ffb074b506 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/defs.bzl @@ -0,0 +1,357 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching: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") + +############################################################################### +# 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, 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({_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, 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": 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 = { + "vendor_local_patching": { + _COMMON_CONDITION: { + "rand": "//vendor_local_patching/vendor/rand-0.8.5:rand", + }, + }, +} + +_NORMAL_ALIASES = { + "vendor_local_patching": { + _COMMON_CONDITION: { + }, + }, +} + +_NORMAL_DEV_DEPENDENCIES = { + "vendor_local_patching": { + }, +} + +_NORMAL_DEV_ALIASES = { + "vendor_local_patching": { + }, +} + +_PROC_MACRO_DEPENDENCIES = { + "vendor_local_patching": { + }, +} + +_PROC_MACRO_ALIASES = { + "vendor_local_patching": { + }, +} + +_PROC_MACRO_DEV_DEPENDENCIES = { + "vendor_local_patching": { + }, +} + +_PROC_MACRO_DEV_ALIASES = { + "vendor_local_patching": { + }, +} + +_BUILD_DEPENDENCIES = { + "vendor_local_patching": { + }, +} + +_BUILD_ALIASES = { + "vendor_local_patching": { + }, +} + +_BUILD_PROC_MACRO_DEPENDENCIES = { + "vendor_local_patching": { + }, +} + +_BUILD_PROC_MACRO_ALIASES = { + "vendor_local_patching": { + }, +} + +_CONDITIONS = { + "cfg(target_os = \"wasi\")": [], + "cfg(unix)": ["aarch64-fuchsia", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-fuchsia", "x86_64-unknown-linux-gnu"], +} diff --git a/examples/crate_universe/vendor_local_patching/vendor/getrandom-0.2.8/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/getrandom-0.2.8/BUILD.bazel new file mode 100644 index 0000000000..9474eba99a --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/getrandom-0.2.8/BUILD.bazel @@ -0,0 +1,64 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching: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 = [ + "**/* *", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = ["--cap-lints=allow"], + tags = [ + "cargo-bazel", + "crate-name=getrandom", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.2.8", + deps = [ + "//vendor_local_patching/vendor/cfg-if-1.0.0:cfg_if", + ] + select({ + "@rules_rust//rust/platform:aarch64-fuchsia": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-apple-darwin": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-fuchsia": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "//conditions:default": [], + }), +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/libc-0.2.140/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/libc-0.2.140/BUILD.bazel new file mode 100644 index 0000000000..3354d15071 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/libc-0.2.140/BUILD.bazel @@ -0,0 +1,81 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching: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 = [ + "**/* *", + "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", + ], + version = "0.2.140", + deps = [ + "//vendor_local_patching/vendor/libc-0.2.140: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 = [ + "**/* *", + "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.140", + visibility = ["//visibility:private"], +) + +alias( + name = "build_script_build", + actual = "libc_build_script", + tags = ["manual"], +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/ppv-lite86-0.2.17/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/ppv-lite86-0.2.17/BUILD.bazel new file mode 100644 index 0000000000..d753ed33a2 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/ppv-lite86-0.2.17/BUILD.bazel @@ -0,0 +1,45 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching:vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +# licenses([ +# "TODO", # MIT/Apache-2.0 +# ]) + +rust_library( + name = "ppv_lite86", + srcs = glob(["**/*.rs"]), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "simd", + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = ["--cap-lints=allow"], + tags = [ + "cargo-bazel", + "crate-name=ppv-lite86", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.2.17", +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/rand-0.8.5/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/rand-0.8.5/BUILD.bazel new file mode 100644 index 0000000000..b8c018758d --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/rand-0.8.5/BUILD.bazel @@ -0,0 +1,71 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching: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 = [ + "**/* *", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + "default", + "getrandom", + "libc", + "rand_chacha", + "std", + "std_rng", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = ["--cap-lints=allow"], + tags = [ + "cargo-bazel", + "crate-name=rand", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.8.5", + deps = [ + "//vendor_local_patching/vendor/rand_chacha-0.3.1:rand_chacha", + "//vendor_local_patching/vendor/rand_core-0.6.4:rand_core", + ] + select({ + "@rules_rust//rust/platform:aarch64-fuchsia": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-apple-darwin": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-fuchsia": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [ + "//vendor_local_patching/vendor/libc-0.2.140:libc", # cfg(unix) + ], + "//conditions:default": [], + }), +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/rand_chacha-0.3.1/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/rand_chacha-0.3.1/BUILD.bazel new file mode 100644 index 0000000000..ec1e108ba3 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/rand_chacha-0.3.1/BUILD.bazel @@ -0,0 +1,48 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching: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_chacha", + srcs = glob(["**/*.rs"]), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = ["--cap-lints=allow"], + tags = [ + "cargo-bazel", + "crate-name=rand_chacha", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.3.1", + deps = [ + "//vendor_local_patching/vendor/ppv-lite86-0.2.17:ppv_lite86", + "//vendor_local_patching/vendor/rand_core-0.6.4:rand_core", + ], +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/rand_core-0.6.4/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/rand_core-0.6.4/BUILD.bazel new file mode 100644 index 0000000000..766828ad72 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/rand_core-0.6.4/BUILD.bazel @@ -0,0 +1,49 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching: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 = [ + "**/* *", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + "getrandom", + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = ["--cap-lints=allow"], + tags = [ + "cargo-bazel", + "crate-name=rand_core", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.6.4", + deps = [ + "//vendor_local_patching/vendor/getrandom-0.2.8:getrandom", + ], +) diff --git a/examples/crate_universe/vendor_local_patching/vendor/wasi-0.11.0+wasi-snapshot-preview1/BUILD.bazel b/examples/crate_universe/vendor_local_patching/vendor/wasi-0.11.0+wasi-snapshot-preview1/BUILD.bazel new file mode 100644 index 0000000000..f65f1a70d1 --- /dev/null +++ b/examples/crate_universe/vendor_local_patching/vendor/wasi-0.11.0+wasi-snapshot-preview1/BUILD.bazel @@ -0,0 +1,28 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//vendor_local_patching:vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "wasi", + srcs = ["//vendor_local_patching/empty_wasi:srcs"], + compile_data = ["//vendor_local_patching/empty_wasi:compile_data"], + crate_root = "//vendor_local_patching/empty_wasi:crate_root", + edition = "2015", + rustc_flags = ["--cap-lints=allow"], + tags = [ + "cargo-bazel", + "crate-name=wasi", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.11.0+wasi-snapshot-preview1", +)