Description of the problem / feature request:
Consider the following Starlark rule:
DummyProvider = provider()
def _dummy_rule_impl(ctx):
return [DummyProvider()]
dummy_rule = rule(
implementation = _dummy_rule_impl,
attrs = {
"deps": attr.label_list(providers=[DummyProvider]),
},
)
If you instantiate it like this:
load(":rules.bzl", "dummy_rule")
dummy_rule(
name = "dummy1",
target_compatible_with = ["@platforms//:incompatible"],
)
dummy_rule(
name = "dummy2",
deps = [
":dummy1",
],
)
then building fails with:
ERROR: /home/phil/.cache/bazel/_bazel_phil/b4868b516be4e3bea4d221937a55ced4/sandbox/linux-sandbox/2572/execroot/io_bazel/_tmp/c749fd38ac9a4ad6bd41e9653bbceab5/workspace/target_skipping/BUILD:112:11: in deps attribute of dummy_rule rule //target_skipping:dummy2: '//target_skipping:dummy1' does not have mandatory providers: 'DummyProvider'
This occurs because the incompatible target is assigned an IncompatiblePlatformProvider and not a DummyProvider.
The same thing happens when using Python targets:
ERROR: /home/phil/repos/971-Robot-Code/frc971/control_loops/python/BUILD:189:11: in deps attribute of py_library rule //frc971/control_loops/python:basic_window: '@python_gtk//:python_gtk' does not have mandatory providers: 'py' or 'PyInfo'
A quick hack to fix this is:
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index 78ee802789..e094b7b529 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -43,6 +43,7 @@ import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.AliasProvider.TargetMode;
+import com.google.devtools.build.lib.analysis.IncompatiblePlatformProvider;
import com.google.devtools.build.lib.analysis.actions.ActionConstructionContext;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoKey;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
@@ -2292,6 +2293,10 @@ public final class RuleContext extends TargetContext
return true;
}
+ if (prerequisite.getConfiguredTarget().getProvider(IncompatiblePlatformProvider.class) != null) {
+ return true;
+ }
+
unfulfilledRequirements.add(
String.format(
"'%s' does not have mandatory providers: %s",
What operating system are you running Bazel on?
x86_64 Linux
What's the output of bazel info release?
Running off latest master (d0efd7b).
If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.
$ bazel build -c opt //src:bazel
Description of the problem / feature request:
Consider the following Starlark rule:
If you instantiate it like this:
then building fails with:
This occurs because the incompatible target is assigned an
IncompatiblePlatformProviderand not aDummyProvider.The same thing happens when using Python targets:
A quick hack to fix this is:
What operating system are you running Bazel on?
x86_64 Linux
What's the output of
bazel info release?Running off latest master (d0efd7b).
If
bazel info releasereturns "development version" or "(@Non-Git)", tell us how you built Bazel.$ bazel build -c opt //src:bazel