diff options
Diffstat (limited to 'src/main/java')
7 files changed, 42 insertions, 60 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java index de5f998a8f..57ba8e0e14 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java @@ -888,7 +888,7 @@ public class BuildView { nodes.add(new TargetAndConfiguration(target, target.isConfigurable() ? config : null)); } } - return ImmutableList.copyOf(getDynamicConfigurations(nodes, eventHandler)); + return ImmutableList.copyOf(getConfigurations(nodes, eventHandler)); } /** @@ -908,7 +908,7 @@ public class BuildView { */ // TODO(bazel-team): error out early for targets that fail - untrimmed configurations should // never make it through analysis (and especially not seed ConfiguredTargetValues) - private LinkedHashSet<TargetAndConfiguration> getDynamicConfigurations( + private LinkedHashSet<TargetAndConfiguration> getConfigurations( Iterable<TargetAndConfiguration> inputs, ExtendedEventHandler eventHandler) throws InterruptedException { Map<Label, Target> labelsToTargets = new LinkedHashMap<>(); @@ -931,7 +931,7 @@ public class BuildView { } } - // Maps <target, originalConfig> pairs to <target, dynamicConfig> pairs for targets that + // Maps <target, originalConfig> pairs to <target, finalConfig> pairs for targets that // could be successfully Skyframe-evaluated. Map<TargetAndConfiguration, TargetAndConfiguration> successfullyEvaluatedTargets = new LinkedHashMap<>(); @@ -1003,17 +1003,17 @@ public class BuildView { /** - * Gets a dynamic configuration for the given target. + * Gets a configuration for the given target. * * <p>If {@link BuildConfiguration.Options#trimConfigurations()} is true, the configuration only * includes the fragments needed by the fragment and its transitive closure. Else unconditionally * includes all fragments. */ @VisibleForTesting - public BuildConfiguration getDynamicConfigurationForTesting( + public BuildConfiguration getConfigurationForTesting( Target target, BuildConfiguration config, ExtendedEventHandler eventHandler) throws InterruptedException { - return Iterables.getOnlyElement(getDynamicConfigurations( + return Iterables.getOnlyElement(getConfigurations( ImmutableList.<TargetAndConfiguration>of(new TargetAndConfiguration(target, config)), eventHandler)).getConfiguration(); } @@ -1217,10 +1217,11 @@ public class BuildView { } /** - * Returns a configured target for the specified target and configuration. If dynamic - * configurations are activated, and the target in question has a top-level rule class transition, - * that transition is applied in the returned ConfiguredTarget. Returns {@code null} if something - * goes wrong. + * Returns a configured target for the specified target and configuration. If the target in + * question has a top-level rule class transition, that transition is applied in the returned + * ConfiguredTarget. + * + * <p>Returns {@code null} if something goes wrong. */ @VisibleForTesting public ConfiguredTarget getConfiguredTargetForTesting( diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java index c865a0dbc3..9774cb7a56 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java @@ -957,33 +957,32 @@ public final class BuildConfiguration implements BuildEvent { /** * Values for --experimental_dynamic_configs. */ - public enum DynamicConfigsMode { - /** Use dynamic configurations, including only the fragments each rule needs. */ + public enum ConfigsMode { + /** Only include the configuration fragments each rule needs. */ ON, - /** Use dynamic configurations, always including all fragments known to Blaze. */ + /** Always including all fragments known to Blaze. */ NOTRIM, } /** * Converter for --experimental_dynamic_configs. */ - public static class DynamicConfigsConverter extends EnumConverter<DynamicConfigsMode> { - public DynamicConfigsConverter() { - super(DynamicConfigsMode.class, "dynamic configurations mode"); + public static class ConfigsModeConverter extends EnumConverter<ConfigsMode> { + public ConfigsModeConverter() { + super(ConfigsMode.class, "configurations mode"); } } @Option( name = "experimental_dynamic_configs", defaultValue = "notrim", - converter = DynamicConfigsConverter.class, + converter = ConfigsModeConverter.class, documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.UNKNOWN}, help = - "Dynamically instantiates build configurations instead of using the default " - + "static globally defined ones" + "Instantiates build configurations with the specified properties" ) - public DynamicConfigsMode useDynamicConfigurations; + public ConfigsMode configsMode; @Option( name = "experimental_enable_runfiles", @@ -1021,7 +1020,7 @@ public final class BuildConfiguration implements BuildEvent { host.outputDirectoryName = "host"; host.compilationMode = CompilationMode.OPT; host.isHost = true; - host.useDynamicConfigurations = useDynamicConfigurations; + host.configsMode = configsMode; host.enableRunfiles = enableRunfiles; host.buildPythonZip = buildPythonZip; host.windowsExeLauncher = windowsExeLauncher; @@ -1209,9 +1208,9 @@ public final class BuildConfiguration implements BuildEvent { * Returns true if this configuration is semantically equal to the other, with * the possible exception that the other has fewer fragments. * - * <p>This is useful for dynamic configurations - as the same configuration gets "trimmed" while - * going down a dependency chain, it's still the same configuration but loses some of its - * fragments. So we need a more nuanced concept of "equality" than simple reference equality. + * <p>This is useful for trimming: as the same configuration gets "trimmed" while going down a + * dependency chain, it's still the same configuration but loses some of its fragments. So we need + * a more nuanced concept of "equality" than simple reference equality. */ public boolean equalsOrIsSupersetOf(BuildConfiguration other) { return this.equals(other) @@ -1354,9 +1353,6 @@ public final class BuildConfiguration implements BuildEvent { /** * Constructs a new BuildConfiguration instance. - * - * <p>Callers that pass null for {@code dynamicTransitionMapper} should not use dynamic - * configurations. */ public BuildConfiguration(BlazeDirectories directories, Map<Class<? extends Fragment>, Fragment> fragmentsMap, @@ -1975,11 +1971,11 @@ public final class BuildConfiguration implements BuildEvent { } /** - * Returns whether we should trim dynamic configurations to only include the fragments needed - * to correctly analyze a rule. + * Returns whether we should trim configurations to only include the fragments needed to correctly + * analyze a rule. */ public boolean trimConfigurations() { - return options.useDynamicConfigurations == Options.DynamicConfigsMode.ON; + return options.configsMode == Options.ConfigsMode.ON; } /** @@ -2006,9 +2002,9 @@ public final class BuildConfiguration implements BuildEvent { * <p><b>Be very careful using this method.</b> Options classes are mutable - no caller * should ever call this method if there's any change the reference might be written to. * This method only exists because {@link #cloneOptions} can be expensive when applied to - * every edge in a dependency graph, which becomes possible with dynamic configurations. + * every edge in a dependency graph. * - * <p>Do not use this method without careful review with other Bazel developers.. + * <p>Do not use this method without careful review with other Bazel developers. */ public BuildOptions getOptions() { return buildOptions; diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationCollection.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationCollection.java index b8b03b6930..1780b1e4c5 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationCollection.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationCollection.java @@ -59,10 +59,9 @@ public final class BuildConfigurationCollection { /** * Returns the host configuration for this collection. * - * <p>Don't use this method. It's limited in that it assumes a single host configuration for - * the entire collection. This may not be true in the future and more flexible interfaces based - * on dynamic configurations will likely supplant this interface anyway. Its main utility is - * to keep Bazel working while dynamic configuration progress is under way. + * <p>Don't use this method. It's limited in that it assumes a single host configuration for the + * entire collection. This may not be true in the future and more flexible interfaces will likely + * supplant this interface anyway. */ public BuildConfiguration getHostConfiguration() { return hostConfiguration; diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/PatchTransition.java b/src/main/java/com/google/devtools/build/lib/analysis/config/PatchTransition.java index 33362b1dac..80091e05b9 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/PatchTransition.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/PatchTransition.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.analysis.config; import com.google.devtools.build.lib.packages.Attribute; /** - * Interface for a configuration transition using dynamic configurations. + * Interface for a configuration transition. * * <p>The concept is simple: given the input configuration's build options, the * transition does whatever it wants to them and returns the modified result. diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java index 663312d433..390aa32254 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java @@ -102,16 +102,9 @@ public class CppRuleClasses { /** * Rule transition factory that enables LIPO on the LIPO context binary (i.e. applies a DATA -> * TARGET transition). - * - * <p>This is how dynamic configurations enable LIPO on the LIPO context. */ public static final RuleTransitionFactory LIPO_ON_DEMAND = - new RuleTransitionFactory() { - @Override - public Attribute.Transition buildTransitionFor(Rule rule) { - return new EnableLipoTransition(rule.getLabel()); - } - }; + (rule) -> new EnableLipoTransition(rule.getLabel()); /** * Label of a pseudo-filegroup that contains all crosstool and libcfiles for all configurations, diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetCycleReporter.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetCycleReporter.java index 4e0b959674..9cd2302ee5 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetCycleReporter.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetCycleReporter.java @@ -58,15 +58,9 @@ class ConfiguredTargetCycleReporter extends AbstractLabelCycleReporter { return false; } Iterable<SkyKey> cycleKeys = Iterables.concat(cycleInfo.getPathToCycle(), cycleInfo.getCycle()); - // Static configurations expect all keys to be ConfiguredTargetValue keys. Dynamic - // configurations expect the top-level key to be a ConfiguredTargetValue key, but cycles and - // paths to them can travel through TransitiveTargetValue keys because ConfiguredTargetFunction + // The top-level key should be a ConfiguredTargetValue key, but cycles and paths to it can + // travel through TransitiveTargetValue keys because ConfiguredTargetFunction visits // visits TransitiveTargetFunction as a part of dynamic configuration computation. - // - // Unfortunately this class can't easily figure out if we're in static or dynamic configuration - // mode, so we loosely permit both cases. - // - // TODO: remove the static-style checking once dynamic configurations fully replace them return Iterables.all(cycleKeys, Predicates.<SkyKey>or(IS_CONFIGURED_TARGET_SKY_KEY, IS_TRANSITIVE_TARGET_SKY_KEY)); } 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 ba926d5fbc..53fe489816 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 @@ -1406,9 +1406,8 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { ArrayListMultimap.<Dependency, BuildConfiguration>create(); Set<Dependency> depsToEvaluate = new HashSet<>(); - // Check: if !Configuration.useDynamicConfigs then just return the original configs. Set<Class<? extends BuildConfiguration.Fragment>> allFragments = null; - if (useUntrimmedDynamicConfigs(fromOptions)) { + if (useUntrimmedConfigs(fromOptions)) { allFragments = ((ConfiguredRuleClassProvider) ruleClassProvider).getAllFragments(); } @@ -1419,7 +1418,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { for (Dependency key : keys) { if (key.hasExplicitConfiguration()) { builder.put(key, key.getConfiguration()); - } else if (useUntrimmedDynamicConfigs(fromOptions)) { + } else if (useUntrimmedConfigs(fromOptions)) { fragmentsMap.put(key.getLabel(), allFragments); } else { depsToEvaluate.add(key); @@ -1484,12 +1483,12 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { } /** - * Returns whether dynamic configurations should trim their fragments to only those needed by + * Returns whether configurations should trim their fragments to only those needed by * targets and their transitive dependencies. */ - private static boolean useUntrimmedDynamicConfigs(BuildOptions options) { - return options.get(BuildConfiguration.Options.class).useDynamicConfigurations - == BuildConfiguration.Options.DynamicConfigsMode.NOTRIM; + private static boolean useUntrimmedConfigs(BuildOptions options) { + return options.get(BuildConfiguration.Options.class).configsMode + == BuildConfiguration.Options.ConfigsMode.NOTRIM; } /** |