Skip to content

Commit

Permalink
migration: include incompatible_use_toolchain_transition globally (#628)
Browse files Browse the repository at this point in the history
This is step 2 of
https://github.com/bazelbuild/proposals/blob/master/designs/2020-02-07-toolchain-transition-migration.md,
and was requested by someone at work. We'll eventually want to drop
this (see step 9), but for now this enables more-correct behavior
around toolchain transitions.

Co-authored-by: Augie Fackler <augie@google.com>
Co-authored-by: Marcel Hlopko <hlopko@google.com>
  • Loading branch information
3 people committed Mar 9, 2021
1 parent 2de6496 commit 881d93a
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions bindgen/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ rust_bindgen = rule(
str(Label("//bindgen:bindgen_toolchain")),
str(Label("//rust:toolchain")),
],
incompatible_use_toolchain_transition = True,
)

def _rust_bindgen_toolchain_impl(ctx):
Expand Down
1 change: 1 addition & 0 deletions cargo/cargo_build_script.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ _build_script_run = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
)

def cargo_build_script(
Expand Down
1 change: 1 addition & 0 deletions proto/proto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ rust_proto_library = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = """\
Builds a Rust library crate from a set of `proto_library`s.
Expand Down
1 change: 1 addition & 0 deletions rust/private/clippy.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ rust_clippy_aspect = aspect(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
implementation = _clippy_aspect_impl,
doc = """\
Executes the clippy checker on specified targets.
Expand Down
8 changes: 8 additions & 0 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ rust_library = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust library crate.
Expand Down Expand Up @@ -739,6 +740,7 @@ rust_static_library = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust static library.
Expand All @@ -761,6 +763,7 @@ rust_shared_library = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust shared library.
Expand All @@ -783,6 +786,7 @@ rust_proc_macro = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust proc-macro crate.
"""),
Expand All @@ -809,6 +813,7 @@ rust_binary = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust binary crate.
Expand Down Expand Up @@ -907,6 +912,7 @@ rust_test = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust test crate.
Expand Down Expand Up @@ -1055,6 +1061,7 @@ rust_test_binary = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust test binary, without marking this rule as a Bazel test.
Expand All @@ -1078,6 +1085,7 @@ rust_benchmark = rule(
str(Label("//rust:toolchain")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
doc = _tidy("""\
Builds a Rust benchmark test.
Expand Down
2 changes: 2 additions & 0 deletions rust/private/rust_analyzer.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ rust_analyzer_aspect = aspect(
attr_aspects = ["deps", "proc_macro_deps"],
implementation = _rust_analyzer_aspect_impl,
toolchains = [str(Label("//rust:toolchain"))],
incompatible_use_toolchain_transition = True,
doc = "Annotates rust rules with RustAnalyzerInfo later used to build a rust-project.json",
)

Expand Down Expand Up @@ -216,5 +217,6 @@ rust_analyzer = rule(
},
implementation = _rust_project_impl,
toolchains = [str(Label("//rust:toolchain"))],
incompatible_use_toolchain_transition = True,
doc = "Produces a rust-project.json for the given targets. Configure rust-analyzer to load the generated file via the linked projects mechanism.",
)
1 change: 1 addition & 0 deletions rust/private/rustdoc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,5 @@ rust_doc = rule(
"rust_doc_zip": "%{name}.zip",
},
toolchains = [str(Label("//rust:toolchain"))],
incompatible_use_toolchain_transition = True,
)
1 change: 1 addition & 0 deletions rust/private/rustdoc_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ rust_doc_test = rule(
executable = True,
test = True,
toolchains = [str(Label("//rust:toolchain"))],
incompatible_use_toolchain_transition = True,
doc = """Runs Rust documentation tests.
Example:
Expand Down
1 change: 1 addition & 0 deletions test/rustfmt/rustfmt_generator.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ rustfmt_generator = rule(
toolchains = [
str(Label("//rust:toolchain")),
],
incompatible_use_toolchain_transition = True,
)
1 change: 1 addition & 0 deletions wasm_bindgen/wasm_bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ rust_wasm_bindgen = rule(
toolchains = [
str(Label("//wasm_bindgen:wasm_bindgen_toolchain")),
],
incompatible_use_toolchain_transition = True,
)

def _rust_wasm_bindgen_toolchain_impl(ctx):
Expand Down

0 comments on commit 881d93a

Please sign in to comment.