Skip to content

cargo_build_script: allow files for the fake tools defaults#3822

Merged
hlopko merged 4 commits intobazelbuild:mainfrom
krasimirgg:cbts
Jan 29, 2026
Merged

cargo_build_script: allow files for the fake tools defaults#3822
hlopko merged 4 commits intobazelbuild:mainfrom
krasimirgg:cbts

Conversation

@krasimirgg
Copy link
Collaborator

@krasimirgg krasimirgg commented Jan 23, 2026

No functional changes intended.

These fallback tools were always built. Internally, we're running these in context where they will always be provided by the c++ toolchain and they end up being built in many different blaze configurations.

I've updated it so that the fallbacks attributes are allowed to be None with an extra check in the rule to ensure they are non-null if a cc toolchain is unavailable.

@krasimirgg krasimirgg requested a review from hlopko January 23, 2026 12:05
Copy link
Contributor

@dzbarsky dzbarsky left a comment

Choose a reason for hiding this comment

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

Since this also hurts non-blaze users, a nicer solution would be to use function default for the attribute so the dependency can be removed if there is a cc toolchain present. Want to do that instead?

@krasimirgg
Copy link
Collaborator Author

krasimirgg commented Jan 26, 2026

Since this also hurts non-blaze users, a nicer solution would be to use function default for the attribute so the dependency can be removed if there is a cc toolchain present. Want to do that instead?

@dzbarsky: that sounds very interesting, could you give me a pointer to this function default pattern?

Another way to do this is: mark the attributes optional and fail() in code if there is no cc_toolchain... Updated this PR.

As a follow-up, @UebelAndre -- how important is that in no-cc_toolchain context these fallbacks defaults are real labels that point to real binaries? If not that important, I'm thinking we can clean up the label defaults so they are None by default and remove the currently-default targets such as //cargo/private:no_ar. What do you think?

@krasimirgg krasimirgg requested review from UebelAndre and removed request for hlopko January 26, 2026 11:44
@krasimirgg krasimirgg requested a review from hlopko January 29, 2026 09:44
@hlopko hlopko added this pull request to the merge queue Jan 29, 2026
Merged via the queue into bazelbuild:main with commit b0daae0 Jan 29, 2026
3 checks passed
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.

3 participants

Comments