From ba085d75d389bef20725fc666d4c64b70482341e Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Sat, 9 Nov 2024 16:21:01 -0500 Subject: [PATCH 1/4] start, add new rust_lint_group rule * allows defining rustc, rustc check-cfg, clippy, and rustdoc lints * add a 'lints' attribute to the common rust attributes * rust_doc and rust_clippy rules use the lints from the crate they target --- rust/defs.bzl | 7 +++ rust/private/clippy.bzl | 12 ++++- rust/private/lints.bzl | 94 ++++++++++++++++++++++++++++++++++++++ rust/private/providers.bzl | 9 ++++ rust/private/rust.bzl | 6 ++- rust/private/rustc.bzl | 11 ++++- rust/private/rustdoc.bzl | 7 +++ 7 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 rust/private/lints.bzl diff --git a/rust/defs.bzl b/rust/defs.bzl index 67a28630f6..42f866ff19 100644 --- a/rust/defs.bzl +++ b/rust/defs.bzl @@ -71,6 +71,10 @@ load( _rust_unpretty = "rust_unpretty", _rust_unpretty_aspect = "rust_unpretty_aspect", ) +load( + "//rust/private:lints.bzl", + _rust_lint_group = "rust_lint_group", +) rust_library = _rust_library # See @rules_rust//rust/private:rust.bzl for a complete description. @@ -157,4 +161,7 @@ rustfmt_test = _rustfmt_test rust_stdlib_filegroup = _rust_stdlib_filegroup # See @rules_rust//rust:toolchain.bzl for a complete description. +rust_lint_group = _rust_lint_group +# See @rules_rust//private:lint.bzl for a complete description. + no_std = _no_std diff --git a/rust/private/clippy.bzl b/rust/private/clippy.bzl index 07c957d4a5..014326d390 100644 --- a/rust/private/clippy.bzl +++ b/rust/private/clippy.bzl @@ -15,7 +15,7 @@ """A module defining clippy rules""" load("//rust/private:common.bzl", "rust_common") -load("//rust/private:providers.bzl", "CaptureClippyOutputInfo", "ClippyInfo") +load("//rust/private:providers.bzl", "CaptureClippyOutputInfo", "ClippyInfo", "LintsInfo") load( "//rust/private:rustc.bzl", "collect_deps", @@ -143,7 +143,15 @@ def _clippy_aspect_impl(target, ctx): if crate_info.is_test: args.rustc_flags.add("--test") - clippy_flags = ctx.attr._clippy_flags[ClippyFlagsInfo].clippy_flags + clippy_flags = [] + + # First append the clippy flags from the target itself. + if hasattr(ctx.rule.attr, "lints"): + clippy_flags = clippy_flags + ctx.rule.attr.lints[LintsInfo].clippy_lints + + # Then append the clippy flags specified from the command line, so they override what is + # specified on the library. + clippy_flags = clippy_flags + ctx.attr._clippy_flags[ClippyFlagsInfo].clippy_flags if hasattr(ctx.attr, "_clippy_flag"): clippy_flags = clippy_flags + ctx.attr._clippy_flag[ClippyFlagsInfo].clippy_flags diff --git a/rust/private/lints.bzl b/rust/private/lints.bzl new file mode 100644 index 0000000000..e197918117 --- /dev/null +++ b/rust/private/lints.bzl @@ -0,0 +1,94 @@ +"""Rules for defining lints to apply to various Rust targets""" + +load("//rust/private:providers.bzl", "LintsInfo") + +def _rust_lint_group(ctx): + """Implementation of the `rust_lint_group` rule. + + Args: + ctx (ctx): The rule's context object. + + Returns: + list: The LintsInfo provider. + """ + + allowed_levels = ["allow", "warn", "deny", "forbid", "force-warn"] + + rustc_flags = [] + for lint, level in ctx.attr.rustc.items(): + if level not in allowed_levels: + fail("Invalid rustc lint level '{0}'".format(level)) + rustc_flags.append("--{LEVEL}={LINT}".format(LEVEL = level, LINT = lint)) + for name, values in ctx.attr.rustc_check_cfg.items(): + if len(values) != 0: + values_list = ", ".join(["\"{0}\"".format(v) for v in values]) + values_arg = ", values({0})".format(values_list) + else: + values_arg = "" + rustc_flags.append("--check-cfg=cfg({NAME}{VALUES})".format(NAME = name, VALUES = values_arg)) + + clippy_flags = [] + for lint, level in ctx.attr.clippy.items(): + if level not in allowed_levels: + fail("Invalid clippy lint level '{0}'".format(level)) + clippy_flags.append("--{LEVEL}=clippy::{LINT}".format(LEVEL = level, LINT = lint)) + + rustdoc_flags = [] + for lint, level in ctx.attr.rustdoc.items(): + if level not in allowed_levels: + fail("Invalid rustdoc lint level '{0}'".format(level)) + rustdoc_flags.append("--{LEVEL}=rustdoc::{LINT}".format(LEVEL = level, LINT = lint)) + + return LintsInfo( + rustc_lints = rustc_flags, + clippy_lints = clippy_flags, + rustdoc_lints = rustdoc_flags, + ) + +rust_lint_group = rule( + implementation = _rust_lint_group, + attrs = { + "rustc": attr.string_dict( + doc = "Set of 'rustc' lints to 'allow', 'expect', 'warn', 'force-warn', 'deny', or 'forbid'.", + ), + "rustc_check_cfg": attr.string_list_dict( + doc = "Set of 'cfg' names and list of values to expect.", + ), + "clippy": attr.string_dict( + doc = "Set of 'clippy' lints to 'allow', 'expect', 'warn', 'force-warn', 'deny', or 'forbid'.", + ), + "rustdoc": attr.string_dict( + doc = "Set of 'rustdoc' lints to 'allow', 'expect', 'warn', 'force-warn', 'deny', or 'forbid'.", + ), + }, + doc = """\ +Defines a group of lints that can be applied when building Rust targets. + +For example, you can define a single group of lints: + +```python +load("@rules_rust//rust:defs.bzl", "rust_lint_group") + +rust_lint_group( + name = "workspace_lints", + rustc = { + "unknown_lints": "allow", + "unexpected_cfgs": "warn", + }, + rustc_check_cfg = { + "bazel": [], + "fuzzing": [], + "mz_featutres": ["laser", "rocket"], + }, + clippy = { + "box_default": "allow", + "todo": "warn", + "unused_async": "warn", + }, + rustdoc = { + "unportable_markdown": "allow", + }, +) +``` +""", +) diff --git a/rust/private/providers.bzl b/rust/private/providers.bzl index 97c4500b3b..3b9ddde789 100644 --- a/rust/private/providers.bzl +++ b/rust/private/providers.bzl @@ -174,3 +174,12 @@ RustAnalyzerGroupInfo = provider( "deps": "List[RustAnalyzerInfo]: direct dependencies", }, ) + +LintsInfo = provider( + doc = "LintsInfo holds the 'allow', 'warn', etc. config for rustc, clippy, and rustdoc lints.", + fields = { + "rustc_lints": "List[String]: rustc flags to specify when building rust_* targets.", + "clippy_lints": "List[String]: rustc flags to specify when building clippy targets.", + "rustdoc_lints": "List[String]: rustc flags to specify when building rust_doc targets.", + }, +) diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl index 47c0e55eb5..53a41e8d46 100644 --- a/rust/private/rust.bzl +++ b/rust/private/rust.bzl @@ -16,7 +16,7 @@ load("@bazel_skylib//lib:paths.bzl", "paths") load("//rust/private:common.bzl", "COMMON_PROVIDERS", "rust_common") -load("//rust/private:providers.bzl", "BuildInfo") +load("//rust/private:providers.bzl", "BuildInfo", "LintsInfo") load("//rust/private:rustc.bzl", "rustc_compile_action") load( "//rust/private:utils.bzl", @@ -645,6 +645,10 @@ _common_attrs = { linking a native library. """), ), + "lints": attr.label( + doc = "Set of lints to apply when building this crate.", + providers = [LintsInfo], + ), "edition": attr.string( doc = "The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain.", ), diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index d2a810f099..64fb369f76 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -23,7 +23,7 @@ load( "CPP_LINK_STATIC_LIBRARY_ACTION_NAME", ) load("//rust/private:common.bzl", "rust_common") -load("//rust/private:providers.bzl", "RustcOutputDiagnosticsInfo", _BuildInfo = "BuildInfo") +load("//rust/private:providers.bzl", "RustcOutputDiagnosticsInfo", _BuildInfo = "BuildInfo", "LintsInfo") load("//rust/private:stamp.bzl", "is_stamping_enabled") load( "//rust/private:utils.bzl", @@ -1183,6 +1183,10 @@ def rustc_compile_action( # Determine if the build is currently running with --stamp stamp = is_stamping_enabled(attr) + # Add flags for any 'rustc' lints that are specified. + if hasattr(ctx.attr, "lints") and ctx.attr.lints: + rust_flags = rust_flags + ctx.attr.lints[LintsInfo].rustc_lints + compile_inputs, out_dir, build_env_files, build_flags_files, linkstamp_outs, ambiguous_libs = collect_inputs( ctx = ctx, file = ctx.file, @@ -1538,6 +1542,11 @@ def rustc_compile_action( if output_group_info: providers.append(OutputGroupInfo(**output_group_info)) + + # A bit unfortunate, but sidecar the lints info so rustdoc can access the + # set of lints from the target it is documenting. + if hasattr(ctx.attr, "lints") and ctx.attr.lints: + providers.append(ctx.attr.lints[LintsInfo]) return providers diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl index 21d77eda35..73b187b9be 100644 --- a/rust/private/rustdoc.bzl +++ b/rust/private/rustdoc.bzl @@ -15,6 +15,7 @@ """Rules for generating documentation with `rustdoc` for Bazel built crates""" load("//rust/private:common.bzl", "rust_common") +load("//rust/private:providers.bzl", "LintsInfo") load("//rust/private:rustc.bzl", "collect_deps", "collect_inputs", "construct_arguments") load("//rust/private:utils.bzl", "dedent", "find_cc_toolchain", "find_toolchain") @@ -187,6 +188,11 @@ def _rust_doc_impl(ctx): crate = ctx.attr.crate crate_info = crate[rust_common.crate_info] + if LintsInfo in crate: + rustdoc_lints = crate[LintsInfo].rustdoc_lints + else: + rustdoc_lints = [] + output_dir = ctx.actions.declare_directory("{}.rustdoc".format(ctx.label.name)) # Add the current crate as an extern for the compile action @@ -196,6 +202,7 @@ def _rust_doc_impl(ctx): ] rustdoc_flags.extend(ctx.attr.rustdoc_flags) + rustdoc_flags.extend(rustdoc_lints) action = rustdoc_compile_action( ctx = ctx, From b2387d21284c28318a9423af216a03dc69bcd7b6 Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Sat, 9 Nov 2024 22:57:14 -0500 Subject: [PATCH 2/4] add cargo_lints rule which can read lints from Cargo.toml * adds a new Rust binary cargo_toml_info which can parse a Cargo.toml and inherit from the workspace * adds a new cargo_lints rule which invokes the cargo_toml_info binary to get lints * update the LintsInfo provider to include CLI args via files --- WORKSPACE.bazel | 4 + cargo/cargo_toml_info/3rdparty/BUILD.bazel | 12 + .../cargo_toml_info/3rdparty/Cargo.Bazel.lock | 155 +++++ .../3rdparty/crates/BUILD.bazel | 38 ++ .../crates/BUILD.cargo_toml-0.20.5.bazel | 86 +++ .../crates/BUILD.equivalent-1.0.1.bazel | 82 +++ .../crates/BUILD.hashbrown-0.15.1.bazel | 82 +++ .../crates/BUILD.indexmap-2.6.0.bazel | 90 +++ .../3rdparty/crates/BUILD.memchr-2.7.4.bazel | 82 +++ .../crates/BUILD.proc-macro2-1.0.89.bazel | 148 +++++ .../3rdparty/crates/BUILD.quote-1.0.37.bazel | 88 +++ .../3rdparty/crates/BUILD.serde-1.0.214.bazel | 156 +++++ .../crates/BUILD.serde_derive-1.0.214.bazel | 90 +++ .../crates/BUILD.serde_spanned-0.6.8.bazel | 88 +++ .../3rdparty/crates/BUILD.syn-2.0.87.bazel | 94 +++ .../3rdparty/crates/BUILD.toml-0.8.19.bazel | 93 +++ .../crates/BUILD.toml_datetime-0.6.8.bazel | 88 +++ .../crates/BUILD.toml_edit-0.22.22.bazel | 94 +++ .../crates/BUILD.unicode-ident-1.0.13.bazel | 82 +++ .../3rdparty/crates/BUILD.winnow-0.6.20.bazel | 87 +++ .../3rdparty/crates/alias_rules.bzl | 47 ++ .../3rdparty/crates/crates.bzl | 32 + .../cargo_toml_info/3rdparty/crates/defs.bzl | 568 ++++++++++++++++++ cargo/cargo_toml_info/BUILD.bazel | 11 + cargo/cargo_toml_info/Cargo.lock | 155 +++++ cargo/cargo_toml_info/Cargo.toml | 11 + cargo/cargo_toml_info/main.rs | 272 +++++++++ cargo/defs.bzl | 6 + cargo/private/cargo_lints.bzl | 73 +++ examples/bzlmod/hello_world/MODULE.bazel.lock | 8 +- rust/private/clippy.bzl | 14 +- rust/private/lints.bzl | 3 + rust/private/providers.bzl | 3 + rust/private/rustc.bzl | 12 +- rust/private/rustdoc.bzl | 18 +- 35 files changed, 2953 insertions(+), 19 deletions(-) create mode 100644 cargo/cargo_toml_info/3rdparty/BUILD.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/Cargo.Bazel.lock create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel create mode 100644 cargo/cargo_toml_info/3rdparty/crates/alias_rules.bzl create mode 100644 cargo/cargo_toml_info/3rdparty/crates/crates.bzl create mode 100644 cargo/cargo_toml_info/3rdparty/crates/defs.bzl create mode 100644 cargo/cargo_toml_info/BUILD.bazel create mode 100644 cargo/cargo_toml_info/Cargo.lock create mode 100644 cargo/cargo_toml_info/Cargo.toml create mode 100644 cargo/cargo_toml_info/main.rs create mode 100644 cargo/private/cargo_lints.bzl diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 2432d31228..14d238e412 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -14,6 +14,10 @@ load("//crate_universe/tools/cross_installer:cross_installer_deps.bzl", "cross_i cross_installer_deps() +load("//cargo/cargo_toml_info/3rdparty/crates:defs.bzl", cargo_toml_info_crate_repositories = "crate_repositories") + +cargo_toml_info_crate_repositories() + # buildifier: disable=bzl-visibility load("@rules_rust//proto/prost/private:repositories.bzl", "rust_prost_dependencies", "rust_prost_register_toolchains") diff --git a/cargo/cargo_toml_info/3rdparty/BUILD.bazel b/cargo/cargo_toml_info/3rdparty/BUILD.bazel new file mode 100644 index 0000000000..7d7f973c58 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/BUILD.bazel @@ -0,0 +1,12 @@ +load("//crate_universe:defs.bzl", "crate", "crates_vendor") + +crates_vendor( + name = "crates_vendor", + cargo_lockfile = "Cargo.Bazel.lock", + mode = "remote", + packages = { + "cargo_toml": crate.spec(version = "0.20.5"), + }, + repository_name = "rules_rust_cargo_toml_info", + tags = ["manual"], +) diff --git a/cargo/cargo_toml_info/3rdparty/Cargo.Bazel.lock b/cargo/cargo_toml_info/3rdparty/Cargo.Bazel.lock new file mode 100644 index 0000000000..f536bab708 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/Cargo.Bazel.lock @@ -0,0 +1,155 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cargo_toml" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88da5a13c620b4ca0078845707ea9c3faf11edbc3ffd8497d11d686211cd1ac0" +dependencies = [ + "serde", + "toml", +] + +[[package]] +name = "direct-cargo-bazel-deps" +version = "0.0.1" +dependencies = [ + "cargo_toml", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "hashbrown" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.bazel new file mode 100644 index 0000000000..ee497fa6b2 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.bazel @@ -0,0 +1,38 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +package(default_visibility = ["//visibility:public"]) + +exports_files( + [ + "cargo-bazel.json", + "crates.bzl", + "defs.bzl", + ] + glob( + include = ["*.bazel"], + allow_empty = True, + ), +) + +filegroup( + name = "srcs", + srcs = glob( + include = [ + "*.bazel", + "*.bzl", + ], + allow_empty = True, + ), +) + +# Workspace Member Dependencies +alias( + name = "cargo_toml", + actual = "@rules_rust_cargo_toml_info__cargo_toml-0.20.5//:cargo_toml", + tags = ["manual"], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel new file mode 100644 index 0000000000..fd63e4721a --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.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 @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "cargo_toml", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/cargo_toml.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=cargo_toml", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.20.5", + deps = [ + "@rules_rust_cargo_toml_info__serde-1.0.214//:serde", + "@rules_rust_cargo_toml_info__toml-0.8.19//:toml", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel new file mode 100644 index 0000000000..92489d00a3 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel @@ -0,0 +1,82 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "equivalent", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=equivalent", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "1.0.1", +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel new file mode 100644 index 0000000000..2bc68a7fdb --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel @@ -0,0 +1,82 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "hashbrown", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=hashbrown", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.15.1", +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel new file mode 100644 index 0000000000..d3ebfefcf8 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.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 @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "indexmap", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=indexmap", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "2.6.0", + deps = [ + "@rules_rust_cargo_toml_info__equivalent-1.0.1//:equivalent", + "@rules_rust_cargo_toml_info__hashbrown-0.15.1//:hashbrown", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel new file mode 100644 index 0000000000..3a9f06b28e --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel @@ -0,0 +1,82 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "memchr", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=memchr", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "2.7.4", +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel new file mode 100644 index 0000000000..f136748fad --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel @@ -0,0 +1,148 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//cargo:defs.bzl", "cargo_build_script") +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "proc_macro2", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "proc-macro", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=proc-macro2", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "1.0.89", + deps = [ + "@rules_rust_cargo_toml_info__proc-macro2-1.0.89//:build_script_build", + "@rules_rust_cargo_toml_info__unicode-ident-1.0.13//:unicode_ident", + ], +) + +cargo_build_script( + name = "_bs", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + "**/*.rs", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "proc-macro", + ], + crate_name = "build_script_build", + crate_root = "build.rs", + data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + edition = "2021", + pkg_name = "proc-macro2", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=proc-macro2", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.0.89", + visibility = ["//visibility:private"], +) + +alias( + name = "build_script_build", + actual = ":_bs", + tags = ["manual"], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel new file mode 100644 index 0000000000..f6ab4a5259 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.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 @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "quote", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "proc-macro", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=quote", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "1.0.37", + deps = [ + "@rules_rust_cargo_toml_info__proc-macro2-1.0.89//:proc_macro2", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel new file mode 100644 index 0000000000..e9bb53c3e3 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel @@ -0,0 +1,156 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//cargo:defs.bzl", "cargo_build_script") +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "serde", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "derive", + "serde_derive", + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + proc_macro_deps = [ + "@rules_rust_cargo_toml_info__serde_derive-1.0.214//:serde_derive", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=serde", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "1.0.214", + deps = [ + "@rules_rust_cargo_toml_info__serde-1.0.214//:build_script_build", + ], +) + +cargo_build_script( + name = "_bs", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + "**/*.rs", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "derive", + "serde_derive", + "std", + ], + crate_name = "build_script_build", + crate_root = "build.rs", + data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + edition = "2018", + pkg_name = "serde", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=serde", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.0.214", + visibility = ["//visibility:private"], +) + +alias( + name = "build_script_build", + actual = ":_bs", + tags = ["manual"], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel new file mode 100644 index 0000000000..94ec29a416 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.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 @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_proc_macro") + +package(default_visibility = ["//visibility:public"]) + +rust_proc_macro( + name = "serde_derive", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=serde_derive", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "1.0.214", + deps = [ + "@rules_rust_cargo_toml_info__proc-macro2-1.0.89//:proc_macro2", + "@rules_rust_cargo_toml_info__quote-1.0.37//:quote", + "@rules_rust_cargo_toml_info__syn-2.0.87//:syn", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel new file mode 100644 index 0000000000..0046d2d1d7 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.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 @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "serde_spanned", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "serde", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=serde_spanned", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.6.8", + deps = [ + "@rules_rust_cargo_toml_info__serde-1.0.214//:serde", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel new file mode 100644 index 0000000000..988bcae957 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel @@ -0,0 +1,94 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "syn", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "clone-impls", + "derive", + "parsing", + "printing", + "proc-macro", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=syn", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "2.0.87", + deps = [ + "@rules_rust_cargo_toml_info__proc-macro2-1.0.89//:proc_macro2", + "@rules_rust_cargo_toml_info__quote-1.0.37//:quote", + "@rules_rust_cargo_toml_info__unicode-ident-1.0.13//:unicode_ident", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel new file mode 100644 index 0000000000..e66c7f6e6a --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel @@ -0,0 +1,93 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "toml", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "display", + "parse", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=toml", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.8.19", + deps = [ + "@rules_rust_cargo_toml_info__serde-1.0.214//:serde", + "@rules_rust_cargo_toml_info__serde_spanned-0.6.8//:serde_spanned", + "@rules_rust_cargo_toml_info__toml_datetime-0.6.8//:toml_datetime", + "@rules_rust_cargo_toml_info__toml_edit-0.22.22//:toml_edit", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel new file mode 100644 index 0000000000..4bb359c1a5 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.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 @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "toml_datetime", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "serde", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=toml_datetime", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.6.8", + deps = [ + "@rules_rust_cargo_toml_info__serde-1.0.214//:serde", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel new file mode 100644 index 0000000000..0c3016f6e9 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel @@ -0,0 +1,94 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "toml_edit", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "display", + "parse", + "serde", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=toml_edit", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.22.22", + deps = [ + "@rules_rust_cargo_toml_info__indexmap-2.6.0//:indexmap", + "@rules_rust_cargo_toml_info__serde-1.0.214//:serde", + "@rules_rust_cargo_toml_info__serde_spanned-0.6.8//:serde_spanned", + "@rules_rust_cargo_toml_info__toml_datetime-0.6.8//:toml_datetime", + "@rules_rust_cargo_toml_info__winnow-0.6.20//:winnow", + ], +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel new file mode 100644 index 0000000000..cb072d2fe4 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel @@ -0,0 +1,82 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "unicode_ident", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=unicode-ident", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "1.0.13", +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel b/cargo/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel new file mode 100644 index 0000000000..8cb45dd591 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.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 @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "winnow", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + "default", + "std", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=winnow", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.6.20", +) diff --git a/cargo/cargo_toml_info/3rdparty/crates/alias_rules.bzl b/cargo/cargo_toml_info/3rdparty/crates/alias_rules.bzl new file mode 100644 index 0000000000..14b04c1272 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/alias_rules.bzl @@ -0,0 +1,47 @@ +"""Alias that transitions its target to `compilation_mode=opt`. Use `transition_alias="opt"` to enable.""" + +load("@rules_cc//cc:defs.bzl", "CcInfo") +load("@rules_rust//rust:rust_common.bzl", "COMMON_PROVIDERS") + +def _transition_alias_impl(ctx): + # `ctx.attr.actual` is a list of 1 item due to the transition + providers = [ctx.attr.actual[0][provider] for provider in COMMON_PROVIDERS] + if CcInfo in ctx.attr.actual[0]: + providers.append(ctx.attr.actual[0][CcInfo]) + return providers + +def _change_compilation_mode(compilation_mode): + def _change_compilation_mode_impl(_settings, _attr): + return { + "//command_line_option:compilation_mode": compilation_mode, + } + + return transition( + implementation = _change_compilation_mode_impl, + inputs = [], + outputs = [ + "//command_line_option:compilation_mode", + ], + ) + +def _transition_alias_rule(compilation_mode): + return rule( + implementation = _transition_alias_impl, + provides = COMMON_PROVIDERS, + attrs = { + "actual": attr.label( + mandatory = True, + doc = "`rust_library()` target to transition to `compilation_mode=opt`.", + providers = COMMON_PROVIDERS, + cfg = _change_compilation_mode(compilation_mode), + ), + "_allowlist_function_transition": attr.label( + default = "@bazel_tools//tools/allowlists/function_transition_allowlist", + ), + }, + doc = "Transitions a Rust library crate to the `compilation_mode=opt`.", + ) + +transition_alias_dbg = _transition_alias_rule("dbg") +transition_alias_fastbuild = _transition_alias_rule("fastbuild") +transition_alias_opt = _transition_alias_rule("opt") diff --git a/cargo/cargo_toml_info/3rdparty/crates/crates.bzl b/cargo/cargo_toml_info/3rdparty/crates/crates.bzl new file mode 100644 index 0000000000..a06faea827 --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/crates.bzl @@ -0,0 +1,32 @@ +############################################################################### +# @generated +# This file is auto-generated by the cargo-bazel tool. +# +# DO NOT MODIFY: Local changes may be replaced in future executions. +############################################################################### +"""Rules for defining repositories for remote `crates_vendor` repositories""" + +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +# buildifier: disable=bzl-visibility +load("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:defs.bzl", _crate_repositories = "crate_repositories") + +# buildifier: disable=bzl-visibility +load("@rules_rust//crate_universe/private:crates_vendor.bzl", "crates_vendor_remote_repository") + +def crate_repositories(): + """Generates repositories for vendored crates. + + Returns: + A list of repos visible to the module through the module extension. + """ + maybe( + crates_vendor_remote_repository, + name = "rules_rust_cargo_toml_info", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.bazel"), + defs_module = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:defs.bzl"), + ) + + direct_deps = [struct(repo = "rules_rust_cargo_toml_info", is_dev_dep = False)] + direct_deps.extend(_crate_repositories()) + return direct_deps diff --git a/cargo/cargo_toml_info/3rdparty/crates/defs.bzl b/cargo/cargo_toml_info/3rdparty/crates/defs.bzl new file mode 100644 index 0000000000..366041b71b --- /dev/null +++ b/cargo/cargo_toml_info/3rdparty/crates/defs.bzl @@ -0,0 +1,568 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +############################################################################### +""" +# `crates_repository` API + +- [aliases](#aliases) +- [crate_deps](#crate_deps) +- [all_crate_deps](#all_crate_deps) +- [crate_repositories](#crate_repositories) + +""" + +load("@bazel_skylib//lib:selects.bzl", "selects") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +############################################################################### +# MACROS API +############################################################################### + +# An identifier that represent common dependencies (unconditional). +_COMMON_CONDITION = "" + +def _flatten_dependency_maps(all_dependency_maps): + """Flatten a list of dependency maps into one dictionary. + + Dependency maps have the following structure: + + ```python + DEPENDENCIES_MAP = { + # The first key in the map is a Bazel package + # name of the workspace this file is defined in. + "workspace_member_package": { + + # Not all dependencies are supported for all platforms. + # the condition key is the condition required to be true + # on the host platform. + "condition": { + + # An alias to a crate target. # The label of the crate target the + # Aliases are only crate names. # package name refers to. + "package_name": "@full//:label", + } + } + } + ``` + + Args: + all_dependency_maps (list): A list of dicts as described above + + Returns: + dict: A dictionary as described above + """ + dependencies = {} + + for workspace_deps_map in all_dependency_maps: + for pkg_name, conditional_deps_map in workspace_deps_map.items(): + if pkg_name not in dependencies: + non_frozen_map = dict() + for key, values in conditional_deps_map.items(): + non_frozen_map.update({key: dict(values.items())}) + dependencies.setdefault(pkg_name, non_frozen_map) + continue + + for condition, deps_map in conditional_deps_map.items(): + # If the condition has not been recorded, do so and continue + if condition not in dependencies[pkg_name]: + dependencies[pkg_name].setdefault(condition, dict(deps_map.items())) + continue + + # Alert on any miss-matched dependencies + inconsistent_entries = [] + for crate_name, crate_label in deps_map.items(): + existing = dependencies[pkg_name][condition].get(crate_name) + if existing and existing != crate_label: + inconsistent_entries.append((crate_name, existing, crate_label)) + dependencies[pkg_name][condition].update({crate_name: crate_label}) + + return dependencies + +def crate_deps(deps, package_name = None): + """Finds the fully qualified label of the requested crates for the package where this macro is called. + + Args: + deps (list): The desired list of crate targets. + package_name (str, optional): The package name of the set of dependencies to look up. + Defaults to `native.package_name()`. + + Returns: + list: A list of labels to generated rust targets (str) + """ + + if not deps: + return [] + + if package_name == None: + package_name = native.package_name() + + # Join both sets of dependencies + dependencies = _flatten_dependency_maps([ + _NORMAL_DEPENDENCIES, + _NORMAL_DEV_DEPENDENCIES, + _PROC_MACRO_DEPENDENCIES, + _PROC_MACRO_DEV_DEPENDENCIES, + _BUILD_DEPENDENCIES, + _BUILD_PROC_MACRO_DEPENDENCIES, + ]).pop(package_name, {}) + + # Combine all conditional packages so we can easily index over a flat list + # TODO: Perhaps this should actually return select statements and maintain + # the conditionals of the dependencies + flat_deps = {} + for deps_set in dependencies.values(): + for crate_name, crate_label in deps_set.items(): + flat_deps.update({crate_name: crate_label}) + + missing_crates = [] + crate_targets = [] + for crate_target in deps: + if crate_target not in flat_deps: + missing_crates.append(crate_target) + else: + crate_targets.append(flat_deps[crate_target]) + + if missing_crates: + fail("Could not find crates `{}` among dependencies of `{}`. Available dependencies were `{}`".format( + missing_crates, + package_name, + dependencies, + )) + + return crate_targets + +def all_crate_deps( + normal = False, + normal_dev = False, + proc_macro = False, + proc_macro_dev = False, + build = False, + build_proc_macro = False, + package_name = None): + """Finds the fully qualified label of all requested direct crate dependencies \ + for the package where this macro is called. + + If no parameters are set, all normal dependencies are returned. Setting any one flag will + otherwise impact the contents of the returned list. + + Args: + normal (bool, optional): If True, normal dependencies are included in the + output list. + normal_dev (bool, optional): If True, normal dev dependencies will be + included in the output list.. + proc_macro (bool, optional): If True, proc_macro dependencies are included + in the output list. + proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are + included in the output list. + build (bool, optional): If True, build dependencies are included + in the output list. + build_proc_macro (bool, optional): If True, build proc_macro dependencies are + included in the output list. + package_name (str, optional): The package name of the set of dependencies to look up. + Defaults to `native.package_name()` when unset. + + Returns: + list: A list of labels to generated rust targets (str) + """ + + if package_name == None: + package_name = native.package_name() + + # Determine the relevant maps to use + all_dependency_maps = [] + if normal: + all_dependency_maps.append(_NORMAL_DEPENDENCIES) + if normal_dev: + all_dependency_maps.append(_NORMAL_DEV_DEPENDENCIES) + if proc_macro: + all_dependency_maps.append(_PROC_MACRO_DEPENDENCIES) + if proc_macro_dev: + all_dependency_maps.append(_PROC_MACRO_DEV_DEPENDENCIES) + if build: + all_dependency_maps.append(_BUILD_DEPENDENCIES) + if build_proc_macro: + all_dependency_maps.append(_BUILD_PROC_MACRO_DEPENDENCIES) + + # Default to always using normal dependencies + if not all_dependency_maps: + all_dependency_maps.append(_NORMAL_DEPENDENCIES) + + dependencies = _flatten_dependency_maps(all_dependency_maps).pop(package_name, None) + + if not dependencies: + if dependencies == None: + fail("Tried to get all_crate_deps for package " + package_name + " but that package had no Cargo.toml file") + else: + return [] + + crate_deps = list(dependencies.pop(_COMMON_CONDITION, {}).values()) + for condition, deps in dependencies.items(): + crate_deps += selects.with_or({ + tuple(_CONDITIONS[condition]): deps.values(), + "//conditions:default": [], + }) + + return crate_deps + +def aliases( + normal = False, + normal_dev = False, + proc_macro = False, + proc_macro_dev = False, + build = False, + build_proc_macro = False, + package_name = None): + """Produces a map of Crate alias names to their original label + + If no dependency kinds are specified, `normal` and `proc_macro` are used by default. + Setting any one flag will otherwise determine the contents of the returned dict. + + Args: + normal (bool, optional): If True, normal dependencies are included in the + output list. + normal_dev (bool, optional): If True, normal dev dependencies will be + included in the output list.. + proc_macro (bool, optional): If True, proc_macro dependencies are included + in the output list. + proc_macro_dev (bool, optional): If True, dev proc_macro dependencies are + included in the output list. + build (bool, optional): If True, build dependencies are included + in the output list. + build_proc_macro (bool, optional): If True, build proc_macro dependencies are + included in the output list. + package_name (str, optional): The package name of the set of dependencies to look up. + Defaults to `native.package_name()` when unset. + + Returns: + dict: The aliases of all associated packages + """ + if package_name == None: + package_name = native.package_name() + + # Determine the relevant maps to use + all_aliases_maps = [] + if normal: + all_aliases_maps.append(_NORMAL_ALIASES) + if normal_dev: + all_aliases_maps.append(_NORMAL_DEV_ALIASES) + if proc_macro: + all_aliases_maps.append(_PROC_MACRO_ALIASES) + if proc_macro_dev: + all_aliases_maps.append(_PROC_MACRO_DEV_ALIASES) + if build: + all_aliases_maps.append(_BUILD_ALIASES) + if build_proc_macro: + all_aliases_maps.append(_BUILD_PROC_MACRO_ALIASES) + + # Default to always using normal aliases + if not all_aliases_maps: + all_aliases_maps.append(_NORMAL_ALIASES) + all_aliases_maps.append(_PROC_MACRO_ALIASES) + + aliases = _flatten_dependency_maps(all_aliases_maps).pop(package_name, None) + + if not aliases: + return dict() + + common_items = aliases.pop(_COMMON_CONDITION, {}).items() + + # If there are only common items in the dictionary, immediately return them + if not len(aliases.keys()) == 1: + return dict(common_items) + + # Build a single select statement where each conditional has accounted for the + # common set of aliases. + crate_aliases = {"//conditions:default": dict(common_items)} + for condition, deps in aliases.items(): + condition_triples = _CONDITIONS[condition] + for triple in condition_triples: + if triple in crate_aliases: + crate_aliases[triple].update(deps) + else: + crate_aliases.update({triple: dict(deps.items() + common_items)}) + + return select(crate_aliases) + +############################################################################### +# WORKSPACE MEMBER DEPS AND ALIASES +############################################################################### + +_NORMAL_DEPENDENCIES = { + "": { + _COMMON_CONDITION: { + "cargo_toml": Label("@rules_rust_cargo_toml_info__cargo_toml-0.20.5//:cargo_toml"), + }, + }, +} + +_NORMAL_ALIASES = { + "": { + _COMMON_CONDITION: { + }, + }, +} + +_NORMAL_DEV_DEPENDENCIES = { + "": { + }, +} + +_NORMAL_DEV_ALIASES = { + "": { + }, +} + +_PROC_MACRO_DEPENDENCIES = { + "": { + }, +} + +_PROC_MACRO_ALIASES = { + "": { + }, +} + +_PROC_MACRO_DEV_DEPENDENCIES = { + "": { + }, +} + +_PROC_MACRO_DEV_ALIASES = { + "": { + }, +} + +_BUILD_DEPENDENCIES = { + "": { + }, +} + +_BUILD_ALIASES = { + "": { + }, +} + +_BUILD_PROC_MACRO_DEPENDENCIES = { + "": { + }, +} + +_BUILD_PROC_MACRO_ALIASES = { + "": { + }, +} + +_CONDITIONS = { + "aarch64-apple-darwin": ["@rules_rust//rust/platform:aarch64-apple-darwin"], + "aarch64-apple-ios": ["@rules_rust//rust/platform:aarch64-apple-ios"], + "aarch64-apple-ios-sim": ["@rules_rust//rust/platform:aarch64-apple-ios-sim"], + "aarch64-linux-android": ["@rules_rust//rust/platform:aarch64-linux-android"], + "aarch64-pc-windows-msvc": ["@rules_rust//rust/platform:aarch64-pc-windows-msvc"], + "aarch64-unknown-fuchsia": ["@rules_rust//rust/platform:aarch64-unknown-fuchsia"], + "aarch64-unknown-linux-gnu": ["@rules_rust//rust/platform:aarch64-unknown-linux-gnu"], + "aarch64-unknown-nixos-gnu": ["@rules_rust//rust/platform:aarch64-unknown-nixos-gnu"], + "aarch64-unknown-nto-qnx710": ["@rules_rust//rust/platform:aarch64-unknown-nto-qnx710"], + "arm-unknown-linux-gnueabi": ["@rules_rust//rust/platform:arm-unknown-linux-gnueabi"], + "armv7-linux-androideabi": ["@rules_rust//rust/platform:armv7-linux-androideabi"], + "armv7-unknown-linux-gnueabi": ["@rules_rust//rust/platform:armv7-unknown-linux-gnueabi"], + "i686-apple-darwin": ["@rules_rust//rust/platform:i686-apple-darwin"], + "i686-linux-android": ["@rules_rust//rust/platform:i686-linux-android"], + "i686-pc-windows-msvc": ["@rules_rust//rust/platform:i686-pc-windows-msvc"], + "i686-unknown-freebsd": ["@rules_rust//rust/platform:i686-unknown-freebsd"], + "i686-unknown-linux-gnu": ["@rules_rust//rust/platform:i686-unknown-linux-gnu"], + "powerpc-unknown-linux-gnu": ["@rules_rust//rust/platform:powerpc-unknown-linux-gnu"], + "riscv32imc-unknown-none-elf": ["@rules_rust//rust/platform:riscv32imc-unknown-none-elf"], + "riscv64gc-unknown-none-elf": ["@rules_rust//rust/platform:riscv64gc-unknown-none-elf"], + "s390x-unknown-linux-gnu": ["@rules_rust//rust/platform:s390x-unknown-linux-gnu"], + "thumbv7em-none-eabi": ["@rules_rust//rust/platform:thumbv7em-none-eabi"], + "thumbv8m.main-none-eabi": ["@rules_rust//rust/platform:thumbv8m.main-none-eabi"], + "wasm32-unknown-unknown": ["@rules_rust//rust/platform:wasm32-unknown-unknown"], + "wasm32-wasi": ["@rules_rust//rust/platform:wasm32-wasi"], + "wasm32-wasip1": ["@rules_rust//rust/platform:wasm32-wasip1"], + "x86_64-apple-darwin": ["@rules_rust//rust/platform:x86_64-apple-darwin"], + "x86_64-apple-ios": ["@rules_rust//rust/platform:x86_64-apple-ios"], + "x86_64-linux-android": ["@rules_rust//rust/platform:x86_64-linux-android"], + "x86_64-pc-windows-msvc": ["@rules_rust//rust/platform:x86_64-pc-windows-msvc"], + "x86_64-unknown-freebsd": ["@rules_rust//rust/platform:x86_64-unknown-freebsd"], + "x86_64-unknown-fuchsia": ["@rules_rust//rust/platform:x86_64-unknown-fuchsia"], + "x86_64-unknown-linux-gnu": ["@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], + "x86_64-unknown-nixos-gnu": ["@rules_rust//rust/platform:x86_64-unknown-nixos-gnu"], + "x86_64-unknown-none": ["@rules_rust//rust/platform:x86_64-unknown-none"], +} + +############################################################################### + +def crate_repositories(): + """A macro for defining repositories for all generated crates. + + Returns: + A list of repos visible to the module through the module extension. + """ + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__cargo_toml-0.20.5", + sha256 = "88da5a13c620b4ca0078845707ea9c3faf11edbc3ffd8497d11d686211cd1ac0", + type = "tar.gz", + urls = ["https://static.crates.io/crates/cargo_toml/0.20.5/download"], + strip_prefix = "cargo_toml-0.20.5", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.cargo_toml-0.20.5.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__equivalent-1.0.1", + sha256 = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5", + type = "tar.gz", + urls = ["https://static.crates.io/crates/equivalent/1.0.1/download"], + strip_prefix = "equivalent-1.0.1", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.equivalent-1.0.1.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__hashbrown-0.15.1", + sha256 = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3", + type = "tar.gz", + urls = ["https://static.crates.io/crates/hashbrown/0.15.1/download"], + strip_prefix = "hashbrown-0.15.1", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.hashbrown-0.15.1.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__indexmap-2.6.0", + sha256 = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da", + type = "tar.gz", + urls = ["https://static.crates.io/crates/indexmap/2.6.0/download"], + strip_prefix = "indexmap-2.6.0", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.indexmap-2.6.0.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__memchr-2.7.4", + sha256 = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3", + type = "tar.gz", + urls = ["https://static.crates.io/crates/memchr/2.7.4/download"], + strip_prefix = "memchr-2.7.4", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.memchr-2.7.4.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__proc-macro2-1.0.89", + sha256 = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e", + type = "tar.gz", + urls = ["https://static.crates.io/crates/proc-macro2/1.0.89/download"], + strip_prefix = "proc-macro2-1.0.89", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.proc-macro2-1.0.89.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__quote-1.0.37", + sha256 = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af", + type = "tar.gz", + urls = ["https://static.crates.io/crates/quote/1.0.37/download"], + strip_prefix = "quote-1.0.37", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.quote-1.0.37.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__serde-1.0.214", + sha256 = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5", + type = "tar.gz", + urls = ["https://static.crates.io/crates/serde/1.0.214/download"], + strip_prefix = "serde-1.0.214", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.serde-1.0.214.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__serde_derive-1.0.214", + sha256 = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766", + type = "tar.gz", + urls = ["https://static.crates.io/crates/serde_derive/1.0.214/download"], + strip_prefix = "serde_derive-1.0.214", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.serde_derive-1.0.214.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__serde_spanned-0.6.8", + sha256 = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1", + type = "tar.gz", + urls = ["https://static.crates.io/crates/serde_spanned/0.6.8/download"], + strip_prefix = "serde_spanned-0.6.8", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.serde_spanned-0.6.8.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__syn-2.0.87", + sha256 = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d", + type = "tar.gz", + urls = ["https://static.crates.io/crates/syn/2.0.87/download"], + strip_prefix = "syn-2.0.87", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.syn-2.0.87.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__toml-0.8.19", + sha256 = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e", + type = "tar.gz", + urls = ["https://static.crates.io/crates/toml/0.8.19/download"], + strip_prefix = "toml-0.8.19", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.toml-0.8.19.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__toml_datetime-0.6.8", + sha256 = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41", + type = "tar.gz", + urls = ["https://static.crates.io/crates/toml_datetime/0.6.8/download"], + strip_prefix = "toml_datetime-0.6.8", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.toml_datetime-0.6.8.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__toml_edit-0.22.22", + sha256 = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5", + type = "tar.gz", + urls = ["https://static.crates.io/crates/toml_edit/0.22.22/download"], + strip_prefix = "toml_edit-0.22.22", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.toml_edit-0.22.22.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__unicode-ident-1.0.13", + sha256 = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe", + type = "tar.gz", + urls = ["https://static.crates.io/crates/unicode-ident/1.0.13/download"], + strip_prefix = "unicode-ident-1.0.13", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.unicode-ident-1.0.13.bazel"), + ) + + maybe( + http_archive, + name = "rules_rust_cargo_toml_info__winnow-0.6.20", + sha256 = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b", + type = "tar.gz", + urls = ["https://static.crates.io/crates/winnow/0.6.20/download"], + strip_prefix = "winnow-0.6.20", + build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.winnow-0.6.20.bazel"), + ) + + return [ + struct(repo = "rules_rust_cargo_toml_info__cargo_toml-0.20.5", is_dev_dep = False), + ] diff --git a/cargo/cargo_toml_info/BUILD.bazel b/cargo/cargo_toml_info/BUILD.bazel new file mode 100644 index 0000000000..41e023c5e1 --- /dev/null +++ b/cargo/cargo_toml_info/BUILD.bazel @@ -0,0 +1,11 @@ +"""BUILD file for cargo info helper binary.""" + +load("//rust:defs.bzl", "rust_binary") + +rust_binary( + name = "cargo_toml_info", + srcs = ["main.rs"], + edition = "2021", + visibility = ["//visibility:public"], + deps = ["//cargo/cargo_toml_info/3rdparty/crates:cargo_toml"], +) diff --git a/cargo/cargo_toml_info/Cargo.lock b/cargo/cargo_toml_info/Cargo.lock new file mode 100644 index 0000000000..104e19a662 --- /dev/null +++ b/cargo/cargo_toml_info/Cargo.lock @@ -0,0 +1,155 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cargo_toml" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88da5a13c620b4ca0078845707ea9c3faf11edbc3ffd8497d11d686211cd1ac0" +dependencies = [ + "serde", + "toml", +] + +[[package]] +name = "cargo_toml_info" +version = "0.1.0" +dependencies = [ + "cargo_toml", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "hashbrown" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] diff --git a/cargo/cargo_toml_info/Cargo.toml b/cargo/cargo_toml_info/Cargo.toml new file mode 100644 index 0000000000..70c769d07e --- /dev/null +++ b/cargo/cargo_toml_info/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "cargo_toml_info" +version = "0.1.0" +edition = "2021" + +[dependencies] +cargo_toml = "0.20.5" + +[[bin]] +name = "cargo_toml_info" +path = "main.rs" diff --git a/cargo/cargo_toml_info/main.rs b/cargo/cargo_toml_info/main.rs new file mode 100644 index 0000000000..4a0b306b06 --- /dev/null +++ b/cargo/cargo_toml_info/main.rs @@ -0,0 +1,272 @@ +//! Command line tool invoked by Bazel to read metadata out of a `Cargo.toml` file. +//! +//! This tool should _not_ be used to determine dependencies, features, or generally any build +//! information for a crate, that should live in crate_universe. This tool is intended to read +//! non-build related Cargo metadata like lints, authors, or badges. + +use cargo_toml::{Lint, LintLevel, Manifest}; + +use std::borrow::Cow; +use std::collections::BTreeMap; +use std::error::Error; +use std::fs::File; +use std::io::{LineWriter, Write}; +use std::path::PathBuf; + +pub fn main() -> Result<(), Box> { + let Args { + manifest_toml, + workspace_toml, + command, + } = Args::try_from(std::env::args())?; + + let manifest_contents = std::fs::read_to_string(&manifest_toml)?; + let mut crate_manifest = Manifest::from_str(&manifest_contents)?; + let mut workspace_manifest = None; + + // Optionally populate the manifest with info from the parent workspace, if one is provided. + if let Some(workspace_path) = workspace_toml { + let manifest = Manifest::from_path(&workspace_path)?; + let workspace_details = Some((&manifest, workspace_path.as_path())); + + // TODO(parkmycar): Fix cargo_toml so we inherit lints from our workspace. + crate_manifest.complete_from_path_and_workspace(&manifest_toml, workspace_details)?; + workspace_manifest = Some(manifest); + } + + match command { + Command::Lints(args) => { + generate_lints_info(&crate_manifest, workspace_manifest.as_ref(), args)? + } + } + + Ok(()) +} + +#[derive(Debug)] +struct LintsArgs { + output_rustc_lints: PathBuf, + output_clippy_lints: PathBuf, + output_rustdoc_lints: PathBuf, + // TODO(parkmycar): Support Rust's new --check-cfg once cargo-toml is updated. + #[allow(dead_code)] + output_rustc_check_cfg: PathBuf, +} + +enum LintGroup { + Rustc, + RustCheckCfg, + Clippy, + RustDoc, +} + +impl LintGroup { + pub fn key(&self) -> &'static str { + match self { + LintGroup::Rustc => "rust", + LintGroup::RustCheckCfg => "check-cfg", + LintGroup::Clippy => "clippy", + LintGroup::RustDoc => "rustdoc", + } + } + + /// Format a lint `name` and `level` for this [`LintGroup`]. + pub fn format_cli_arg(&self, name: &str, level: LintLevel) -> String { + let level = match level { + LintLevel::Allow => "allow", + LintLevel::Warn => "warn", + LintLevel::Forbid => "forbid", + LintLevel::Deny => "deny", + }; + + match self { + LintGroup::Rustc => format!("--{level}={name}"), + LintGroup::Clippy => format!("--{level}=clippy::{name}"), + LintGroup::RustDoc => format!("--{level}=rustdoc::{name}"), + // TODO: Support check-cfg once cargo_toml supports it. + LintGroup::RustCheckCfg => "".to_string(), + } + } +} + +/// Generates space seperated files that get read back in by Bazel. +fn generate_lints_info( + crate_manifest: &Manifest, + workspace_manifest: Option<&Manifest>, + args: LintsArgs, +) -> Result<(), Box> { + fn format_lint_set<'g, 'l: 'g>( + lints: &'l BTreeMap>, + group: &'g LintGroup, + ) -> Option + 'g> { + let lints = lints.get(group.key())?; + + let formatted = lints.iter().map(|(name, lint)| { + let level = match lint { + cargo_toml::Lint::Detailed { level, priority: _ } => level, + cargo_toml::Lint::Simple(level) => level, + }; + group.format_cli_arg(name, *level) + }); + + Some(formatted) + } + + let LintsArgs { + output_rustc_lints, + output_rustc_check_cfg, + output_clippy_lints, + output_rustdoc_lints, + } = args; + + let groups = [ + (LintGroup::Rustc, output_rustc_lints), + (LintGroup::Clippy, output_clippy_lints), + (LintGroup::RustDoc, output_rustdoc_lints), + (LintGroup::RustCheckCfg, output_rustc_check_cfg), + ]; + + let lints = match &crate_manifest.lints { + Some(lints) if lints.workspace => { + let workspace = workspace_manifest + .as_ref() + .and_then(|manifest| manifest.workspace.as_ref()) + .ok_or_else(|| { + "manifest inherits lints from the workspace, but no workspace manifest provided" + })?; + workspace.lints.as_ref() + } + Some(lints) => Some(&lints.groups), + None => None, + }; + let Some(lints) = lints else { + return Ok(()); + }; + + for (group, path) in groups { + let file = File::create(&path)?; + let mut writer = LineWriter::new(file); + + if let Some(args) = format_lint_set(&lints, &group) { + for arg in args { + writeln!(&mut writer, "{arg}")?; + } + }; + + writer.flush()?; + } + + Ok(()) +} + +#[derive(Debug)] +struct Args { + manifest_toml: PathBuf, + workspace_toml: Option, + command: Command, +} + +impl TryFrom for Args { + type Error = Cow<'static, str>; + + fn try_from(mut args: std::env::Args) -> Result { + let _binary_path = args + .next() + .ok_or_else::, _>(|| "provided 0 arguments?".into())?; + + let mut args = args.peekable(); + + // We get at least 'manifest-toml', and optionally a 'workspace-toml'. + let manifest_raw_arg = args + .next() + .ok_or(Cow::Borrowed("expected at least one arg"))?; + let manifest_toml = + try_parse_named_arg(&manifest_raw_arg, "manifest_toml").map(PathBuf::from)?; + let workspace_toml = args + .peek() + .and_then(|arg| try_parse_named_arg(&arg, "workspace_toml").ok()) + .map(PathBuf::from); + // If we got a workspace_toml arg make sure to consume it. + if workspace_toml.is_some() { + args.next(); + } + + // Use the remaining arguments to parse our command. + let command = Command::try_from(RemainingArgs(args))?; + + Ok(Args { + manifest_toml, + workspace_toml, + command, + }) + } +} + +/// Tries to parse the value from a named arg. +fn try_parse_named_arg<'a, 'n>(arg: &'a str, name: &'n str) -> Result<&'a str, String> { + arg.strip_prefix(&format!("--{name}=")) + .ok_or_else(|| format!("expected --{name}=, found '{arg}'")) +} + +/// Arguments that are remaining after parsing the path to the `Cargo.toml`. +struct RemainingArgs(std::iter::Peekable); + +#[derive(Debug)] +enum Command { + /// Expects 4 filesystem paths in this order: + /// + /// 1. output for rustc lints + /// 2. output for rust check-cfg lints + /// 3. output for clippy lints + /// 4. output for rustdoc lints + /// + Lints(LintsArgs), +} + +impl TryFrom for Command { + type Error = Cow<'static, str>; + + fn try_from(args: RemainingArgs) -> Result { + let RemainingArgs(args) = args; + let mut args = args.peekable(); + + let action = args + .next() + .ok_or_else::, _>(|| "expected an action".into())?; + + match action.to_lowercase().as_str() { + "lints" => { + let output_rustc_lints = args + .next() + .map(PathBuf::from) + .ok_or(Cow::Borrowed("expected output path for rustc lints"))?; + let output_rustc_check_cfg = args + .next() + .map(PathBuf::from) + .ok_or(Cow::Borrowed("expected output path for rustc check-cfg"))?; + let output_clippy_lints = args + .next() + .map(PathBuf::from) + .ok_or(Cow::Borrowed("expected output path for clippy lints"))?; + let output_rustdoc_lints = args + .next() + .map(PathBuf::from) + .ok_or(Cow::Borrowed("expected output path for rustdoc lints"))?; + + if args.peek().is_some() { + let remaining: Vec = args.collect(); + let msg = format!("expected end of arguments, found: {remaining:?}"); + return Err(Cow::Owned(msg)); + } + + Ok(Command::Lints(LintsArgs { + output_rustc_lints, + output_rustc_check_cfg, + output_clippy_lints, + output_rustdoc_lints, + })) + } + other => Err(format!("unknown action: {other}").into()), + } + } +} diff --git a/cargo/defs.bzl b/cargo/defs.bzl index 1588a6c7c4..587cc79c03 100644 --- a/cargo/defs.bzl +++ b/cargo/defs.bzl @@ -13,9 +13,15 @@ load( "//cargo/private:cargo_dep_env.bzl", _cargo_dep_env = "cargo_dep_env", ) +load( + "//cargo/private:cargo_lints.bzl", + _cargo_lints = "cargo_lints", +) cargo_bootstrap_repository = _cargo_bootstrap_repository cargo_env = _cargo_env cargo_build_script = _cargo_build_script cargo_dep_env = _cargo_dep_env + +cargo_lints = _cargo_lints diff --git a/cargo/private/cargo_lints.bzl b/cargo/private/cargo_lints.bzl new file mode 100644 index 0000000000..eac7667c11 --- /dev/null +++ b/cargo/private/cargo_lints.bzl @@ -0,0 +1,73 @@ +""" +Rule used to retrieve the lints specified in the [lints section] of a `Cargo.toml`. + +[lints section](https://doc.rust-lang.org/cargo/reference/manifest.html#the-lints-section) +""" + +load("//rust/private:providers.bzl", "LintsInfo") + +def _cargo_lints(ctx): + # Cargo.toml's to read from. + inputs = [ctx.file.manifest] + args = ctx.actions.args() + + args.add("--manifest_toml={0}".format(ctx.file.manifest.path)) + if ctx.attr.workspace: + inputs.append(ctx.file.workspace) + args.add("--workspace_toml={0}".format(ctx.file.workspace.path)) + args.add("lints") + + # Files to output our formatted arguments into. + rustc_lints_out = ctx.actions.declare_file(ctx.label.name + ".rustc" + ".lints") + rustc_check_cfg_out = ctx.actions.declare_file(ctx.label.name + ".rustc_check_cfg" + ".lints") + clippy_lints_out = ctx.actions.declare_file(ctx.label.name + ".clippy" + ".lints") + rustdoc_lints_out = ctx.actions.declare_file(ctx.label.name + ".rustdoc" + ".lints") + + args.add(rustc_lints_out) + args.add(rustc_check_cfg_out) + args.add(clippy_lints_out) + args.add(rustdoc_lints_out) + + outputs = [rustc_lints_out, rustc_check_cfg_out, clippy_lints_out, rustdoc_lints_out] + + ctx.actions.run( + outputs = outputs, + executable = ctx.file._cargo_toml_info, + inputs = inputs, + arguments = [args], + mnemonic = "CargoLints", + progress_message = "Reading Cargo metadata to get Lints for {}".format(ctx.attr.name), + ) + + return [ + DefaultInfo(files = depset(outputs), runfiles = ctx.runfiles(outputs)), + LintsInfo( + rustc_lints = [], + rustc_lint_files = [rustc_lints_out], + clippy_lints = [], + clippy_lint_files = [clippy_lints_out], + rustdoc_lints = [], + rustdoc_lint_files = [rustdoc_lints_out], + ) + ] + +cargo_lints = rule( + implementation = _cargo_lints, + attrs = { + "manifest": attr.label( + allow_single_file = True, + mandatory = True, + doc = "Cargo.toml to read lints from.", + ), + "workspace": attr.label( + allow_single_file = True, + doc = "Workspace Cargo.toml that the manifest Cargo.toml inherits from.", + ), + "_cargo_toml_info": attr.label( + allow_single_file = True, + executable = True, + default = "@rules_rust//cargo/cargo_toml_info", + cfg = "exec", + ), + }, +) diff --git a/examples/bzlmod/hello_world/MODULE.bazel.lock b/examples/bzlmod/hello_world/MODULE.bazel.lock index 7c3eb0db32..8457a1a14b 100644 --- a/examples/bzlmod/hello_world/MODULE.bazel.lock +++ b/examples/bzlmod/hello_world/MODULE.bazel.lock @@ -64,8 +64,8 @@ "https://bcr.bazel.build/modules/rules_go/0.39.1/source.json": "f21e042154010ae2c944ab230d572b17d71cdb27c5255806d61df6ccaed4354c", "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86", - "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", - "https://bcr.bazel.build/modules/rules_java/7.6.1/source.json": "8f3f3076554e1558e8e468b2232991c510ecbcbed9e6f8c06ac31c93bcf38362", + "https://bcr.bazel.build/modules/rules_java/7.6.5/MODULE.bazel": "481164be5e02e4cab6e77a36927683263be56b7e36fef918b458d7a8a1ebadb1", + "https://bcr.bazel.build/modules/rules_java/7.6.5/source.json": "a805b889531d1690e3c72a7a7e47a870d00323186a9904b36af83aa3d053ee8d", "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", @@ -92,8 +92,8 @@ "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/source.json": "f1ef7d3f9e0e26d4b23d1c39b5f5de71f584dd7d1b4ef83d9bbba6ec7a6a6459", "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", - "https://bcr.bazel.build/modules/zlib/1.3/MODULE.bazel": "6a9c02f19a24dcedb05572b2381446e27c272cd383aed11d41d99da9e3167a72", - "https://bcr.bazel.build/modules/zlib/1.3/source.json": "b6b43d0737af846022636e6e255fd4a96fee0d34f08f3830e6e0bac51465c37c" + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.3/MODULE.bazel": "af322bc08976524477c79d1e45e241b6efbeb918c497e8840b8ab116802dda79", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.3/source.json": "2be409ac3c7601245958cd4fcdff4288be79ed23bd690b4b951f500d54ee6e7d" }, "selectedYankedVersions": {}, "moduleExtensions": { diff --git a/rust/private/clippy.bzl b/rust/private/clippy.bzl index 014326d390..a9ccc5e858 100644 --- a/rust/private/clippy.bzl +++ b/rust/private/clippy.bzl @@ -105,6 +105,13 @@ def _clippy_aspect_impl(target, ctx): aliases = crate_info.aliases, ) + # Gather the necessary rust flags to apply lints, if they were provided. + clippy_flags = [] + lint_files = [] + if hasattr(ctx.rule.attr, "lints"): + clippy_flags = clippy_flags + ctx.rule.attr.lints[LintsInfo].clippy_lints + lint_files = lint_files + ctx.rule.attr.lints[LintsInfo].clippy_lint_files + compile_inputs, out_dir, build_env_files, build_flags_files, linkstamp_outs, ambiguous_libs = collect_inputs( ctx, ctx.rule.file, @@ -117,6 +124,7 @@ def _clippy_aspect_impl(target, ctx): crate_info, dep_info, build_info, + lint_files, ) args, env = construct_arguments( @@ -143,12 +151,6 @@ def _clippy_aspect_impl(target, ctx): if crate_info.is_test: args.rustc_flags.add("--test") - clippy_flags = [] - - # First append the clippy flags from the target itself. - if hasattr(ctx.rule.attr, "lints"): - clippy_flags = clippy_flags + ctx.rule.attr.lints[LintsInfo].clippy_lints - # Then append the clippy flags specified from the command line, so they override what is # specified on the library. clippy_flags = clippy_flags + ctx.attr._clippy_flags[ClippyFlagsInfo].clippy_flags diff --git a/rust/private/lints.bzl b/rust/private/lints.bzl index e197918117..9d6f19ad5f 100644 --- a/rust/private/lints.bzl +++ b/rust/private/lints.bzl @@ -41,8 +41,11 @@ def _rust_lint_group(ctx): return LintsInfo( rustc_lints = rustc_flags, + rustc_lint_files = [], clippy_lints = clippy_flags, + clippy_lint_files = [], rustdoc_lints = rustdoc_flags, + rustdoc_lint_files = [], ) rust_lint_group = rule( diff --git a/rust/private/providers.bzl b/rust/private/providers.bzl index 3b9ddde789..f387469572 100644 --- a/rust/private/providers.bzl +++ b/rust/private/providers.bzl @@ -179,7 +179,10 @@ LintsInfo = provider( doc = "LintsInfo holds the 'allow', 'warn', etc. config for rustc, clippy, and rustdoc lints.", fields = { "rustc_lints": "List[String]: rustc flags to specify when building rust_* targets.", + "rustc_lint_files": "List[File]: list of files with rustc flags to specify when building rust_* targets.", "clippy_lints": "List[String]: rustc flags to specify when building clippy targets.", + "clippy_lint_files": "List[File]: files with rustc args for clippy targets.", "rustdoc_lints": "List[String]: rustc flags to specify when building rust_doc targets.", + "rustdoc_lint_files": "List[File]: files with rustc args for rustdoc target.", }, ) diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index 64fb369f76..b9c408858e 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -23,7 +23,7 @@ load( "CPP_LINK_STATIC_LIBRARY_ACTION_NAME", ) load("//rust/private:common.bzl", "rust_common") -load("//rust/private:providers.bzl", "RustcOutputDiagnosticsInfo", _BuildInfo = "BuildInfo", "LintsInfo") +load("//rust/private:providers.bzl", "LintsInfo", "RustcOutputDiagnosticsInfo", _BuildInfo = "BuildInfo") load("//rust/private:stamp.bzl", "is_stamping_enabled") load( "//rust/private:utils.bzl", @@ -636,6 +636,7 @@ def collect_inputs( crate_info, dep_info, build_info, + lint_files, stamp = False, force_depend_on_objects = False, experimental_use_cc_common_link = False, @@ -653,6 +654,7 @@ def collect_inputs( crate_info (CrateInfo): The Crate information of the crate to process build scripts for. dep_info (DepInfo): The target Crate's dependency information. build_info (BuildInfo): The target Crate's build settings. + lint_files (list): List of files with rustc args for the Crate's lint settings. stamp (bool, optional): Whether or not workspace status stamping is enabled. For more details see https://docs.bazel.build/versions/main/user-manual.html#flag--stamp force_depend_on_objects (bool, optional): Forces dependencies of this rule to be objects rather than @@ -775,13 +777,16 @@ def collect_inputs( dep_info = dep_info, include_link_flags = include_link_flags, ) + # TODO(parkmycar): Cleanup the handling of lint_files here. + if lint_files: + build_flags_files = depset(lint_files, transitive = [build_flags_files]) # For backwards compatibility, we also check the value of the `rustc_env_files` attribute when # `crate_info.rustc_env_files` is not populated. build_env_files = crate_info.rustc_env_files if crate_info.rustc_env_files else getattr(files, "rustc_env_files", []) if build_env_file: build_env_files = [f for f in build_env_files] + [build_env_file] - compile_inputs = depset(build_env_files, transitive = [build_script_compile_inputs, compile_inputs]) + compile_inputs = depset(build_env_files + lint_files, transitive = [build_script_compile_inputs, compile_inputs]) return compile_inputs, out_dir, build_env_files, build_flags_files, linkstamp_outs, ambiguous_libs def construct_arguments( @@ -1184,8 +1189,10 @@ def rustc_compile_action( stamp = is_stamping_enabled(attr) # Add flags for any 'rustc' lints that are specified. + lint_files = [] if hasattr(ctx.attr, "lints") and ctx.attr.lints: rust_flags = rust_flags + ctx.attr.lints[LintsInfo].rustc_lints + lint_files = lint_files + ctx.attr.lints[LintsInfo].rustc_lint_files compile_inputs, out_dir, build_env_files, build_flags_files, linkstamp_outs, ambiguous_libs = collect_inputs( ctx = ctx, @@ -1198,6 +1205,7 @@ def rustc_compile_action( crate_info = crate_info, dep_info = dep_info, build_info = build_info, + lint_files = lint_files, stamp = stamp, experimental_use_cc_common_link = experimental_use_cc_common_link, ) diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl index 73b187b9be..d1fc4ce999 100644 --- a/rust/private/rustdoc.bzl +++ b/rust/private/rustdoc.bzl @@ -52,6 +52,7 @@ def rustdoc_compile_action( ctx, toolchain, crate_info, + lints_info = None, output = None, rustdoc_flags = [], is_test = False): @@ -61,6 +62,7 @@ def rustdoc_compile_action( ctx (ctx): The rule's context object. toolchain (rust_toolchain): The currently configured `rust_toolchain`. crate_info (CrateInfo): The provider of the crate passed to a rustdoc rule. + lints_info (LintsInfo, optional): The LintsInfo provider of the crate passed to the rustdoc rule. output (File, optional): An optional output a `rustdoc` action is intended to produce. rustdoc_flags (list, optional): A list of `rustdoc` specific flags. is_test (bool, optional): If True, the action will be configured for `rust_doc_test` targets @@ -76,6 +78,12 @@ def rustdoc_compile_action( output.path, ] + rustdoc_flags + # Specify rustc flags for lints, if they were provided. + lint_files = [] + if lints_info: + rustdoc_flags = rustdoc_flags + lints_info.rustdoc_lints + lint_files = lint_files + lints_info.rustdoc_lint_files + cc_toolchain, feature_configuration = find_cc_toolchain(ctx) dep_info, build_info, _ = collect_deps( @@ -95,6 +103,7 @@ def rustdoc_compile_action( crate_info = crate_info, dep_info = dep_info, build_info = build_info, + lint_files = lint_files, # If this is a rustdoc test, we need to depend on rlibs rather than .rmeta. force_depend_on_objects = is_test, include_link_flags = False, @@ -187,11 +196,7 @@ def _rust_doc_impl(ctx): crate = ctx.attr.crate crate_info = crate[rust_common.crate_info] - - if LintsInfo in crate: - rustdoc_lints = crate[LintsInfo].rustdoc_lints - else: - rustdoc_lints = [] + lints_info = crate[LintsInfo] if LintsInfo in crate else None output_dir = ctx.actions.declare_directory("{}.rustdoc".format(ctx.label.name)) @@ -200,14 +205,13 @@ def _rust_doc_impl(ctx): "--extern", "{}={}".format(crate_info.name, crate_info.output.path), ] - rustdoc_flags.extend(ctx.attr.rustdoc_flags) - rustdoc_flags.extend(rustdoc_lints) action = rustdoc_compile_action( ctx = ctx, toolchain = find_toolchain(ctx), crate_info = crate_info, + lints_info = lints_info, output = output_dir, rustdoc_flags = rustdoc_flags, ) From 1a1703bffc193866c4ed1bfaac3e0720b6fbfddb Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Mon, 18 Nov 2024 09:22:50 -0500 Subject: [PATCH 3/4] responding to GitHub feedback * rename fields on the LintsInfo provider * rename some methods * add comments linking to cargo_toml issues * move the cargo_toml_info binary into private --- WORKSPACE.bazel | 2 +- cargo/private/cargo_lints.bzl | 8 ++--- .../cargo_toml_info/3rdparty/BUILD.bazel | 0 .../cargo_toml_info/3rdparty/Cargo.Bazel.lock | 0 .../3rdparty/crates/BUILD.bazel | 2 +- .../crates/BUILD.cargo_toml-0.20.5.bazel | 2 +- .../crates/BUILD.equivalent-1.0.1.bazel | 2 +- .../crates/BUILD.hashbrown-0.15.1.bazel | 2 +- .../crates/BUILD.indexmap-2.6.0.bazel | 2 +- .../3rdparty/crates/BUILD.memchr-2.7.4.bazel | 2 +- .../crates/BUILD.proc-macro2-1.0.89.bazel | 2 +- .../3rdparty/crates/BUILD.quote-1.0.37.bazel | 2 +- .../3rdparty/crates/BUILD.serde-1.0.214.bazel | 2 +- .../crates/BUILD.serde_derive-1.0.214.bazel | 2 +- .../crates/BUILD.serde_spanned-0.6.8.bazel | 2 +- .../3rdparty/crates/BUILD.syn-2.0.87.bazel | 2 +- .../3rdparty/crates/BUILD.toml-0.8.19.bazel | 2 +- .../crates/BUILD.toml_datetime-0.6.8.bazel | 2 +- .../crates/BUILD.toml_edit-0.22.22.bazel | 2 +- .../crates/BUILD.unicode-ident-1.0.13.bazel | 2 +- .../3rdparty/crates/BUILD.winnow-0.6.20.bazel | 2 +- .../3rdparty/crates/alias_rules.bzl | 0 .../3rdparty/crates/crates.bzl | 6 ++-- .../cargo_toml_info/3rdparty/crates/defs.bzl | 34 +++++++++---------- .../{ => private}/cargo_toml_info/BUILD.bazel | 2 +- .../{ => private}/cargo_toml_info/Cargo.lock | 0 .../{ => private}/cargo_toml_info/Cargo.toml | 0 cargo/{ => private}/cargo_toml_info/main.rs | 4 +++ rust/defs.bzl | 4 +-- rust/private/clippy.bzl | 2 +- rust/private/lints.bzl | 18 +++++----- rust/private/providers.bzl | 6 ++-- rust/private/rust.bzl | 2 +- rust/private/rustc.bzl | 5 +-- rust/private/rustdoc.bzl | 2 +- 35 files changed, 67 insertions(+), 62 deletions(-) rename cargo/{ => private}/cargo_toml_info/3rdparty/BUILD.bazel (100%) rename cargo/{ => private}/cargo_toml_info/3rdparty/Cargo.Bazel.lock (100%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.bazel (92%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel (97%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel (97%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel (97%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel (98%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel (97%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel (97%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/alias_rules.bzl (100%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/crates.bzl (76%) rename cargo/{ => private}/cargo_toml_info/3rdparty/crates/defs.bzl (91%) rename cargo/{ => private}/cargo_toml_info/BUILD.bazel (74%) rename cargo/{ => private}/cargo_toml_info/Cargo.lock (100%) rename cargo/{ => private}/cargo_toml_info/Cargo.toml (100%) rename cargo/{ => private}/cargo_toml_info/main.rs (98%) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 14d238e412..ad209c0c4c 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -14,7 +14,7 @@ load("//crate_universe/tools/cross_installer:cross_installer_deps.bzl", "cross_i cross_installer_deps() -load("//cargo/cargo_toml_info/3rdparty/crates:defs.bzl", cargo_toml_info_crate_repositories = "crate_repositories") +load("//cargo/private/cargo_toml_info/3rdparty/crates:defs.bzl", cargo_toml_info_crate_repositories = "crate_repositories") cargo_toml_info_crate_repositories() diff --git a/cargo/private/cargo_lints.bzl b/cargo/private/cargo_lints.bzl index eac7667c11..f8fdb9887a 100644 --- a/cargo/private/cargo_lints.bzl +++ b/cargo/private/cargo_lints.bzl @@ -42,11 +42,11 @@ def _cargo_lints(ctx): return [ DefaultInfo(files = depset(outputs), runfiles = ctx.runfiles(outputs)), LintsInfo( - rustc_lints = [], + rustc_lint_flags = [], rustc_lint_files = [rustc_lints_out], - clippy_lints = [], + clippy_lint_flags = [], clippy_lint_files = [clippy_lints_out], - rustdoc_lints = [], + rustdoc_lint_flags = [], rustdoc_lint_files = [rustdoc_lints_out], ) ] @@ -66,7 +66,7 @@ cargo_lints = rule( "_cargo_toml_info": attr.label( allow_single_file = True, executable = True, - default = "@rules_rust//cargo/cargo_toml_info", + default = "@rules_rust//cargo/private/cargo_toml_info", cfg = "exec", ), }, diff --git a/cargo/cargo_toml_info/3rdparty/BUILD.bazel b/cargo/private/cargo_toml_info/3rdparty/BUILD.bazel similarity index 100% rename from cargo/cargo_toml_info/3rdparty/BUILD.bazel rename to cargo/private/cargo_toml_info/3rdparty/BUILD.bazel diff --git a/cargo/cargo_toml_info/3rdparty/Cargo.Bazel.lock b/cargo/private/cargo_toml_info/3rdparty/Cargo.Bazel.lock similarity index 100% rename from cargo/cargo_toml_info/3rdparty/Cargo.Bazel.lock rename to cargo/private/cargo_toml_info/3rdparty/Cargo.Bazel.lock diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.bazel similarity index 92% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.bazel index ee497fa6b2..b9846dd62b 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### package(default_visibility = ["//visibility:public"]) diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel index fd63e4721a..b8df07b842 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.cargo_toml-0.20.5.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel similarity index 97% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel index 92489d00a3..1c4b46d6ee 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.equivalent-1.0.1.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel similarity index 97% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel index 2bc68a7fdb..17d835d431 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.hashbrown-0.15.1.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel index d3ebfefcf8..004a60e17e 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.indexmap-2.6.0.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel similarity index 97% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel index 3a9f06b28e..d8da326d8a 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.memchr-2.7.4.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel index f136748fad..280cf68c0c 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.proc-macro2-1.0.89.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//cargo:defs.bzl", "cargo_build_script") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel index f6ab4a5259..a991bf0e0f 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.quote-1.0.37.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel index e9bb53c3e3..cb9abf424b 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde-1.0.214.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//cargo:defs.bzl", "cargo_build_script") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel index 94ec29a416..52d2f01aee 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde_derive-1.0.214.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_proc_macro") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel index 0046d2d1d7..207a7614e7 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.serde_spanned-0.6.8.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel index 988bcae957..5e12861a41 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.syn-2.0.87.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel index e66c7f6e6a..a03ed625e7 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml-0.8.19.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel index 4bb359c1a5..60b6e20ddb 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml_datetime-0.6.8.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel similarity index 98% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel index 0c3016f6e9..5fbebefefb 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.toml_edit-0.22.22.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel similarity index 97% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel index cb072d2fe4..31a7729297 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.unicode-ident-1.0.13.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel similarity index 97% rename from cargo/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel rename to cargo/private/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel index 8cb45dd591..78c127f3ed 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel +++ b/cargo/private/cargo_toml_info/3rdparty/crates/BUILD.winnow-0.6.20.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/cargo/cargo_toml_info/3rdparty/crates/alias_rules.bzl b/cargo/private/cargo_toml_info/3rdparty/crates/alias_rules.bzl similarity index 100% rename from cargo/cargo_toml_info/3rdparty/crates/alias_rules.bzl rename to cargo/private/cargo_toml_info/3rdparty/crates/alias_rules.bzl diff --git a/cargo/cargo_toml_info/3rdparty/crates/crates.bzl b/cargo/private/cargo_toml_info/3rdparty/crates/crates.bzl similarity index 76% rename from cargo/cargo_toml_info/3rdparty/crates/crates.bzl rename to cargo/private/cargo_toml_info/3rdparty/crates/crates.bzl index a06faea827..1d2ac583b4 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/crates.bzl +++ b/cargo/private/cargo_toml_info/3rdparty/crates/crates.bzl @@ -9,7 +9,7 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # buildifier: disable=bzl-visibility -load("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:defs.bzl", _crate_repositories = "crate_repositories") +load("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:defs.bzl", _crate_repositories = "crate_repositories") # buildifier: disable=bzl-visibility load("@rules_rust//crate_universe/private:crates_vendor.bzl", "crates_vendor_remote_repository") @@ -23,8 +23,8 @@ def crate_repositories(): maybe( crates_vendor_remote_repository, name = "rules_rust_cargo_toml_info", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.bazel"), - defs_module = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:defs.bzl"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.bazel"), + defs_module = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:defs.bzl"), ) direct_deps = [struct(repo = "rules_rust_cargo_toml_info", is_dev_dep = False)] diff --git a/cargo/cargo_toml_info/3rdparty/crates/defs.bzl b/cargo/private/cargo_toml_info/3rdparty/crates/defs.bzl similarity index 91% rename from cargo/cargo_toml_info/3rdparty/crates/defs.bzl rename to cargo/private/cargo_toml_info/3rdparty/crates/defs.bzl index 366041b71b..3e7e3ffea0 100644 --- a/cargo/cargo_toml_info/3rdparty/crates/defs.bzl +++ b/cargo/private/cargo_toml_info/3rdparty/crates/defs.bzl @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//cargo/cargo_toml_info/3rdparty:crates_vendor +# bazel run @//cargo/private/cargo_toml_info/3rdparty:crates_vendor ############################################################################### """ # `crates_repository` API @@ -410,7 +410,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/cargo_toml/0.20.5/download"], strip_prefix = "cargo_toml-0.20.5", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.cargo_toml-0.20.5.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.cargo_toml-0.20.5.bazel"), ) maybe( @@ -420,7 +420,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/equivalent/1.0.1/download"], strip_prefix = "equivalent-1.0.1", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.equivalent-1.0.1.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.equivalent-1.0.1.bazel"), ) maybe( @@ -430,7 +430,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/hashbrown/0.15.1/download"], strip_prefix = "hashbrown-0.15.1", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.hashbrown-0.15.1.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.hashbrown-0.15.1.bazel"), ) maybe( @@ -440,7 +440,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/indexmap/2.6.0/download"], strip_prefix = "indexmap-2.6.0", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.indexmap-2.6.0.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.indexmap-2.6.0.bazel"), ) maybe( @@ -450,7 +450,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/memchr/2.7.4/download"], strip_prefix = "memchr-2.7.4", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.memchr-2.7.4.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.memchr-2.7.4.bazel"), ) maybe( @@ -460,7 +460,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/proc-macro2/1.0.89/download"], strip_prefix = "proc-macro2-1.0.89", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.proc-macro2-1.0.89.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.proc-macro2-1.0.89.bazel"), ) maybe( @@ -470,7 +470,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/quote/1.0.37/download"], strip_prefix = "quote-1.0.37", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.quote-1.0.37.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.quote-1.0.37.bazel"), ) maybe( @@ -480,7 +480,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/serde/1.0.214/download"], strip_prefix = "serde-1.0.214", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.serde-1.0.214.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.serde-1.0.214.bazel"), ) maybe( @@ -490,7 +490,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/serde_derive/1.0.214/download"], strip_prefix = "serde_derive-1.0.214", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.serde_derive-1.0.214.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.serde_derive-1.0.214.bazel"), ) maybe( @@ -500,7 +500,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/serde_spanned/0.6.8/download"], strip_prefix = "serde_spanned-0.6.8", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.serde_spanned-0.6.8.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.serde_spanned-0.6.8.bazel"), ) maybe( @@ -510,7 +510,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/syn/2.0.87/download"], strip_prefix = "syn-2.0.87", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.syn-2.0.87.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.syn-2.0.87.bazel"), ) maybe( @@ -520,7 +520,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/toml/0.8.19/download"], strip_prefix = "toml-0.8.19", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.toml-0.8.19.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.toml-0.8.19.bazel"), ) maybe( @@ -530,7 +530,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/toml_datetime/0.6.8/download"], strip_prefix = "toml_datetime-0.6.8", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.toml_datetime-0.6.8.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.toml_datetime-0.6.8.bazel"), ) maybe( @@ -540,7 +540,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/toml_edit/0.22.22/download"], strip_prefix = "toml_edit-0.22.22", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.toml_edit-0.22.22.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.toml_edit-0.22.22.bazel"), ) maybe( @@ -550,7 +550,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/unicode-ident/1.0.13/download"], strip_prefix = "unicode-ident-1.0.13", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.unicode-ident-1.0.13.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.unicode-ident-1.0.13.bazel"), ) maybe( @@ -560,7 +560,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/winnow/0.6.20/download"], strip_prefix = "winnow-0.6.20", - build_file = Label("@rules_rust//cargo/cargo_toml_info/3rdparty/crates:BUILD.winnow-0.6.20.bazel"), + build_file = Label("@rules_rust//cargo/private/cargo_toml_info/3rdparty/crates:BUILD.winnow-0.6.20.bazel"), ) return [ diff --git a/cargo/cargo_toml_info/BUILD.bazel b/cargo/private/cargo_toml_info/BUILD.bazel similarity index 74% rename from cargo/cargo_toml_info/BUILD.bazel rename to cargo/private/cargo_toml_info/BUILD.bazel index 41e023c5e1..8cd5c2ba61 100644 --- a/cargo/cargo_toml_info/BUILD.bazel +++ b/cargo/private/cargo_toml_info/BUILD.bazel @@ -7,5 +7,5 @@ rust_binary( srcs = ["main.rs"], edition = "2021", visibility = ["//visibility:public"], - deps = ["//cargo/cargo_toml_info/3rdparty/crates:cargo_toml"], + deps = ["//cargo/private/cargo_toml_info/3rdparty/crates:cargo_toml"], ) diff --git a/cargo/cargo_toml_info/Cargo.lock b/cargo/private/cargo_toml_info/Cargo.lock similarity index 100% rename from cargo/cargo_toml_info/Cargo.lock rename to cargo/private/cargo_toml_info/Cargo.lock diff --git a/cargo/cargo_toml_info/Cargo.toml b/cargo/private/cargo_toml_info/Cargo.toml similarity index 100% rename from cargo/cargo_toml_info/Cargo.toml rename to cargo/private/cargo_toml_info/Cargo.toml diff --git a/cargo/cargo_toml_info/main.rs b/cargo/private/cargo_toml_info/main.rs similarity index 98% rename from cargo/cargo_toml_info/main.rs rename to cargo/private/cargo_toml_info/main.rs index 4a0b306b06..528683b82a 100644 --- a/cargo/cargo_toml_info/main.rs +++ b/cargo/private/cargo_toml_info/main.rs @@ -30,6 +30,8 @@ pub fn main() -> Result<(), Box> { let workspace_details = Some((&manifest, workspace_path.as_path())); // TODO(parkmycar): Fix cargo_toml so we inherit lints from our workspace. + // + // See: crate_manifest.complete_from_path_and_workspace(&manifest_toml, workspace_details)?; workspace_manifest = Some(manifest); } @@ -49,6 +51,8 @@ struct LintsArgs { output_clippy_lints: PathBuf, output_rustdoc_lints: PathBuf, // TODO(parkmycar): Support Rust's new --check-cfg once cargo-toml is updated. + // + // See: #[allow(dead_code)] output_rustc_check_cfg: PathBuf, } diff --git a/rust/defs.bzl b/rust/defs.bzl index 42f866ff19..2e6e88982d 100644 --- a/rust/defs.bzl +++ b/rust/defs.bzl @@ -73,7 +73,7 @@ load( ) load( "//rust/private:lints.bzl", - _rust_lint_group = "rust_lint_group", + _rust_lint_config = "rust_lint_config", ) rust_library = _rust_library @@ -161,7 +161,7 @@ rustfmt_test = _rustfmt_test rust_stdlib_filegroup = _rust_stdlib_filegroup # See @rules_rust//rust:toolchain.bzl for a complete description. -rust_lint_group = _rust_lint_group +rust_lint_config = _rust_lint_config # See @rules_rust//private:lint.bzl for a complete description. no_std = _no_std diff --git a/rust/private/clippy.bzl b/rust/private/clippy.bzl index a9ccc5e858..8cb05f9ade 100644 --- a/rust/private/clippy.bzl +++ b/rust/private/clippy.bzl @@ -109,7 +109,7 @@ def _clippy_aspect_impl(target, ctx): clippy_flags = [] lint_files = [] if hasattr(ctx.rule.attr, "lints"): - clippy_flags = clippy_flags + ctx.rule.attr.lints[LintsInfo].clippy_lints + clippy_flags = clippy_flags + ctx.rule.attr.lints[LintsInfo].clippy_lint_flags lint_files = lint_files + ctx.rule.attr.lints[LintsInfo].clippy_lint_files compile_inputs, out_dir, build_env_files, build_flags_files, linkstamp_outs, ambiguous_libs = collect_inputs( diff --git a/rust/private/lints.bzl b/rust/private/lints.bzl index 9d6f19ad5f..525b887c7b 100644 --- a/rust/private/lints.bzl +++ b/rust/private/lints.bzl @@ -2,8 +2,8 @@ load("//rust/private:providers.bzl", "LintsInfo") -def _rust_lint_group(ctx): - """Implementation of the `rust_lint_group` rule. +def _rust_lint_config(ctx): + """Implementation of the `rust_lint_config` rule. Args: ctx (ctx): The rule's context object. @@ -40,16 +40,16 @@ def _rust_lint_group(ctx): rustdoc_flags.append("--{LEVEL}=rustdoc::{LINT}".format(LEVEL = level, LINT = lint)) return LintsInfo( - rustc_lints = rustc_flags, + rustc_lint_flags = rustc_flags, rustc_lint_files = [], - clippy_lints = clippy_flags, + clippy_lint_flags = clippy_flags, clippy_lint_files = [], - rustdoc_lints = rustdoc_flags, + rustdoc_lint_flags = rustdoc_flags, rustdoc_lint_files = [], ) -rust_lint_group = rule( - implementation = _rust_lint_group, +rust_lint_config = rule( + implementation = _rust_lint_config, attrs = { "rustc": attr.string_dict( doc = "Set of 'rustc' lints to 'allow', 'expect', 'warn', 'force-warn', 'deny', or 'forbid'.", @@ -70,9 +70,9 @@ Defines a group of lints that can be applied when building Rust targets. For example, you can define a single group of lints: ```python -load("@rules_rust//rust:defs.bzl", "rust_lint_group") +load("@rules_rust//rust:defs.bzl", "rust_lint_config") -rust_lint_group( +rust_lint_config( name = "workspace_lints", rustc = { "unknown_lints": "allow", diff --git a/rust/private/providers.bzl b/rust/private/providers.bzl index f387469572..e50c73873e 100644 --- a/rust/private/providers.bzl +++ b/rust/private/providers.bzl @@ -178,11 +178,11 @@ RustAnalyzerGroupInfo = provider( LintsInfo = provider( doc = "LintsInfo holds the 'allow', 'warn', etc. config for rustc, clippy, and rustdoc lints.", fields = { - "rustc_lints": "List[String]: rustc flags to specify when building rust_* targets.", + "rustc_lint_flags": "List[String]: rustc flags to specify when building rust_* targets.", "rustc_lint_files": "List[File]: list of files with rustc flags to specify when building rust_* targets.", - "clippy_lints": "List[String]: rustc flags to specify when building clippy targets.", + "clippy_lint_flags": "List[String]: rustc flags to specify when building clippy targets.", "clippy_lint_files": "List[File]: files with rustc args for clippy targets.", - "rustdoc_lints": "List[String]: rustc flags to specify when building rust_doc targets.", + "rustdoc_lints_flags": "List[String]: rustc flags to specify when building rust_doc targets.", "rustdoc_lint_files": "List[File]: files with rustc args for rustdoc target.", }, ) diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl index 53a41e8d46..3a7aa49942 100644 --- a/rust/private/rust.bzl +++ b/rust/private/rust.bzl @@ -645,7 +645,7 @@ _common_attrs = { linking a native library. """), ), - "lints": attr.label( + "lint_config": attr.label( doc = "Set of lints to apply when building this crate.", providers = [LintsInfo], ), diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index b9c408858e..8746be5a58 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -777,6 +777,7 @@ def collect_inputs( dep_info = dep_info, include_link_flags = include_link_flags, ) + # TODO(parkmycar): Cleanup the handling of lint_files here. if lint_files: build_flags_files = depset(lint_files, transitive = [build_flags_files]) @@ -1191,7 +1192,7 @@ def rustc_compile_action( # Add flags for any 'rustc' lints that are specified. lint_files = [] if hasattr(ctx.attr, "lints") and ctx.attr.lints: - rust_flags = rust_flags + ctx.attr.lints[LintsInfo].rustc_lints + rust_flags = rust_flags + ctx.attr.lints[LintsInfo].rustc_lint_flags lint_files = lint_files + ctx.attr.lints[LintsInfo].rustc_lint_files compile_inputs, out_dir, build_env_files, build_flags_files, linkstamp_outs, ambiguous_libs = collect_inputs( @@ -1550,7 +1551,7 @@ def rustc_compile_action( if output_group_info: providers.append(OutputGroupInfo(**output_group_info)) - + # A bit unfortunate, but sidecar the lints info so rustdoc can access the # set of lints from the target it is documenting. if hasattr(ctx.attr, "lints") and ctx.attr.lints: diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl index d1fc4ce999..c055eee1f7 100644 --- a/rust/private/rustdoc.bzl +++ b/rust/private/rustdoc.bzl @@ -81,7 +81,7 @@ def rustdoc_compile_action( # Specify rustc flags for lints, if they were provided. lint_files = [] if lints_info: - rustdoc_flags = rustdoc_flags + lints_info.rustdoc_lints + rustdoc_flags = rustdoc_flags + lints_info.rustdoc_lint_flags lint_files = lint_files + lints_info.rustdoc_lint_files cc_toolchain, feature_configuration = find_cc_toolchain(ctx) From dc2b46afa885cda2ed1e9f990debf8f9244ec371 Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Mon, 18 Nov 2024 09:23:46 -0500 Subject: [PATCH 4/4] rename cargo_lints to extract_cargo_lints --- cargo/defs.bzl | 4 ++-- cargo/private/cargo_lints.bzl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cargo/defs.bzl b/cargo/defs.bzl index 587cc79c03..2fb0516714 100644 --- a/cargo/defs.bzl +++ b/cargo/defs.bzl @@ -15,7 +15,7 @@ load( ) load( "//cargo/private:cargo_lints.bzl", - _cargo_lints = "cargo_lints", + _extract_cargo_lints = "extract_cargo_lints", ) cargo_bootstrap_repository = _cargo_bootstrap_repository @@ -24,4 +24,4 @@ cargo_env = _cargo_env cargo_build_script = _cargo_build_script cargo_dep_env = _cargo_dep_env -cargo_lints = _cargo_lints +extract_cargo_lints = _extract_cargo_lints diff --git a/cargo/private/cargo_lints.bzl b/cargo/private/cargo_lints.bzl index f8fdb9887a..4e5cdc1cf2 100644 --- a/cargo/private/cargo_lints.bzl +++ b/cargo/private/cargo_lints.bzl @@ -6,7 +6,7 @@ Rule used to retrieve the lints specified in the [lints section] of a `Cargo.tom load("//rust/private:providers.bzl", "LintsInfo") -def _cargo_lints(ctx): +def _extract_cargo_lints(ctx): # Cargo.toml's to read from. inputs = [ctx.file.manifest] args = ctx.actions.args() @@ -51,8 +51,8 @@ def _cargo_lints(ctx): ) ] -cargo_lints = rule( - implementation = _cargo_lints, +extract_cargo_lints = rule( + implementation = _extract_cargo_lints, attrs = { "manifest": attr.label( allow_single_file = True,