From 40d0077016dee31865af5246cbd6b2953d6386b3 Mon Sep 17 00:00:00 2001 From: janakr Date: Wed, 14 Feb 2018 14:08:45 -0800 Subject: Start slimming down ToolchainResolutionKey: get rid of BuildConfiguration. The real blocker is PlatformInfo, which is coming. PiperOrigin-RevId: 185742130 --- .../build/lib/skyframe/AspectFunction.java | 3 +- .../lib/skyframe/ConfiguredTargetFunction.java | 6 ++- .../lib/skyframe/RegisteredToolchainsFunction.java | 8 +++- .../lib/skyframe/RegisteredToolchainsValue.java | 50 ++++++++++++++++++++-- .../build/lib/skyframe/SkyframeExecutor.java | 9 +++- .../lib/skyframe/ToolchainResolutionFunction.java | 10 ++++- .../lib/skyframe/ToolchainResolutionValue.java | 13 +++--- .../devtools/build/lib/skyframe/ToolchainUtil.java | 16 ++++--- 8 files changed, 92 insertions(+), 23 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java index a5e12144f9..9d3f49cb26 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java @@ -357,7 +357,8 @@ public final class AspectFunction implements SkyFunction { aspect.getDescriptor().getDescription(), associatedConfiguredTargetAndTarget.getTarget().toString()), requiredToolchains, - aspectConfiguration); + aspectConfiguration, + key.getAspectConfigurationKey()); } catch (ToolchainContextException e) { // TODO(katre): better error handling throw new AspectCreationException(e.getMessage()); diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java index ca24fdf829..963a8bedb5 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java @@ -246,7 +246,11 @@ public final class ConfiguredTargetFunction implements SkyFunction { rule.getRuleClassObject().getRequiredToolchains(); toolchainContext = ToolchainUtil.createToolchainContext( - env, rule.toString(), requiredToolchains, configuration); + env, + rule.toString(), + requiredToolchains, + configuration, + configuredTargetKey.getConfigurationKey()); if (env.valuesMissing()) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java index 7a2c948efe..d6a8bfe1dd 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/RegisteredToolchainsFunction.java @@ -43,7 +43,13 @@ public class RegisteredToolchainsFunction implements SkyFunction { public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException, InterruptedException { - BuildConfiguration configuration = (BuildConfiguration) skyKey.argument(); + BuildConfigurationValue buildConfigurationValue = + (BuildConfigurationValue) + env.getValue(((RegisteredToolchainsValue.Key) skyKey).getConfigurationKey()); + if (env.valuesMissing()) { + return null; + } + BuildConfiguration configuration = buildConfigurationValue.getConfiguration(); ImmutableList.Builder