aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
diff options
context:
space:
mode:
authorGravatar ccalvarin <ccalvarin@google.com>2017-10-10 05:29:56 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-10-10 11:24:42 +0200
commitceb1013c1ca0238188e2714442fcfb2efb16bc6a (patch)
tree2cdd1a3a21e716a7653c8be61d39d8b2396c7bb0 /src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
parent43edc92ac185ee2f1b8d0db31943ec1655b43434 (diff)
Report the structured Bazel command line via the BEP.
This is part of the effort outlined in https://bazel.build/designs/2017/07/13/improved-command-line-reporting.html. The refactoring of the options parser is not yet complete, so we still do not have complete & correct information about the canonical command line. Where the information is blatantly incorrect, a best approximation was made, with comments and tests documenting the deficiencies. Change the names of the initial CommandLine fields in the BEP to be explicitly identified as unstructured. RELNOTES: None. PiperOrigin-RevId: 171625377
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
index 5bd9ad9f54..12d87af3ce 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
@@ -231,9 +231,14 @@ public class BlazeCommandDispatcher {
parseOptionsForCommand(rcfileNotes, commandAnnotation, optionsParser, optionsMap, null, null);
if (commandAnnotation.builds()) {
+ // splits project files from targets in the traditional sense
ProjectFileSupport.handleProjectFiles(
- eventHandler, runtime.getProjectFileProvider(), workspaceDirectory, workingDirectory,
- optionsParser, commandAnnotation.name());
+ eventHandler,
+ runtime.getProjectFileProvider(),
+ workspaceDirectory,
+ workingDirectory,
+ optionsParser,
+ commandAnnotation.name());
}
// Fix-point iteration until all configs are loaded.
@@ -276,7 +281,8 @@ public class BlazeCommandDispatcher {
long firstContactTime,
Optional<List<Pair<String, String>>> startupOptionsTaggedWithBazelRc)
throws ShutdownBlazeServerException, InterruptedException {
- OriginalCommandLineEvent originalCommandLine = new OriginalCommandLineEvent(args);
+ OriginalUnstructuredCommandLineEvent originalCommandLine =
+ new OriginalUnstructuredCommandLineEvent(args);
Preconditions.checkNotNull(clientDescription);
if (args.isEmpty()) { // Default to help command if no arguments specified.
args = HELP_COMMAND;
@@ -370,7 +376,7 @@ public class BlazeCommandDispatcher {
}
private int execExclusively(
- OriginalCommandLineEvent originalCommandLine,
+ OriginalUnstructuredCommandLineEvent unstructuredServerCommandLineEvent,
InvocationPolicy invocationPolicy,
List<String> args,
OutErr outErr,
@@ -395,7 +401,11 @@ public class BlazeCommandDispatcher {
eventHandler, workspace, command, commandAnnotation, commandName, invocationPolicy, args,
optionsResult, rcfileNotes);
OptionsProvider options = optionsResult.get();
-
+ CommandLineEvent originalCommandLineEvent =
+ new CommandLineEvent.OriginalCommandLineEvent(
+ runtime, commandName, options, startupOptionsTaggedWithBazelRc);
+ CommandLineEvent canonicalCommandLineEvent =
+ new CommandLineEvent.CanonicalCommandLineEvent(runtime, commandName, options);
// The initCommand call also records the start time for the timestamp granularity monitor.
CommandEnvironment env = workspace.initCommand(commandAnnotation, options);
// Record the command's starting time for use by the commands themselves.
@@ -591,7 +601,11 @@ public class BlazeCommandDispatcher {
return e.getExitCode().getNumericExitCode();
}
- env.getEventBus().post(originalCommandLine);
+ // Log the command line now that the modules have all had a change to register their listeners
+ // to the event bus.
+ env.getEventBus().post(unstructuredServerCommandLineEvent);
+ env.getEventBus().post(originalCommandLineEvent);
+ env.getEventBus().post(canonicalCommandLineEvent);
for (BlazeModule module : runtime.getBlazeModules()) {
env.getSkyframeExecutor().injectExtraPrecomputedValues(module.getPrecomputedValues());