diff --git a/src/main/java/com/google/devtools/build/lib/analysis/producers/BUILD b/src/main/java/com/google/devtools/build/lib/analysis/producers/BUILD index 98cb507fb3653b..cacc40b56960b7 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/producers/BUILD +++ b/src/main/java/com/google/devtools/build/lib/analysis/producers/BUILD @@ -24,6 +24,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/analysis:config/config_conditions", "//src/main/java/com/google/devtools/build/lib/analysis:config/config_matching_provider", "//src/main/java/com/google/devtools/build/lib/analysis:config/configuration_transition_event", + "//src/main/java/com/google/devtools/build/lib/analysis:config/common_options", "//src/main/java/com/google/devtools/build/lib/analysis:config/core_options", "//src/main/java/com/google/devtools/build/lib/analysis:config/invalid_configuration_exception", "//src/main/java/com/google/devtools/build/lib/analysis:config/starlark_transition_cache", diff --git a/src/main/java/com/google/devtools/build/lib/analysis/producers/DependencyContextProducerWithCompatibilityCheck.java b/src/main/java/com/google/devtools/build/lib/analysis/producers/DependencyContextProducerWithCompatibilityCheck.java index 581e617007e738..e88bb64642fbf2 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/producers/DependencyContextProducerWithCompatibilityCheck.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/producers/DependencyContextProducerWithCompatibilityCheck.java @@ -96,10 +96,7 @@ public StateMachine step(Tasks tasks) { // Checks for incompatibility before toolchain resolution so that known missing // toolchains mark the target incompatible instead of failing the build. return new PlatformInfoProducer( - ConfiguredTargetKey.builder() - .setLabel(platformConfiguration.getTargetPlatform()) - .setConfigurationKey(defaultToolchainContextKey.configurationKey()) - .build(), + platformConfiguration.getTargetPlatform(), (PlatformInfoProducer.ResultSink) this, /* runAfter= */ this::computeConfigConditions); } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/producers/PlatformInfoProducer.java b/src/main/java/com/google/devtools/build/lib/analysis/producers/PlatformInfoProducer.java index 443dfc2f217a0f..5bd746011d7d1a 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/producers/PlatformInfoProducer.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/producers/PlatformInfoProducer.java @@ -15,10 +15,13 @@ import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.ConfiguredTargetValue; +import com.google.devtools.build.lib.analysis.config.CommonOptions; import com.google.devtools.build.lib.analysis.platform.PlatformInfo; import com.google.devtools.build.lib.analysis.platform.PlatformProviderUtils; +import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.packages.NoSuchPackageException; import com.google.devtools.build.lib.packages.NoSuchTargetException; +import com.google.devtools.build.lib.skyframe.BuildConfigurationKey; import com.google.devtools.build.lib.skyframe.ConfiguredTargetKey; import com.google.devtools.build.lib.skyframe.ConfiguredValueCreationException; import com.google.devtools.build.lib.skyframe.PackageValue; @@ -29,7 +32,10 @@ import javax.annotation.Nullable; /** - * Retrieves {@link PlatformInfo} for a given platform key. + * Retrieves {@link PlatformInfo} for a given platform. + * + *
Since platforms do not rely on the configuration, this uses a dummy blank configuration to + * help reduce the number of skyframe edges created. * *
This creates an explicit dependency on the {@link Package} to retrieve the associated target,
* so it is possible to verify that {@link PlatformInfo} is an advertised provider before
@@ -44,7 +50,7 @@ interface ResultSink {
}
// -------------------- Input --------------------
- private final ConfiguredTargetKey platformKey;
+ private final Label platformLabel;
// -------------------- Output --------------------
private final ResultSink sink;
@@ -56,8 +62,8 @@ interface ResultSink {
private boolean passedValidation = false;
private ConfiguredTarget platform;
- PlatformInfoProducer(ConfiguredTargetKey platformKey, ResultSink sink, StateMachine runAfter) {
- this.platformKey = platformKey;
+ PlatformInfoProducer(Label platformLabel, ResultSink sink, StateMachine runAfter) {
+ this.platformLabel = platformLabel;
this.sink = sink;
this.runAfter = runAfter;
}
@@ -69,7 +75,7 @@ public StateMachine step(Tasks tasks) {
//
// In distributed analysis, these packages will be duplicated across shards.
tasks.lookUp(
- platformKey.getLabel().getPackageIdentifier(),
+ platformLabel.getPackageIdentifier(),
NoSuchPackageException.class,
(StateMachine.ValueOrExceptionSink