Skip to content

Commit

Permalink
fix final lints, adjust how users add dependencies for cargo_toml_info
Browse files Browse the repository at this point in the history
* fix visiblity by moving cargo_toml_info dependencies into cargo/deps.bzl
* small changes to appease the liner
  • Loading branch information
ParkMyCar committed Dec 1, 2024
1 parent cde68ac commit 8c811fe
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ load("//crate_universe/tools/cross_installer:cross_installer_deps.bzl", "cross_i

cross_installer_deps()

load("//cargo/private/cargo_toml_info/3rdparty/crates:defs.bzl", cargo_toml_info_crate_repositories = "crate_repositories")
load("@rules_rust//cargo:deps.bzl", "cargo_dependencies")

cargo_toml_info_crate_repositories()
cargo_dependencies()

load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")

Expand Down
9 changes: 9 additions & 0 deletions cargo/deps.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
The dependencies for running the cargo_toml_info binary.
"""

load("//cargo/private/cargo_toml_info/3rdparty/crates:defs.bzl", "crate_repositories")

def cargo_dependencies():
"""Define dependencies of the `cargo` Bazel tools"""
return crate_repositories()
1 change: 1 addition & 0 deletions cargo/private/cargo_lints.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Rule used to retrieve the lints specified in the [lints section] of a `Cargo.tom
[lints section](https://doc.rust-lang.org/cargo/reference/manifest.html#the-lints-section)
"""

# buildifier: disable=bzl-visibility
load("//rust/private:providers.bzl", "LintsInfo")

def _extract_cargo_lints(ctx):
Expand Down
1 change: 1 addition & 0 deletions rust/private/lints.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _rust_lint_config(ctx):
rustdoc_lint_files = [],
)

# buildifier: disable=unsorted-dict-items
rust_lint_config = rule(
implementation = _rust_lint_config,
attrs = {
Expand Down
8 changes: 4 additions & 4 deletions rust/private/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ RustAnalyzerGroupInfo = provider(
LintsInfo = provider(
doc = "LintsInfo holds the 'allow', 'warn', etc. config for rustc, clippy, and rustdoc lints.",
fields = {
"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_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_lint_flags": "List[String]: rustc flags to specify when building rust_doc targets.",
"clippy_lint_flags": "List[String]: rustc flags to specify when building clippy targets.",
"rustc_lint_files": "List[File]: list of files with rustc flags to specify when building rust_* targets.",
"rustc_lint_flags": "List[String]: rustc flags to specify when building rust_* targets.",
"rustdoc_lint_files": "List[File]: files with rustc args for rustdoc target.",
"rustdoc_lint_flags": "List[String]: rustc flags to specify when building rust_doc targets.",
},
)
6 changes: 3 additions & 3 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,13 @@ _common_attrs = {
linking a native library.
"""),
),
"edition": attr.string(
doc = "The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain.",
),
"lint_config": 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.",
),
# Previously `proc_macro_deps` were a part of `deps`, and then proc_macro_host_transition was
# used into cfg="host" using `@local_config_platform//:host`.
# This fails for remote execution, which needs cfg="exec", and there isn't anything like
Expand Down

0 comments on commit 8c811fe

Please sign in to comment.