Skip to content

tests: use $(rootpaths) to get executable files paths for Bazel 8 compatibility #2395

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 4 commits into from
Nov 12, 2024

Conversation

rickeylev
Copy link
Collaborator

In Bazel 8, the singular $(rootpath) expansions require that the target expands to a
single file. The py rules have an unfortunate legacy behavior where their default outputs
are the executable and the main py file, thus causing an error.

To fix, use the plural $(rootpaths), then post-process the space-separated string to get
just the executable portion of it.

Along the way...

  • Add tests/integration/py_cc_toolchain_registered/bazel-* symlink to Bazel ignore.
    This avoids an infinite symlink expansions error and performance issues when those
    symlinks exist.

Work towards #2378

@rickeylev rickeylev requested a review from aignas as a code owner November 12, 2024 18:45
@rickeylev rickeylev mentioned this pull request Nov 12, 2024
5 tasks
@rickeylev rickeylev enabled auto-merge November 12, 2024 19:15
Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

The MODULE.bazel.lock file change looks weird - I don't see why it would have to change - is it the .bazelignore or are we missing some CI checks...

@rickeylev rickeylev added this pull request to the merge queue Nov 12, 2024
Merged via the queue into bazel-contrib:main with commit 1b2714e Nov 12, 2024
4 checks passed
@rickeylev rickeylev deleted the fix.bazel8.bzlmod.example branch November 13, 2024 00:09
github-merge-queue bot pushed a commit that referenced this pull request Dec 7, 2024
This is basically part of #2395, but for the workspace test. Same as
that PR, the `$(rootpath)`
expansion isn't valid for a target with multiple outputs. To fix, use
`$(rootpaths)` and parse
out the particular value of interest.

Work towards #2469
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