diff --git a/WORKSPACE b/WORKSPACE index 5294cc26..fad0a2f4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -10,18 +10,16 @@ http_archive( load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") -RUST_VERSION = "1.66.0" - rules_rust_dependencies() rust_register_toolchains( - version = RUST_VERSION, + version = "1.66.0", ) -load("//tools/bazel:vendor.bzl", "vendor") +load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") -vendor( - name = "third-party", - cargo_version = RUST_VERSION, - lockfile = "//third-party:Cargo.lock", -) +crate_universe_dependencies() + +load("//third-party/bazel:crates.bzl", "crate_repositories") + +crate_repositories() diff --git a/third-party/BUILD b/third-party/BUILD index 1b599321..7fc2b0f2 100644 --- a/third-party/BUILD +++ b/third-party/BUILD @@ -1,202 +1,29 @@ -load( - "//tools/bazel:third_party.bzl", - cargo_build_script = "third_party_cargo_build_script", - glob = "third_party_glob", - rust_library = "third_party_rust_library", +load("@rules_rust//crate_universe:defs.bzl", "crates_vendor") + +crates_vendor( + name = "vendor", + cargo_lockfile = "//third-party:Cargo.lock", + generate_build_scripts = True, + manifests = ["//third-party:Cargo.toml"], + mode = "remote", + tags = ["manual"], + vendor_path = "bazel", ) -rust_library( - name = "bitflags", - srcs = glob(["vendor/bitflags-1.3.2/src/**/*.rs"]), - edition = "2018", -) - -rust_library( - name = "cc", - srcs = glob(["vendor/cc-1.0.77/src/**/*.rs"]), - edition = "2018", - visibility = ["//visibility:public"], -) - -rust_library( - name = "clap", - srcs = glob(["vendor/clap-4.0.29/src/**/*.rs"]) + ["vendor/clap-4.0.29/examples/demo.rs"], - crate_features = [ - "error-context", - "help", - "std", - "usage", - ], - data = ["vendor/clap-4.0.29/examples/demo.md"], - edition = "2021", - visibility = ["//visibility:public"], - deps = [ - ":bitflags", - ":clap_lex", - ], -) - -rust_library( - name = "clap_lex", - srcs = glob(["vendor/clap_lex-0.3.0/src/**/*.rs"]), - edition = "2021", - deps = [ - ":os_str_bytes", - ], -) - -rust_library( - name = "codespan-reporting", - srcs = glob(["vendor/codespan-reporting-0.11.1/src/**/*.rs"]), - edition = "2018", - visibility = ["//visibility:public"], - deps = [ - ":termcolor", - ":unicode-width", - ], -) - -rust_library( - name = "once_cell", - srcs = glob(["vendor/once_cell-1.16.0/src/**/*.rs"]), - crate_features = [ - "alloc", - "default", - "race", - "std", - ], - edition = "2021", - visibility = ["//visibility:public"], -) - -rust_library( - name = "os_str_bytes", - srcs = glob(["vendor/os_str_bytes-6.4.1/src/**/*.rs"]), - crate_features = [ - "raw_os_str", - ], - edition = "2021", -) - -rust_library( - name = "proc-macro2", - srcs = glob(["vendor/proc-macro2-1.0.47/src/**/*.rs"]), - crate_features = [ - "default", - "proc-macro", - "span-locations", - ], - edition = "2018", - visibility = ["//visibility:public"], - deps = [ - ":proc-macro2@build", - ":unicode-ident", - ], -) - -cargo_build_script( - name = "proc-macro2@build", - srcs = ["vendor/proc-macro2-1.0.47/build.rs"], - crate_features = [ - "default", - "proc-macro", - "span-locations", - ], - crate_name = "build", - edition = "2018", -) - -rust_library( - name = "quote", - srcs = glob(["vendor/quote-1.0.21/src/**/*.rs"]), - crate_features = [ - "default", - "proc-macro", - ], - edition = "2018", - visibility = ["//visibility:public"], - deps = [ - ":proc-macro2", - ":quote@build", - ], -) - -cargo_build_script( - name = "quote@build", - srcs = ["vendor/quote-1.0.21/build.rs"], - crate_features = [ - "default", - "proc-macro", - ], - crate_name = "build", - edition = "2018", -) - -rust_library( - name = "scratch", - srcs = glob(["vendor/scratch-1.0.2/src/**/*.rs"]), - edition = "2015", - rustc_env = {"OUT_DIR": ""}, - visibility = ["//visibility:public"], -) - -rust_library( - name = "syn", - srcs = glob(["vendor/syn-1.0.105/src/**/*.rs"]), - crate_features = [ - "clone-impls", - "default", - "derive", - "full", - "parsing", - "printing", - "proc-macro", +[ + alias( + name = name, + actual = "//third-party/bazel:{}".format(name), + visibility = ["//visibility:public"], + ) + for name in [ + "cc", + "clap", + "codespan-reporting", + "once_cell", + "proc-macro2", "quote", - ], - edition = "2018", - visibility = ["//visibility:public"], - deps = [ - ":proc-macro2", - ":quote", - ":syn@build", - ":unicode-ident", - ], -) - -cargo_build_script( - name = "syn@build", - srcs = ["vendor/syn-1.0.105/build.rs"], - crate_features = [ - "clone-impls", - "default", - "derive", - "full", - "parsing", - "printing", - "proc-macro", - "quote", - ], - crate_name = "build", - edition = "2018", -) - -rust_library( - name = "termcolor", - srcs = glob(["vendor/termcolor-1.1.3/src/**/*.rs"]), - edition = "2018", -) - -rust_library( - name = "unicode-ident", - srcs = glob(["vendor/unicode-ident-1.0.5/src/**/*.rs"]), - edition = "2018", -) - -rust_library( - name = "unicode-width", - srcs = glob(["vendor/unicode-width-0.1.10/src/**/*.rs"]), - crate_features = [ - "default", - ], - edition = "2015", -) + "scratch", + "syn", + ] +] diff --git a/third-party/bazel/BUILD.bazel b/third-party/bazel/BUILD.bazel new file mode 100644 index 00000000..ff7db99c --- /dev/null +++ b/third-party/bazel/BUILD.bazel @@ -0,0 +1,89 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party: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 = "cc", + actual = "@vendor__cc-1.0.77//:cc", + tags = ["manual"], +) + +alias( + name = "clap", + actual = "@vendor__clap-4.0.29//:clap", + tags = ["manual"], +) + +alias( + name = "codespan-reporting", + actual = "@vendor__codespan-reporting-0.11.1//:codespan_reporting", + tags = ["manual"], +) + +alias( + name = "once_cell", + actual = "@vendor__once_cell-1.16.0//:once_cell", + tags = ["manual"], +) + +alias( + name = "proc-macro2", + actual = "@vendor__proc-macro2-1.0.47//:proc_macro2", + tags = ["manual"], +) + +alias( + name = "quote", + actual = "@vendor__quote-1.0.21//:quote", + tags = ["manual"], +) + +alias( + name = "scratch", + actual = "@vendor__scratch-1.0.2//:scratch", + tags = ["manual"], +) + +alias( + name = "syn", + actual = "@vendor__syn-1.0.105//:syn", + tags = ["manual"], +) + +# Binaries +alias( + name = "cc__gcc-shim", + actual = "@vendor__cc-1.0.77//:gcc-shim__bin", + tags = ["manual"], +) + +alias( + name = "clap__stdio-fixture", + actual = "@vendor__clap-4.0.29//:stdio-fixture__bin", + tags = ["manual"], +) diff --git a/third-party/bazel/BUILD.bitflags-1.3.2.bazel b/third-party/bazel/BUILD.bitflags-1.3.2.bazel new file mode 100644 index 00000000..005623a0 --- /dev/null +++ b/third-party/bazel/BUILD.bitflags-1.3.2.bazel @@ -0,0 +1,87 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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 = "bitflags", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.3.2", + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.cc-1.0.77.bazel b/third-party/bazel/BUILD.cc-1.0.77.bazel new file mode 100644 index 00000000..949aefbf --- /dev/null +++ b/third-party/bazel/BUILD.cc-1.0.77.bazel @@ -0,0 +1,154 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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 OR Apache-2.0 +# ]) + +rust_library( + name = "cc", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.77", + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +rust_binary( + name = "gcc-shim__bin", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + 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({ + "//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.77", + deps = [ + ":cc", + ] + select({ + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.clap-4.0.29.bazel b/third-party/bazel/BUILD.clap-4.0.29.bazel new file mode 100644 index 00000000..159dc66f --- /dev/null +++ b/third-party/bazel/BUILD.clap-4.0.29.bazel @@ -0,0 +1,166 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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 OR Apache-2.0 +# ]) + +rust_library( + name = "clap", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "error-context", + "help", + "std", + "usage", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2021", + proc_macro_deps = [ + ] + select({ + "//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 = "4.0.29", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__bitflags-1.3.2//:bitflags", + "@vendor__clap_lex-0.3.0//:clap_lex", + ], + }), +) + +rust_binary( + name = "stdio-fixture__bin", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "error-context", + "help", + "std", + "usage", + ], + crate_root = "src/bin/stdio-fixture.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2021", + proc_macro_deps = [ + ] + select({ + "//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 = "4.0.29", + deps = [ + ":clap", + ] + select({ + "//conditions:default": [ + "@vendor__bitflags-1.3.2//:bitflags", + "@vendor__clap_lex-0.3.0//:clap_lex", + ], + }), +) diff --git a/third-party/bazel/BUILD.clap_lex-0.3.0.bazel b/third-party/bazel/BUILD.clap_lex-0.3.0.bazel new file mode 100644 index 00000000..320d1023 --- /dev/null +++ b/third-party/bazel/BUILD.clap_lex-0.3.0.bazel @@ -0,0 +1,87 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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 = "clap_lex", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2021", + proc_macro_deps = [ + ] + select({ + "//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.0", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__os_str_bytes-6.4.1//:os_str_bytes", + ], + }), +) diff --git a/third-party/bazel/BUILD.codespan-reporting-0.11.1.bazel b/third-party/bazel/BUILD.codespan-reporting-0.11.1.bazel new file mode 100644 index 00000000..77365e4b --- /dev/null +++ b/third-party/bazel/BUILD.codespan-reporting-0.11.1.bazel @@ -0,0 +1,88 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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", # Apache-2.0 +# ]) + +rust_library( + name = "codespan_reporting", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.11.1", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__termcolor-1.1.3//:termcolor", + "@vendor__unicode-width-0.1.10//:unicode_width", + ], + }), +) diff --git a/third-party/bazel/BUILD.once_cell-1.16.0.bazel b/third-party/bazel/BUILD.once_cell-1.16.0.bazel new file mode 100644 index 00000000..ef72a84e --- /dev/null +++ b/third-party/bazel/BUILD.once_cell-1.16.0.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 @//third-party:vendor +############################################################################### + +# 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 = "once_cell", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "alloc", + "default", + "race", + "std", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2021", + proc_macro_deps = [ + ] + select({ + "//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.16.0", + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel b/third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel new file mode 100644 index 00000000..28bce6a2 --- /dev/null +++ b/third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel @@ -0,0 +1,87 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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 = "os_str_bytes", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "raw_os_str", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2021", + proc_macro_deps = [ + ] + select({ + "//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 = "6.4.1", + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.proc-macro2-1.0.47.bazel b/third-party/bazel/BUILD.proc-macro2-1.0.47.bazel new file mode 100644 index 00000000..2c19387c --- /dev/null +++ b/third-party/bazel/BUILD.proc-macro2-1.0.47.bazel @@ -0,0 +1,187 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +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 OR Apache-2.0 +# ]) + +rust_library( + name = "proc_macro2", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "default", + "proc-macro", + "span-locations", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.47", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__proc-macro2-1.0.47//:build_script_build", + "@vendor__unicode-ident-1.0.5//:unicode_ident", + ], + }), +) + +cargo_build_script( + # See comment associated with alias. Do not change this name + name = "proc-macro2_build_script", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + build_script_env = { + }, + compile_data = select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "default", + "proc-macro", + "span-locations", + ], + crate_name = "build_script_build", + crate_root = "build.rs", + data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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 = "1.0.47", + visibility = ["//visibility:private"], + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +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 name of any build script cannot be the Cargo canonical name + # of `cargo_build_script` (rule) without losing out on having certain + # Cargo environment variables set. + name = "build_script_build", + actual = "proc-macro2_build_script", + tags = [ + "manual", + ], +) diff --git a/third-party/bazel/BUILD.quote-1.0.21.bazel b/third-party/bazel/BUILD.quote-1.0.21.bazel new file mode 100644 index 00000000..abd9e42f --- /dev/null +++ b/third-party/bazel/BUILD.quote-1.0.21.bazel @@ -0,0 +1,185 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +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 OR Apache-2.0 +# ]) + +rust_library( + name = "quote", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "default", + "proc-macro", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.21", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__proc-macro2-1.0.47//:proc_macro2", + "@vendor__quote-1.0.21//:build_script_build", + ], + }), +) + +cargo_build_script( + # See comment associated with alias. Do not change this name + name = "quote_build_script", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + build_script_env = { + }, + compile_data = select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "default", + "proc-macro", + ], + crate_name = "build_script_build", + crate_root = "build.rs", + data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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 = "1.0.21", + visibility = ["//visibility:private"], + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +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 name of any build script cannot be the Cargo canonical name + # of `cargo_build_script` (rule) without losing out on having certain + # Cargo environment variables set. + name = "build_script_build", + actual = "quote_build_script", + tags = [ + "manual", + ], +) diff --git a/third-party/bazel/BUILD.scratch-1.0.2.bazel b/third-party/bazel/BUILD.scratch-1.0.2.bazel new file mode 100644 index 00000000..6641f62f --- /dev/null +++ b/third-party/bazel/BUILD.scratch-1.0.2.bazel @@ -0,0 +1,180 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +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 OR Apache-2.0 +# ]) + +rust_library( + name = "scratch", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.2", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__scratch-1.0.2//:build_script_build", + ], + }), +) + +cargo_build_script( + # See comment associated with alias. Do not change this name + name = "scratch_build_script", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//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( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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 = "1.0.2", + visibility = ["//visibility:private"], + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +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 name of any build script cannot be the Cargo canonical name + # of `cargo_build_script` (rule) without losing out on having certain + # Cargo environment variables set. + name = "build_script_build", + actual = "scratch_build_script", + tags = [ + "manual", + ], +) diff --git a/third-party/bazel/BUILD.syn-1.0.105.bazel b/third-party/bazel/BUILD.syn-1.0.105.bazel new file mode 100644 index 00000000..277d576c --- /dev/null +++ b/third-party/bazel/BUILD.syn-1.0.105.bazel @@ -0,0 +1,199 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +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 OR Apache-2.0 +# ]) + +rust_library( + name = "syn", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "clone-impls", + "default", + "derive", + "full", + "parsing", + "printing", + "proc-macro", + "quote", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.105", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__proc-macro2-1.0.47//:proc_macro2", + "@vendor__quote-1.0.21//:quote", + "@vendor__syn-1.0.105//:build_script_build", + "@vendor__unicode-ident-1.0.5//:unicode_ident", + ], + }), +) + +cargo_build_script( + # See comment associated with alias. Do not change this name + name = "syn_build_script", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + build_script_env = { + }, + compile_data = select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "clone-impls", + "default", + "derive", + "full", + "parsing", + "printing", + "proc-macro", + "quote", + ], + crate_name = "build_script_build", + crate_root = "build.rs", + data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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 = "1.0.105", + visibility = ["//visibility:private"], + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +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 name of any build script cannot be the Cargo canonical name + # of `cargo_build_script` (rule) without losing out on having certain + # Cargo environment variables set. + name = "build_script_build", + actual = "syn_build_script", + tags = [ + "manual", + ], +) diff --git a/third-party/bazel/BUILD.termcolor-1.1.3.bazel b/third-party/bazel/BUILD.termcolor-1.1.3.bazel new file mode 100644 index 00000000..8610344c --- /dev/null +++ b/third-party/bazel/BUILD.termcolor-1.1.3.bazel @@ -0,0 +1,95 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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", # Unlicense OR MIT +# ]) + +rust_library( + name = "termcolor", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.1.3", + deps = [ + ] + select({ + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@vendor__winapi-util-0.1.5//:winapi_util", # cfg(windows) + ], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [ + "@vendor__winapi-util-0.1.5//:winapi_util", # cfg(windows) + ], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ + "@vendor__winapi-util-0.1.5//:winapi_util", # cfg(windows) + ], + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.unicode-ident-1.0.5.bazel b/third-party/bazel/BUILD.unicode-ident-1.0.5.bazel new file mode 100644 index 00000000..1516df88 --- /dev/null +++ b/third-party/bazel/BUILD.unicode-ident-1.0.5.bazel @@ -0,0 +1,86 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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) AND Unicode-DFS-2016 +# ]) + +rust_library( + name = "unicode_ident", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.5", + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.unicode-width-0.1.10.bazel b/third-party/bazel/BUILD.unicode-width-0.1.10.bazel new file mode 100644 index 00000000..5ba56f4c --- /dev/null +++ b/third-party/bazel/BUILD.unicode-width-0.1.10.bazel @@ -0,0 +1,87 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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 = "unicode_width", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.10", + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.winapi-0.3.9.bazel b/third-party/bazel/BUILD.winapi-0.3.9.bazel new file mode 100644 index 00000000..cf49ab77 --- /dev/null +++ b/third-party/bazel/BUILD.winapi-0.3.9.bazel @@ -0,0 +1,200 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +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 = "winapi", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "consoleapi", + "errhandlingapi", + "fileapi", + "minwindef", + "processenv", + "std", + "winbase", + "wincon", + "winerror", + "winnt", + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.9", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__winapi-0.3.9//:build_script_build", + ], + }), +) + +cargo_build_script( + # See comment associated with alias. Do not change this name + name = "winapi_build_script", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + build_script_env = { + }, + compile_data = select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + "consoleapi", + "errhandlingapi", + "fileapi", + "minwindef", + "processenv", + "std", + "winbase", + "wincon", + "winerror", + "winnt", + ], + crate_name = "build_script_build", + crate_root = "build.rs", + data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.3.9", + visibility = ["//visibility:private"], + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +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 name of any build script cannot be the Cargo canonical name + # of `cargo_build_script` (rule) without losing out on having certain + # Cargo environment variables set. + name = "build_script_build", + actual = "winapi_build_script", + tags = [ + "manual", + ], +) diff --git a/third-party/bazel/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel b/third-party/bazel/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel new file mode 100644 index 00000000..b2fbc0b1 --- /dev/null +++ b/third-party/bazel/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel @@ -0,0 +1,180 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +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 = "winapi_i686_pc_windows_gnu", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.4.0", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__winapi-i686-pc-windows-gnu-0.4.0//:build_script_build", + ], + }), +) + +cargo_build_script( + # See comment associated with alias. Do not change this name + name = "winapi-i686-pc-windows-gnu_build_script", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//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( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.4.0", + visibility = ["//visibility:private"], + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +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 name of any build script cannot be the Cargo canonical name + # of `cargo_build_script` (rule) without losing out on having certain + # Cargo environment variables set. + name = "build_script_build", + actual = "winapi-i686-pc-windows-gnu_build_script", + tags = [ + "manual", + ], +) diff --git a/third-party/bazel/BUILD.winapi-util-0.1.5.bazel b/third-party/bazel/BUILD.winapi-util-0.1.5.bazel new file mode 100644 index 00000000..b04a17b1 --- /dev/null +++ b/third-party/bazel/BUILD.winapi-util-0.1.5.bazel @@ -0,0 +1,95 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +# 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", # Unlicense/MIT +# ]) + +rust_library( + name = "winapi_util", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2018", + proc_macro_deps = [ + ] + select({ + "//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.5", + deps = [ + ] + select({ + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@vendor__winapi-0.3.9//:winapi", # cfg(windows) + ], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [ + "@vendor__winapi-0.3.9//:winapi", # cfg(windows) + ], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ + "@vendor__winapi-0.3.9//:winapi", # cfg(windows) + ], + "//conditions:default": [ + ], + }), +) diff --git a/third-party/bazel/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel b/third-party/bazel/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel new file mode 100644 index 00000000..0f2b682c --- /dev/null +++ b/third-party/bazel/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel @@ -0,0 +1,180 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party:vendor +############################################################################### + +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 = "winapi_x86_64_pc_windows_gnu", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//conditions:default": { + }, + }), + compile_data = glob( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + crate_features = [ + ], + crate_root = "src/lib.rs", + data = select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.4.0", + deps = [ + ] + select({ + "//conditions:default": [ + "@vendor__winapi-x86_64-pc-windows-gnu-0.4.0//:build_script_build", + ], + }), +) + +cargo_build_script( + # See comment associated with alias. Do not change this name + name = "winapi-x86_64-pc-windows-gnu_build_script", + srcs = glob( + include = [ + "**/*.rs", + ], + exclude = [ + ], + ), + aliases = select({ + "//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( + include = ["**"], + exclude = [ + "**/* *", + "BUILD.bazel", + "BUILD", + "WORKSPACE.bazel", + "WORKSPACE", + ], + ) + select_with_or({ + "//conditions:default": [ + ], + }), + edition = "2015", + proc_macro_deps = [ + ] + select({ + "//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.4.0", + visibility = ["//visibility:private"], + deps = [ + ] + select({ + "//conditions:default": [ + ], + }), +) + +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 name of any build script cannot be the Cargo canonical name + # of `cargo_build_script` (rule) without losing out on having certain + # Cargo environment variables set. + name = "build_script_build", + actual = "winapi-x86_64-pc-windows-gnu_build_script", + tags = [ + "manual", + ], +) diff --git a/third-party/bazel/crates.bzl b/third-party/bazel/crates.bzl new file mode 100644 index 00000000..6d61f64a --- /dev/null +++ b/third-party/bazel/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("@cxx.rs//third-party/bazel: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 = "vendor", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.bazel"), + defs_module = Label("@cxx.rs//third-party/bazel:defs.bzl"), + ) + + _crate_repositories() diff --git a/third-party/bazel/defs.bzl b/third-party/bazel/defs.bzl new file mode 100644 index 00000000..60d2c720 --- /dev/null +++ b/third-party/bazel/defs.bzl @@ -0,0 +1,551 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//third-party: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, 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 = { + "third-party": { + _COMMON_CONDITION: { + "cc": "@vendor__cc-1.0.77//:cc", + "clap": "@vendor__clap-4.0.29//:clap", + "codespan-reporting": "@vendor__codespan-reporting-0.11.1//:codespan_reporting", + "once_cell": "@vendor__once_cell-1.16.0//:once_cell", + "proc-macro2": "@vendor__proc-macro2-1.0.47//:proc_macro2", + "quote": "@vendor__quote-1.0.21//:quote", + "scratch": "@vendor__scratch-1.0.2//:scratch", + "syn": "@vendor__syn-1.0.105//:syn", + }, + }, +} + +_NORMAL_ALIASES = { + "third-party": { + _COMMON_CONDITION: { + }, + }, +} + +_NORMAL_DEV_DEPENDENCIES = { + "third-party": { + }, +} + +_NORMAL_DEV_ALIASES = { + "third-party": { + }, +} + +_PROC_MACRO_DEPENDENCIES = { + "third-party": { + }, +} + +_PROC_MACRO_ALIASES = { + "third-party": { + }, +} + +_PROC_MACRO_DEV_DEPENDENCIES = { + "third-party": { + }, +} + +_PROC_MACRO_DEV_ALIASES = { + "third-party": { + }, +} + +_BUILD_DEPENDENCIES = { + "third-party": { + }, +} + +_BUILD_ALIASES = { + "third-party": { + }, +} + +_BUILD_PROC_MACRO_DEPENDENCIES = { + "third-party": { + }, +} + +_BUILD_PROC_MACRO_ALIASES = { + "third-party": { + }, +} + +_CONDITIONS = { + "cfg(windows)": ["aarch64-pc-windows-msvc", "i686-pc-windows-msvc", "x86_64-pc-windows-msvc"], + "i686-pc-windows-gnu": [], + "x86_64-pc-windows-gnu": [], +} + +############################################################################### + +def crate_repositories(): + """A macro for defining repositories for all generated crates""" + maybe( + http_archive, + name = "vendor__bitflags-1.3.2", + sha256 = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/bitflags/1.3.2/download"], + strip_prefix = "bitflags-1.3.2", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.bitflags-1.3.2.bazel"), + ) + + maybe( + http_archive, + name = "vendor__cc-1.0.77", + sha256 = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/cc/1.0.77/download"], + strip_prefix = "cc-1.0.77", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.cc-1.0.77.bazel"), + ) + + maybe( + http_archive, + name = "vendor__clap-4.0.29", + sha256 = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/clap/4.0.29/download"], + strip_prefix = "clap-4.0.29", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap-4.0.29.bazel"), + ) + + maybe( + http_archive, + name = "vendor__clap_lex-0.3.0", + sha256 = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/clap_lex/0.3.0/download"], + strip_prefix = "clap_lex-0.3.0", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap_lex-0.3.0.bazel"), + ) + + maybe( + http_archive, + name = "vendor__codespan-reporting-0.11.1", + sha256 = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/codespan-reporting/0.11.1/download"], + strip_prefix = "codespan-reporting-0.11.1", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.codespan-reporting-0.11.1.bazel"), + ) + + maybe( + http_archive, + name = "vendor__once_cell-1.16.0", + sha256 = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/once_cell/1.16.0/download"], + strip_prefix = "once_cell-1.16.0", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.once_cell-1.16.0.bazel"), + ) + + maybe( + http_archive, + name = "vendor__os_str_bytes-6.4.1", + sha256 = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/os_str_bytes/6.4.1/download"], + strip_prefix = "os_str_bytes-6.4.1", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.os_str_bytes-6.4.1.bazel"), + ) + + maybe( + http_archive, + name = "vendor__proc-macro2-1.0.47", + sha256 = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.47/download"], + strip_prefix = "proc-macro2-1.0.47", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.proc-macro2-1.0.47.bazel"), + ) + + maybe( + http_archive, + name = "vendor__quote-1.0.21", + sha256 = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/quote/1.0.21/download"], + strip_prefix = "quote-1.0.21", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.quote-1.0.21.bazel"), + ) + + maybe( + http_archive, + name = "vendor__scratch-1.0.2", + sha256 = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/scratch/1.0.2/download"], + strip_prefix = "scratch-1.0.2", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.scratch-1.0.2.bazel"), + ) + + maybe( + http_archive, + name = "vendor__syn-1.0.105", + sha256 = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/syn/1.0.105/download"], + strip_prefix = "syn-1.0.105", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.syn-1.0.105.bazel"), + ) + + maybe( + http_archive, + name = "vendor__termcolor-1.1.3", + sha256 = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/termcolor/1.1.3/download"], + strip_prefix = "termcolor-1.1.3", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.termcolor-1.1.3.bazel"), + ) + + maybe( + http_archive, + name = "vendor__unicode-ident-1.0.5", + sha256 = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/unicode-ident/1.0.5/download"], + strip_prefix = "unicode-ident-1.0.5", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.unicode-ident-1.0.5.bazel"), + ) + + maybe( + http_archive, + name = "vendor__unicode-width-0.1.10", + sha256 = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/unicode-width/0.1.10/download"], + strip_prefix = "unicode-width-0.1.10", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.unicode-width-0.1.10.bazel"), + ) + + maybe( + http_archive, + name = "vendor__winapi-0.3.9", + sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/winapi/0.3.9/download"], + strip_prefix = "winapi-0.3.9", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.winapi-0.3.9.bazel"), + ) + + maybe( + http_archive, + name = "vendor__winapi-i686-pc-windows-gnu-0.4.0", + sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download"], + strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel"), + ) + + maybe( + http_archive, + name = "vendor__winapi-util-0.1.5", + sha256 = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/winapi-util/0.1.5/download"], + strip_prefix = "winapi-util-0.1.5", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.winapi-util-0.1.5.bazel"), + ) + + maybe( + http_archive, + name = "vendor__winapi-x86_64-pc-windows-gnu-0.4.0", + sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + type = "tar.gz", + urls = ["https://crates.io/api/v1/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download"], + strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel"), + ) diff --git a/tools/bazel/third_party.bzl b/tools/bazel/third_party.bzl deleted file mode 100644 index 5b2ec3fe..00000000 --- a/tools/bazel/third_party.bzl +++ /dev/null @@ -1,18 +0,0 @@ -load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") -load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library") -load("@third-party//:vendor.bzl", "vendored") - -def third_party_glob(include): - return vendored and native.glob(include) - -def third_party_cargo_build_script(rustc_flags = [], **kwargs): - rustc_flags = rustc_flags + ["--cap-lints=allow"] - cargo_build_script(rustc_flags = rustc_flags, **kwargs) - -def third_party_rust_binary(rustc_flags = [], **kwargs): - rustc_flags = rustc_flags + ["--cap-lints=allow"] - rust_binary(rustc_flags = rustc_flags, **kwargs) - -def third_party_rust_library(rustc_flags = [], **kwargs): - rustc_flags = rustc_flags + ["--cap-lints=allow"] - rust_library(rustc_flags = rustc_flags, **kwargs) diff --git a/tools/bazel/vendor.bzl b/tools/bazel/vendor.bzl deleted file mode 100644 index 0f199145..00000000 --- a/tools/bazel/vendor.bzl +++ /dev/null @@ -1,81 +0,0 @@ -"""A module defining a repository rule for vendoring the dependencies -of a crate in the current workspace. -""" - -load("@rules_rust//rust:defs.bzl", "rust_common") -load("@rules_rust//rust:repositories.bzl", "load_arbitrary_tool") -load("@rules_rust//rust/platform:triple.bzl", "get_host_triple") - -def _impl(repository_ctx): - # Link cxx repository into @third-party. - lockfile = repository_ctx.path(repository_ctx.attr.lockfile) - workspace = lockfile.dirname.dirname - repository_ctx.symlink(workspace, "workspace") - - # Figure out which version of cargo to use. - if repository_ctx.attr.target_triple: - target_triple = repository_ctx.attr.target_triple - else: - target_triple = get_host_triple(repository_ctx).str - - # Download cargo. - load_arbitrary_tool( - ctx = repository_ctx, - tool_name = "cargo", - tool_subdirectories = ["cargo"], - version = repository_ctx.attr.cargo_version, - iso_date = repository_ctx.attr.cargo_iso_date, - target_triple = target_triple, - ) - - cmd = ["{}/bin/cargo".format(repository_ctx.path(".")), "vendor", "--versioned-dirs"] - result = repository_ctx.execute( - cmd, - quiet = True, - working_directory = "workspace/third-party", - ) - _log_cargo_vendor(repository_ctx, result) - if result.return_code != 0: - fail("failed to execute `{}`".format(" ".join(cmd))) - - # Produce a token for third_party_glob to depend on so that the necessary - # sequencing is visible to Bazel. - repository_ctx.file("BUILD", executable = False) - repository_ctx.file("vendor.bzl", "vendored = True", executable = False) - -def _copy_file(repository_ctx, *, src, dst): - content = repository_ctx.read(src) - if not dst.exists or content != repository_ctx.read(dst): - repository_ctx.file(dst, content = content, executable = False) - -def _log_cargo_vendor(repository_ctx, result): - relevant = "" - for line in result.stderr.splitlines(True): - if line.strip() and not line.startswith("To use vendored sources,"): - relevant += line - if relevant: - # Render it as command output. - # If we just use print(), Bazel will cache and repeat the output even - # when not rerunning the command. - print = ["echo", relevant] - repository_ctx.execute(print, quiet = False) - -vendor = repository_rule( - doc = "A rule used to vendor the dependencies of a crate in the current workspace", - attrs = { - "cargo_version": attr.string( - doc = "The version of cargo to use", - ), - "cargo_iso_date": attr.string( - doc = "The date of the tool (or None, if the version is a specific version)", - ), - "target_triple": attr.string( - doc = "The target triple of the cargo binary to download", - ), - "lockfile": attr.label( - doc = "A lockfile providing the set of crates to vendor", - ), - }, - local = True, - implementation = _impl, -)