-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow cquery to filter out incompatible targets
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
- Loading branch information
Showing
7 changed files
with
123 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../google/devtools/build/lib/starlarkbuildapi/platform/IncompatiblePlatformProviderApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2021 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.devtools.build.lib.starlarkbuildapi.platform; | ||
|
||
import com.google.devtools.build.docgen.annot.DocCategory; | ||
import net.starlark.java.annot.StarlarkBuiltin; | ||
import net.starlark.java.eval.StarlarkValue; | ||
|
||
/** Targets that are incompatible with the target platform. */ | ||
@StarlarkBuiltin( | ||
name = "IncompatiblePlatformProvider", | ||
doc = | ||
"A provider for targets that are incompatible with the target platform. See " | ||
+ "<a href='../../platforms.html#detecting-incompatible-targets-using-bazel-cquery'>" | ||
+ "Detecting incompatible targets using <code>bazel cquery</code></a> for more " | ||
+ "information.", | ||
category = DocCategory.PROVIDER) | ||
public interface IncompatiblePlatformProviderApi extends StarlarkValue {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters