Skip to content

Make target_compatible_with work better on alias() targets#17983

Closed
philsc wants to merge 6 commits intobazelbuild:masterfrom
philsc:unreviewed/philsc/fix-17663
Closed

Make target_compatible_with work better on alias() targets#17983
philsc wants to merge 6 commits intobazelbuild:masterfrom
philsc:unreviewed/philsc/fix-17663

Conversation

@philsc
Copy link
Copy Markdown
Contributor

@philsc philsc commented Apr 5, 2023

Currently the target_compatible_with on alias() targets only works
when a select() is involved. That's because alias() targets by
default don't have a toolchains evaluated.

This patch changes the behaviour by making it so all alias() targets
with a target_compatible_with attribute are skipped appropriately.
When target_compatible_with is present, then toolchains are
evaluated for alias() targets.

The implementation is basically an enhancement to @gregestren's
1c3a245 (#14310). In
addition to resolving toolchains when a select() is present, Bazel
will now also resolve toolchains when a target_compatible_with
attribute is set.

I also took this opportunity to rename HAS_SELECT to something
more appropriate. The name may be too long now, but I feel
that at least it's descriptive.

Fixes #17663

philsc added 3 commits April 4, 2023 21:46
Currently the `target_compatible_with` on `alias()` targets only works
when a `select()` is involved. That's because `alias()` targets by
default don't have a toolchains evaluated.

This patch changes the behaviour by making it so all `alias()` targets
with a `target_compatible_with` attribute are skipped appropriately.
When `target_compatible_with` is present, then toolchains are
evaluated for `alias()` targets.

The implementation is basically an enhancement to @gregestren's
1c3a245 (bazelbuild#14310). In
addition to resolving toolchains when a `select()` is present, Bazel
will now also resolve toolchains when a `target_compatible_with`
attribute is set.
@philsc philsc requested review from a team and lberki as code owners April 5, 2023 04:59
@philsc philsc requested review from sdtwigg and removed request for a team April 5, 2023 04:59
@github-actions github-actions bot added awaiting-review PR is awaiting review from an assigned reviewer team-Configurability platforms, toolchains, cquery, select(), config transitions labels Apr 5, 2023
@philsc
Copy link
Copy Markdown
Contributor Author

philsc commented Apr 5, 2023

@gregestren , FYI.

@philsc philsc requested a review from gregestren April 6, 2023 03:21
@gregestren gregestren added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Apr 6, 2023
@copybara-service copybara-service bot closed this in 1d2e9c8 Apr 6, 2023
@ShreeM01 ShreeM01 removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 6, 2023
@philsc philsc deleted the unreviewed/philsc/fix-17663 branch April 7, 2023 03:02
fweikert pushed a commit to fweikert/bazel that referenced this pull request May 25, 2023
Currently the `target_compatible_with` on `alias()` targets only works
when a `select()` is involved. That's because `alias()` targets by
default don't have a toolchains evaluated.

This patch changes the behaviour by making it so all `alias()` targets
with a `target_compatible_with` attribute are skipped appropriately.
When `target_compatible_with` is present, then toolchains are
evaluated for `alias()` targets.

The implementation is basically an enhancement to @gregestren's
1c3a245 (bazelbuild#14310). In
addition to resolving toolchains when a `select()` is present, Bazel
will now also resolve toolchains when a `target_compatible_with`
attribute is set.

I also took this opportunity to rename `HAS_SELECT` to something
more appropriate. The name may be too long now, but I feel
that at least it's descriptive.

Fixes bazelbuild#17663

Closes bazelbuild#17983.

PiperOrigin-RevId: 522446438
Change-Id: I80bce3e840553b75960022545df7f27ad1d1d363
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Configurability platforms, toolchains, cquery, select(), config transitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weird behavior with alias and target_compatible_with

3 participants