Skip to content
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

Allow cquery to filter out incompatible targets #12935

Conversation

philsc
Copy link
Contributor

@philsc philsc commented Jan 30, 2021

This patch exposes the IncompatiblePlatformProvider to Starlark just
enough that it can be used with cquery's platforms() function. I
added an example of this to the documentation. The motivation here is
to let users filter out incompatible targets from queries that
provide things like the list of targets to build for CI.

This patch is minimal on purpose. It does not allow users to
instantiate an IncompatiblePlatformProvider in Starlark. This may be
added in a future patch to address a different use case.

Fixes #12917.

site/docs/cquery.html Outdated Show resolved Hide resolved
@gregestren
Copy link
Contributor

Added @comius as Build API lead. My understanding is they should vet changes to the Starlark build API. FYI my personal opinion is this is a pretty good candidate for being part of the API.

@philsc philsc force-pushed the starlark-incompatible-platform-provider branch from ed184e9 to d2db797 Compare February 3, 2021 05:01
Copy link
Contributor

@gregestren gregestren left a comment

Choose a reason for hiding this comment

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

Overall this looks great to me!

I would hold off merging before getting @comius 's input. Depending on his schedule, feel free to ping this issue again to keep momentum up.

This patch exposes the `IncompatiblePlatformProvider` to Starlark just
enough that it can be used with `cquery`'s `platforms()` function. I
added an example of this to the documentation. The motivation here is
to let users filter out incompatible targets from queries that
provide things like the list of targets to build for CI.

This patch is minimal on purpose. It does not allow users to
instantiate an `IncompatiblePlatformProvider` in Starlark. This may be
added in a future patch to address a different use case.
@philsc philsc force-pushed the starlark-incompatible-platform-provider branch from d2db797 to 56170b4 Compare February 4, 2021 03:35
@oquenchil oquenchil added the team-Configurability platforms, toolchains, cquery, select(), config transitions label Feb 4, 2021
@philsc
Copy link
Contributor Author

philsc commented Feb 9, 2021

@comius, are you interested in taking a look at this PR?

Copy link
Contributor

@comius comius left a comment

Choose a reason for hiding this comment

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

LGTM

@gregestren
Copy link
Contributor

I'll merge...

@bazel-io bazel-io closed this in ad241fb Feb 9, 2021
@philsc philsc deleted the starlark-incompatible-platform-provider branch February 10, 2021 01:35
philwo pushed a commit that referenced this pull request Mar 15, 2021
This patch exposes the `IncompatiblePlatformProvider` to Starlark just
enough that it can be used with `cquery`'s `platforms()` function. I
added an example of this to the documentation. The motivation here is
to let users filter out incompatible targets from queries that
provide things like the list of targets to build for CI.

This patch is minimal on purpose. It does not allow users to
instantiate an `IncompatiblePlatformProvider` in Starlark. This may be
added in a future patch to address a different use case.

Fixes #12917.

Closes #12935.

PiperOrigin-RevId: 356580943
philwo pushed a commit that referenced this pull request Mar 15, 2021
This patch exposes the `IncompatiblePlatformProvider` to Starlark just
enough that it can be used with `cquery`'s `platforms()` function. I
added an example of this to the documentation. The motivation here is
to let users filter out incompatible targets from queries that
provide things like the list of targets to build for CI.

This patch is minimal on purpose. It does not allow users to
instantiate an `IncompatiblePlatformProvider` in Starlark. This may be
added in a future patch to address a different use case.

Fixes #12917.

Closes #12935.

PiperOrigin-RevId: 356580943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-Configurability platforms, toolchains, cquery, select(), config transitions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The query language lacks a way to query rules that are target_compatible_with
4 participants