Skip to content

@platforms//:incompatible is not available by default in Bazel 5.0.0 #14694

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

Closed
mcwilson07 opened this issue Feb 2, 2022 · 9 comments
Closed
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions untriaged

Comments

@mcwilson07
Copy link

Description of the problem / feature request:

The documentation for Platforms has a section on "more expressive constraints" that does not work by default in Bazel 5.0.0. The platforms code that is included with Bazel does not include the "@platforms://incompatible" target. I checked the BUILD file in external/platforms and it is missing the lines that define "incompatible" in this platforms file.

This means the documentation for using platforms is incomplete because there is a way to change the underlying platforms version or incorrect because the feature is not available.

Feature requests: what underlying problem are you trying to solve with this feature?

Use the "more expressive constraints" as documented in the Platforms documentation.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Add the following constraing to any target in a BUILD file.

target_compatible_with = ["@platforms//:incompatible"],

and you will get an error similar to the following error:

ERROR: BUILD.bazel:3:8: no such target '@platforms//:incompatible': target 'incompatible' not declared in package '' defined by <bazel_root>external/platforms/BUILD and referenced by ''

What operating system are you running Bazel on?

Windows, Linux and Mac

What's the output of bazel info release?

release 5.0.0

Have you found anything relevant by searching the web?

A few references to the documentation that does not work out of the box.

@katre
Copy link
Member

katre commented Feb 2, 2022

The version of @platforms that's included in Bazel is old enough to not have this.

You can define it yourself in the WORKSPACE file to get the up-to-date @platforms.

@mcwilson07
Copy link
Author

mcwilson07 commented Feb 2, 2022

I've done that as a workaround and can confirm that works. The defect is more around how the documentation should be updated to be correct or Bazel should update the version of @platforms to match the documentation.

@katre
Copy link
Member

katre commented Feb 2, 2022

I agree that it should be updated, just wanted to make sure the workaround was documented.

@katre katre added team-Configurability platforms, toolchains, cquery, select(), config transitions untriaged labels Feb 2, 2022
@aiuto
Copy link

aiuto commented Feb 7, 2022

@katre How about this plan

  • we merge the outstanding platforms PR for fucshia
  • update bazel at head
  • backport to bazel 5.x and 4.x.

I'm willing to try the backport myself so I can critique the ease of use.

@katre
Copy link
Member

katre commented Feb 7, 2022

SGTM, although cutting a new 4.x for this may be tricky. We'll also need to decide if this is worth a 5.0.1 or waiting for 5.1.

@aiuto
Copy link

aiuto commented Feb 8, 2022 via email

@pcjanzen
Copy link
Contributor

pcjanzen commented Feb 8, 2022

@mcwilson07 are you certain that you are using the version of platforms that is bundled with bazel, and not one specified by one of your other dependencies?

@platforms//:incompatible has been available since platforms v0.0.2, which was merged to bazel in Dec 2020, and I verified that the target does exist in bazel v5.0.0 and v4.2.1 with a completely empty WORKSPACE.

@aiuto
Copy link

aiuto commented Feb 9, 2022 via email

@mcwilson07
Copy link
Author

I just looked into this yesterday. It is definitely being pulled in somewhere else, I haven't been able to figure out where yet but a blank WORKSPACE with just a filegroup and an incompatible target is properly skipped with this Bazel version. Sorry for the confusion here!

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 untriaged
Projects
None yet
Development

No branches or pull requests

4 participants