Skip to content

Add support for --compile_one_dependency #2598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down