diff options
author | 2017-09-12 20:50:21 +0200 | |
---|---|---|
committer | 2017-09-13 19:06:01 +0200 | |
commit | be805e05ef8fa52522544b7d09768e581d17e6ca (patch) | |
tree | 660ef85a2309d2fffb9bc40a412090faea2fa935 /src/main/java/com/google/devtools/build | |
parent | d9b634687e154cdff2c8fb4c553149aad1d2cf86 (diff) |
Remove unused class after removal of BazelConfigurationCollection.
Also pipe keepGoing back into initial configuration creation.
PiperOrigin-RevId: 168412512
Diffstat (limited to 'src/main/java/com/google/devtools/build')
4 files changed, 15 insertions, 66 deletions
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 3f0d4b2207..b8b03b6930 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 @@ -16,23 +16,17 @@ package com.google.devtools.build.lib.analysis.config; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; -import java.io.Serializable; import java.util.HashMap; import java.util.List; -import java.util.Objects; /** - * The primary container for all main {@link BuildConfiguration} instances, - * currently "target", "data", and "host". + * Convenience container for top-level target and host configurations. * - * <p>The target configuration is used for all targets specified on the command - * line. Data dependencies of targets in the target configuration use the data - * configuration instead. + * <p>The target configuration is used for all targets specified on the command line. Multiple + * target configurations are possible because of settings like {@link + * com.google.devtools.build.lib.buildtool.BuildRequest.BuildRequestOptions#multiCpus}. * - * <p>The host configuration is used for tools that are executed during the - * build, e. g, compilers. - * - * <p>The "related" configurations are also contained in this class. + * <p>The host configuration is used for tools that are executed during the build, e. g, compilers. */ @ThreadSafe public final class BuildConfigurationCollection { @@ -90,36 +84,4 @@ public final class BuildConfigurationCollection { public int hashCode() { return targetConfigurations.hashCode(); } - - /** - * A holder class for {@link BuildConfiguration} instances that allows {@code null} values, - * because none of the Table implementations allow them. - */ - public static final class ConfigurationHolder implements Serializable { - private final BuildConfiguration configuration; - - public ConfigurationHolder(BuildConfiguration configuration) { - this.configuration = configuration; - } - - public BuildConfiguration getConfiguration() { - return configuration; - } - - @Override - public int hashCode() { - return configuration == null ? 0 : configuration.hashCode(); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ConfigurationHolder)) { - return false; - } - return Objects.equals(configuration, ((ConfigurationHolder) o).configuration); - } - } } diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java index eab48fd588..777c9e8dbc 100644 --- a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java +++ b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java @@ -139,7 +139,6 @@ public final class BuildTool { env.setupPackageCache(request, DefaultsPackage.getDefaultsPackageContent(buildOptions)); ExecutionTool executionTool = null; - BuildConfigurationCollection configurations; boolean catastrophe = false; try { env.getEventBus().post(new BuildStartingEvent(env, request)); @@ -189,10 +188,9 @@ public final class BuildTool { env.throwPendingException(); // Configuration creation. - // TODO(gregce): BuildConfigurationCollection is important for static configs, less so for - // dynamic configs. Consider dropping it outright and passing on-the-fly target / host configs - // directly when needed (although this could be hard when Skyframe is unavailable). - configurations = + // TODO(gregce): Consider dropping this phase and passing on-the-fly target / host configs as + // needed. This requires cleaning up the invalidation in SkyframeBuildView.setConfigurations. + BuildConfigurationCollection configurations = env.getSkyframeExecutor() .createConfigurations( env.getReporter(), diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java index 99f0a5ef1b..6ce21e2db5 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java @@ -124,7 +124,7 @@ public class InfoCommand implements BlazeCommand { runtime.getConfigurationFragmentFactories()); // TODO(bazel-team): What if there are multiple configurations? [multi-config] return env.getSkyframeExecutor().getConfiguration( - env.getReporter(), runtime.createBuildOptions(optionsProvider)); + env.getReporter(), runtime.createBuildOptions(optionsProvider), /*keepGoing=*/true); } catch (InvalidConfigurationException e) { env.getReporter().handle(Event.error(e.getMessage())); throw new ExitCausingRuntimeException(ExitCode.COMMAND_LINE_ERROR); 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 9c952acb78..8ddecaf657 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 @@ -1075,19 +1075,8 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { boolean keepGoing) throws InvalidConfigurationException, InterruptedException { setConfigurationFragmentFactories(configurationFragmentFactories); - return createDynamicConfigurations(eventHandler, buildOptions, multiCpu); - } - - /** - * {@link #createConfigurations} implementation that creates the configurations dynamically. - */ - private BuildConfigurationCollection createDynamicConfigurations( - ExtendedEventHandler eventHandler, - BuildOptions buildOptions, - Set<String> multiCpu) - throws InvalidConfigurationException, InterruptedException { List<BuildConfiguration> topLevelTargetConfigs = - getConfigurations(eventHandler, getTopLevelBuildOptions(buildOptions, multiCpu)); + getConfigurations(eventHandler, getTopLevelBuildOptions(buildOptions, multiCpu), keepGoing); // The host configuration inherits the data, not target options. This is so host tools don't // apply LIPO. @@ -1104,7 +1093,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { dataOptions.get(BuildConfiguration.Options.class).useDistinctHostConfiguration ? HostTransition.INSTANCE.apply(dataOptions) : dataOptions; - BuildConfiguration hostConfig = getConfiguration(eventHandler, hostOptions); + BuildConfiguration hostConfig = getConfiguration(eventHandler, hostOptions, keepGoing); // TODO(gregce): cache invalid option errors in BuildConfigurationFunction, then use a dedicated // accessor (i.e. not the event handler) to trigger the exception below. @@ -1365,9 +1354,9 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { * @throws InvalidConfigurationException if the build options produces an invalid configuration */ public BuildConfiguration getConfiguration(ExtendedEventHandler eventHandler, - BuildOptions options) throws InvalidConfigurationException { + BuildOptions options, boolean keepGoing) throws InvalidConfigurationException { return Iterables.getOnlyElement( - getConfigurations(eventHandler, ImmutableList.<BuildOptions>of(options))); + getConfigurations(eventHandler, ImmutableList.of(options), keepGoing)); } /** @@ -1377,7 +1366,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { * @throws InvalidConfigurationException if any build options produces an invalid configuration */ public List<BuildConfiguration> getConfigurations(ExtendedEventHandler eventHandler, - List<BuildOptions> optionsList) throws InvalidConfigurationException { + List<BuildOptions> optionsList, boolean keepGoing) throws InvalidConfigurationException { Preconditions.checkArgument(!Iterables.isEmpty(optionsList)); // Prepare the Skyframe inputs. @@ -1395,7 +1384,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { // Skyframe-evaluate the configurations and throw errors if any. EvaluationResult<SkyValue> evalResult = - evaluateSkyKeys(eventHandler, configSkyKeys, /*keepGoing=*/true); + evaluateSkyKeys(eventHandler, configSkyKeys, keepGoing); if (evalResult.hasError()) { Map.Entry<SkyKey, ErrorInfo> firstError = Iterables.get(evalResult.errorMap().entrySet(), 0); ErrorInfo error = firstError.getValue(); |