aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-02-27 13:08:48 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-03-04 15:38:03 +0000
commit418f4ca6b4991ec51fae7a36b7d13fde5f0d96db (patch)
tree7247fd7283fd7e18df6c306b19b0d001bd42a913 /src/main/java/com/google/devtools/build/lib
parentca3cf535bfe17dade9f6c78d1eded301a54075cd (diff)
Remove --compile_only and --compilation_prerequisites_only; --output_groups can be used in their stead.
-- MOS_MIGRATED_REVID=87334648
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildtool/BuildRequest.java57
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/TestCommand.java32
3 files changed, 23 insertions, 72 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/BuildRequest.java b/src/main/java/com/google/devtools/build/lib/buildtool/BuildRequest.java
index 0b56fa06d8..c9133d0fb3 100644
--- a/src/main/java/com/google/devtools/build/lib/buildtool/BuildRequest.java
+++ b/src/main/java/com/google/devtools/build/lib/buildtool/BuildRequest.java
@@ -24,7 +24,6 @@ import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BuildView;
import com.google.devtools.build.lib.analysis.TopLevelArtifactContext;
import com.google.devtools.build.lib.analysis.TopLevelArtifactProvider;
-import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Options;
import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException;
import com.google.devtools.build.lib.exec.ExecutionOptions;
import com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner;
@@ -214,21 +213,6 @@ public class BuildRequest implements OptionsClassProvider {
+ "those phases.")
public boolean performExecutionPhase;
- @Option(name = "compile_only",
- defaultValue = "false",
- category = "what",
- help = "If specified, Blaze will only build files that are generated by lightweight "
- + "compilation actions, skipping more expensive build steps (such as linking).")
- public boolean compileOnly;
-
- @Option(name = "compilation_prerequisites_only",
- defaultValue = "false",
- category = "what",
- help = "If specified, Blaze will only build files that are prerequisites to compilation "
- + "of the given target (for example, generated source files and headers) without "
- + "building the target itself. This flag is ignored if --compile_only is enabled.")
- public boolean compilationPrerequisitesOnly;
-
@Option(name = "output_groups",
converter = Converters.CommaSeparatedOptionListConverter.class,
allowMultiple = true,
@@ -237,14 +221,6 @@ public class BuildRequest implements OptionsClassProvider {
help = "Specifies, which output groups of the top-level target to build.")
public List<String> outputGroups;
- @Option(name = "build_default_artifacts",
- defaultValue = "true",
- category = "undocumented",
- help = "Whether to build the files to build of the configured targets on the command line. "
- + "If false, only the artifacts specified by --output_groups is built. The default "
- + "is true.")
- public boolean buildDefaultArtifacts;
-
@Option(name = "show_result",
defaultValue = "1",
category = "verbosity",
@@ -520,10 +496,6 @@ public class BuildRequest implements OptionsClassProvider {
if (getBuildOptions().verboseExplanations && getBuildOptions().explanationPath == null) {
warnings.add("--verbose_explanations has no effect when --explain=<file> is not enabled");
}
- if (getBuildOptions().compileOnly && getBuildOptions().compilationPrerequisitesOnly) {
- throw new InvalidConfigurationException(
- "--compile_only and --compilation_prerequisites_only are not compatible");
- }
return warnings;
}
@@ -540,30 +512,13 @@ public class BuildRequest implements OptionsClassProvider {
current.add(TopLevelArtifactProvider.TEMP_FILES);
current.add(TopLevelArtifactProvider.HIDDEN_TOP_LEVEL);
current.add(TopLevelArtifactProvider.DEFAULT);
- current.addAll(getBuildOptions().outputGroups);
-
- if (getOptions(Options.class).collectCodeCoverage && runTests) {
- current.add(TopLevelArtifactProvider.BASELINE_COVERAGE);
- }
-
- BuildRequestOptions options = getOptions(BuildRequestOptions.class);
- if (!options.buildDefaultArtifacts) {
- current.remove(TopLevelArtifactProvider.DEFAULT);
- current.remove(TopLevelArtifactProvider.HIDDEN_TOP_LEVEL);
- }
-
- if (options.compileOnly) {
- current.add(TopLevelArtifactProvider.FILES_TO_COMPILE);
- current.remove(TopLevelArtifactProvider.BASELINE_COVERAGE);
- current.remove(TopLevelArtifactProvider.DEFAULT);
- current.remove(TopLevelArtifactProvider.HIDDEN_TOP_LEVEL);
- }
- if (options.compilationPrerequisitesOnly) {
- current.add(TopLevelArtifactProvider.COMPILATION_PREREQUISITES);
- current.remove(TopLevelArtifactProvider.BASELINE_COVERAGE);
- current.remove(TopLevelArtifactProvider.DEFAULT);
- current.remove(TopLevelArtifactProvider.HIDDEN_TOP_LEVEL);
+ for (String outputGroup : getBuildOptions().outputGroups) {
+ if (outputGroup.startsWith("-")) {
+ current.remove(outputGroup.substring(1));
+ } else {
+ current.add(outputGroup);
+ }
}
return ImmutableSortedSet.copyOf(current);
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
index b128d372ab..472b8d6741 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
@@ -144,12 +144,6 @@ public class RunCommand implements BlazeCommand {
this.getClass().getAnnotation(Command.class).name(), options,
runtime.getStartupOptionsProvider(), targets, outErr,
runtime.getCommandId(), runtime.getCommandStartTime());
- if (request.getBuildOptions().compileOnly) {
- String message = "The '" + getClass().getAnnotation(Command.class).name() +
- "' command is incompatible with the --compile_only option";
- runtime.getReporter().handle(Event.error(message));
- return ExitCode.COMMAND_LINE_ERROR;
- }
currentRunUnder = runUnder;
BuildResult result;
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/TestCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/TestCommand.java
index 561c54a5b2..094add61a3 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/TestCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/TestCommand.java
@@ -16,6 +16,8 @@ package com.google.devtools.build.lib.runtime.commands;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
+import com.google.devtools.build.lib.analysis.TopLevelArtifactProvider;
+import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.buildtool.BuildRequest;
import com.google.devtools.build.lib.buildtool.BuildResult;
import com.google.devtools.build.lib.events.Event;
@@ -62,17 +64,23 @@ public class TestCommand implements BlazeCommand {
TestOutputFormat testOutput = optionsParser.getOptions(ExecutionOptions.class).testOutput;
- if (testOutput == TestStrategy.TestOutputFormat.STREAMED) {
- runtime.getReporter().handle(Event.warn(
- "Streamed test output requested so all tests will be run locally, without sharding, " +
- "one at a time"));
- try {
+ try {
+ if (testOutput == TestStrategy.TestOutputFormat.STREAMED) {
+ runtime.getReporter().handle(Event.warn(
+ "Streamed test output requested so all tests will be run locally, without sharding, " +
+ "one at a time"));
+ optionsParser.parse(OptionPriority.SOFTWARE_REQUIREMENT,
+ "streamed output requires locally run tests, without sharding",
+ ImmutableList.of("--test_sharding_strategy=disabled", "--test_strategy=exclusive"));
+ }
+
+ if (optionsParser.getOptions(BuildConfiguration.Options.class).collectCodeCoverage) {
optionsParser.parse(OptionPriority.SOFTWARE_REQUIREMENT,
- "streamed output requires locally run tests, without sharding",
- ImmutableList.of("--test_sharding_strategy=disabled", "--test_strategy=exclusive"));
- } catch (OptionsParsingException e) {
- throw new IllegalStateException("Known options failed to parse", e);
+ "baseline coverage artifacts are built with running tests with coverage collection",
+ ImmutableList.of("--output_groups=" + TopLevelArtifactProvider.BASELINE_COVERAGE));
}
+ } catch (OptionsParsingException e) {
+ throw new IllegalStateException("Known options failed to parse", e);
}
}
@@ -104,12 +112,6 @@ public class TestCommand implements BlazeCommand {
getClass().getAnnotation(Command.class).name(), options,
runtime.getStartupOptionsProvider(), targets,
runtime.getReporter().getOutErr(), runtime.getCommandId(), runtime.getCommandStartTime());
- if (request.getBuildOptions().compileOnly) {
- String message = "The '" + getClass().getAnnotation(Command.class).name() +
- "' command is incompatible with the --compile_only option";
- runtime.getReporter().handle(Event.error(message));
- return ExitCode.COMMAND_LINE_ERROR;
- }
request.setRunTests();
BuildResult buildResult = runtime.getBuildTool().processRequest(request, null);