diff options
author | ccalvarin <ccalvarin@google.com> | 2017-08-14 21:09:07 +0200 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2017-08-16 11:04:41 +0200 |
commit | 1cbe62a09b37f2db76e11ebb18fb46616076ef87 (patch) | |
tree | f02a66fc345507f3eb3ab3bbe404fdcb161cbabc /src/main/java/com/google/devtools/build/lib/runtime/CommandExecutor.java | |
parent | fc6412ca67a9d98c1b6b0c8b237c119e543bc266 (diff) |
Send Bazel startup options to server.
Send the startup options tagged with their origin so that the server has correct information about the command line as the client received it.
Removes the unconditional stderr printing of all bazelrc startup options in the bazel client. Instead, the startup options are sent to the server and the same informational printing is gated on the --announce_rc option. This avoids unconditional log spam to stderr early in startup. If the server is unreachable or there are errors parsing startup options, the message is still printed to stderr.
Fixes https://github.com/bazelbuild/bazel/issues/2530.
RELNOTES: --announce_rc now controls whether bazelrc startup options are printed to stderr.
PiperOrigin-RevId: 165211007
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/CommandExecutor.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/CommandExecutor.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommandExecutor.java b/src/main/java/com/google/devtools/build/lib/runtime/CommandExecutor.java index 3b70c8656a..3d2b46d310 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/CommandExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/CommandExecutor.java @@ -13,12 +13,15 @@ // limitations under the License. package com.google.devtools.build.lib.runtime; +import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.LockingMode; import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.InvocationPolicy; import com.google.devtools.build.lib.server.ServerCommand; +import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.util.io.OutErr; import java.io.PrintWriter; import java.io.StringWriter; import java.util.List; +import java.util.Optional; import java.util.logging.Logger; /** @@ -44,14 +47,22 @@ public class CommandExecutor implements ServerCommand { InvocationPolicy invocationPolicy, List<String> args, OutErr outErr, - BlazeCommandDispatcher.LockingMode lockingMode, + LockingMode lockingMode, String clientDescription, - long firstContactTime) throws InterruptedException { + long firstContactTime, + Optional<List<Pair<String, String>>> startupOptionsTaggedWithBazelRc) + throws InterruptedException { LOG.info(BlazeRuntime.getRequestLogString(args)); try { - return dispatcher.exec(invocationPolicy, args, outErr, lockingMode, clientDescription, - firstContactTime); + return dispatcher.exec( + invocationPolicy, + args, + outErr, + lockingMode, + clientDescription, + firstContactTime, + startupOptionsTaggedWithBazelRc); } catch (BlazeCommandDispatcher.ShutdownBlazeServerException e) { if (e.getCause() != null) { StringWriter message = new StringWriter(); |