aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2018-02-06 11:04:17 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-06 11:05:56 -0800
commit71dbed482868e5a94eb945063c6dd6209aaf776c (patch)
tree4a178d020b1e5977ddca3940dab5cb0b58c490b4 /src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java
parent33c419bb0952721f056f01a0374f9f2d238e98bd (diff)
Update ToolchainResolutionFunction to consider multiple available
execution platforms. Part of #4442. Change-Id: I6678d57f4aaadcb19032bf58820606242ba66a25 PiperOrigin-RevId: 184707708
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java
index 01909e6e8e..1f39059adf 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionValue.java
@@ -15,14 +15,22 @@
package com.google.devtools.build.lib.skyframe;
import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
+import java.util.List;
-/** A value which represents the selected toolchain for a specific target and execution platform. */
+/**
+ * A value which represents the map of potential execution platforms and resolved toolchains. This
+ * value only considers a single toolchain type, which allows for a Skyframe cache per toolchain
+ * type. Callers will need to consider all toolchain types that are required and merge the results
+ * together appropriately.
+ */
@AutoValue
public abstract class ToolchainResolutionValue implements SkyValue {
@@ -31,9 +39,9 @@ public abstract class ToolchainResolutionValue implements SkyValue {
BuildConfiguration configuration,
Label toolchainType,
PlatformInfo targetPlatform,
- PlatformInfo execPlatform) {
+ List<PlatformInfo> availableExecutionPlatforms) {
return ToolchainResolutionKey.create(
- configuration, toolchainType, targetPlatform, execPlatform);
+ configuration, toolchainType, targetPlatform, availableExecutionPlatforms);
}
/** {@link SkyKey} implementation used for {@link ToolchainResolutionFunction}. */
@@ -50,21 +58,30 @@ public abstract class ToolchainResolutionValue implements SkyValue {
public abstract PlatformInfo targetPlatform();
- public abstract PlatformInfo execPlatform();
+ public abstract ImmutableList<PlatformInfo> availableExecutionPlatforms();
public static ToolchainResolutionKey create(
BuildConfiguration configuration,
Label toolchainType,
PlatformInfo targetPlatform,
- PlatformInfo execPlatform) {
+ List<PlatformInfo> availableExecutionPlatforms) {
return new AutoValue_ToolchainResolutionValue_ToolchainResolutionKey(
- configuration, toolchainType, targetPlatform, execPlatform);
+ configuration,
+ toolchainType,
+ targetPlatform,
+ ImmutableList.copyOf(availableExecutionPlatforms));
}
}
- public static ToolchainResolutionValue create(Label toolchainLabel) {
- return new AutoValue_ToolchainResolutionValue(toolchainLabel);
+ public static ToolchainResolutionValue create(
+ ImmutableMap<PlatformInfo, Label> availableToolchainLabels) {
+ return new AutoValue_ToolchainResolutionValue(availableToolchainLabels);
}
- public abstract Label toolchainLabel();
+ /**
+ * Returns the resolved set of toolchain labels (as {@link Label}) for the requested toolchain
+ * type, keyed by the execution platforms (as {@link PlatformInfo}). Ordering is not preserved, if
+ * the caller cares about the order of platforms it must take care of that directly.
+ */
+ public abstract ImmutableMap<PlatformInfo, Label> availableToolchainLabels();
}