From 097e7da0ffc8003b9ce2a149699133f55a101653 Mon Sep 17 00:00:00 2001 From: William Smith Date: Mon, 1 Apr 2024 09:46:32 -0700 Subject: [PATCH 1/2] Add support for --compile_one_dependency. --- rust/private/rust.bzl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl index f77098e1ae..8a23228f7a 100644 --- a/rust/private/rust.bzl +++ b/rust/private/rust.bzl @@ -679,6 +679,10 @@ _common_attrs = { is the root of the crate to be passed to rustc to build this crate. """), allow_files = [".rs"], + # Allow use of --compile_one_dependency with rust targets. Support for this feature for + # non-builtin rulesets is undocumented outside of the bazel source: + # https://github.com/bazelbuild/bazel/blob/7.1.1/src/main/java/com/google/devtools/build/lib/packages/Attribute.java#L102 + flags = ["DIRECT_COMPILE_TIME_INPUT"], ), "stamp": _stamp_attribute( default_value = 0, From 1887eeac47b463d98369f94a77b4459a2a78c614 Mon Sep 17 00:00:00 2001 From: William Smith Date: Tue, 2 Apr 2024 10:51:49 -0700 Subject: [PATCH 2/2] Add test for --compile_one_dependency --- .bazelci/presubmit.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 9560bb114b..f2efed5cb8 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -690,6 +690,13 @@ tasks: working_directory: examples/bzlmod/hello_world_no_cargo build_targets: - "//..." + compile_one_dependency: + name: --compile_one_dependency flag + platform: ubuntu2004 + build_flags: + - "--compile_one_dependency" + build_targets: + - "tools/rust_analyzer/main.rs" buildifier: version: latest