aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe
diff options
context:
space:
mode:
authorGravatar gregce <gregce@google.com>2017-05-04 19:38:07 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-05-04 23:05:59 +0200
commitb71e99b1f3746103e5d6802eebc24096b3494959 (patch)
treed15aedac96b3cfb2dd1e8f5113d6ead3b6dbeedb /src/main/java/com/google/devtools/build/lib/skyframe
parentee0a8bb7f4a9b8edc3fdb30b4e255cf461415382 (diff)
Implement dynamically configured LIPO builds.
Quick overview: - provide a dynamic interface for getting the artifact owner configuration - provide a (dynamic) RuleTransitionFactory LIPO_ON_DEMAND to replace the (static) RuleClass.Configurator LIPO_ON_DEMAND. Eventually we'll remove the rule class configurator interface entirely. This doesn't actually turn dynamic LIPO on. So the direct effect of this change should be a no-op. The flip will come in a followup change. For now, dynamic LIPO can be triggered with --experimental_dynamic_configs=notrim. PiperOrigin-RevId: 155096056
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java15
2 files changed, 18 insertions, 7 deletions
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 d79f0dbf4c..034e87dd84 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
@@ -36,6 +36,7 @@ import com.google.devtools.build.lib.analysis.AspectCollection.AspectDeps;
import com.google.devtools.build.lib.analysis.CachingAnalysisEnvironment;
import com.google.devtools.build.lib.analysis.ConfiguredAspect;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
+import com.google.devtools.build.lib.analysis.ConfiguredTargetFactory;
import com.google.devtools.build.lib.analysis.Dependency;
import com.google.devtools.build.lib.analysis.DependencyResolver.InconsistentAspectOrderException;
import com.google.devtools.build.lib.analysis.LabelAndConfiguration;
@@ -1069,7 +1070,7 @@ final class ConfiguredTargetFunction implements SkyFunction {
boolean failed = false;
Iterable<SkyKey> depKeys = Iterables.transform(deps, TO_KEYS);
Map<SkyKey, ValueOrException<ConfiguredValueCreationException>> depValuesOrExceptions =
- env.getValuesOrThrow(depKeys, ConfiguredValueCreationException.class);
+ env.getValuesOrThrow(depKeys, ConfiguredValueCreationException.class);
Map<SkyKey, ConfiguredTarget> result =
Maps.newHashMapWithExpectedSize(depValuesOrExceptions.size());
for (Map.Entry<SkyKey, ValueOrException<ConfiguredValueCreationException>> entry
@@ -1115,8 +1116,11 @@ final class ConfiguredTargetFunction implements SkyFunction {
NestedSetBuilder<Package> transitivePackages)
throws ConfiguredTargetFunctionException, InterruptedException {
StoredEventHandler events = new StoredEventHandler();
- BuildConfiguration ownerConfig = (configuration == null)
- ? null : configuration.getArtifactOwnerConfiguration();
+ BuildConfiguration ownerConfig =
+ ConfiguredTargetFactory.getArtifactOwnerConfiguration(env, configuration);
+ if (env.valuesMissing()) {
+ return null;
+ }
CachingAnalysisEnvironment analysisEnvironment = view.createAnalysisEnvironment(
new ConfiguredTargetKey(target.getLabel(), ownerConfig), false,
events, env, configuration);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
index f058a4ec1f..d2dba4c96a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
@@ -1466,10 +1466,17 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory {
BuildConfiguration configuration,
Attribute.Transition transition) {
- Preconditions.checkArgument(configuration == null
- || configuration.useDynamicConfigurations()
- || transition == ConfigurationTransition.NONE,
- "Dynamic configurations required for test configuration using a transition");
+ if (configuration != null && !configuration.useDynamicConfigurations()
+ && transition != ConfigurationTransition.NONE) {
+ // It's illegal to apply this transition over a statically configured build. But C++ LIPO
+ // support works by applying a rule configurator for static configurations and a rule
+ // transition applier for dynamic configurations. Dynamically configured builds skip
+ // the configurator and this code makes statically configured builds skip the rule transition
+ // applier.
+ //
+ // This will all get a lot simpler once static configurations are removed entirely.
+ transition = ConfigurationTransition.NONE;
+ }
if (memoizingEvaluator.getExistingValueForTesting(
PrecomputedValue.WORKSPACE_STATUS_KEY.getKeyForTesting()) == null) {