Skip to content

Add 'build_script_exec_properties' to 'crate.annotation'#3852

Merged
illicitonion merged 2 commits intobazelbuild:mainfrom
alloveras:main
Feb 19, 2026
Merged

Add 'build_script_exec_properties' to 'crate.annotation'#3852
illicitonion merged 2 commits intobazelbuild:mainfrom
alloveras:main

Conversation

@alloveras
Copy link
Copy Markdown
Contributor

@alloveras alloveras commented Feb 13, 2026

Intent

To allow specifying exec_properties via crate.annotation.

Problem

The current implementation allows tweaking a few of the attributes that get generated for the cargo_build_script rule, but, unfortunately, not the exec_properties.

My current use case for which I want to be able to specify exec_properties is a semi-large build script that gets performance benefits from running on machines with multiple CPUs. If you are not using remote execution, it essentially boils down to whatever hardware you have available locally. However, if RBE is available, being able to set exec_properties = {"Pool": "<pool-with-powerful-hardware>"} allows you to specifically steer these build actions to the machines that you want to run them on.

Solution

To extend the current cargo-bazel code along with the relevant Starlark code to make it possible to specify exec_properties for the generated cargo_build_script rules.

@alloveras alloveras changed the title Extend crate.annotation to support 'exec_properties' Extend crate.annotation to support 'build_script_exec_properties' Feb 13, 2026
@alloveras alloveras changed the title Extend crate.annotation to support 'build_script_exec_properties' Add 'build_script_exec_properties' to 'crate.annotation' Feb 13, 2026
@alloveras
Copy link
Copy Markdown
Contributor Author

alloveras commented Feb 13, 2026

I think I have to run some magic command(s) to update the lockfile checksums, but I couldn't find the correct incantation anywhere 😢 Otherwise, CI fails complaining about the checksum mismatch.

I tried CARGO_BAZEL_REPIN=1 bazel test //... but that didnt' seem to help, unfortunately. Will try ./util/repin_all.sh and report back.

Edit: It seems like running ./util/repin_all.sh did the trick 🎉

Copy link
Copy Markdown
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, thanks!

@illicitonion illicitonion added this pull request to the merge queue Feb 19, 2026
Merged via the queue into bazelbuild:main with commit 854770e Feb 19, 2026
3 checks passed
dzbarsky pushed a commit to hermeticbuild/rules_rust that referenced this pull request Feb 20, 2026
…3852)

## Intent
To allow specifying
[`exec_properties`](https://bazel.build/reference/be/common-definitions#common.exec_properties)
via
[`crate.annotation`](https://bazelbuild.github.io/rules_rust/crate_universe_bzlmod.html#annotation).

## Problem
The current implementation allows tweaking a few of the attributes that
get generated for the `cargo_build_script` rule, but, unfortunately, not
the `exec_properties`.

My current use case for which I want to be able to specify
`exec_properties` is a semi-large build script that gets performance
benefits from running on machines with multiple CPUs. If you are not
using remote execution, it essentially boils down to whatever hardware
you have available locally. However, if RBE is available, being able to
set `exec_properties = {"Pool": "<pool-with-powerful-hardware>"}` allows
you to specifically steer these build actions to the machines that you
want to run them on.

## Solution
To extend the current `cargo-bazel` code along with the relevant
Starlark code to make it possible to specify `exec_properties` for the
generated `cargo_build_script` rules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants