aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java
diff options
context:
space:
mode:
authorGravatar ccalvarin <ccalvarin@google.com>2017-08-14 21:09:07 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-08-16 11:04:41 +0200
commit1cbe62a09b37f2db76e11ebb18fb46616076ef87 (patch)
treef02a66fc345507f3eb3ab3bbe404fdcb161cbabc /src/main/java/com/google/devtools/build/lib/server/ServerCommand.java
parentfc6412ca67a9d98c1b6b0c8b237c119e543bc266 (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/server/ServerCommand.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/server/ServerCommand.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java b/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java
index ef5f727bdb..f0574cdbaa 100644
--- a/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java
@@ -15,8 +15,10 @@ package com.google.devtools.build.lib.server;
import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher;
import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.InvocationPolicy;
+import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.util.io.OutErr;
import java.util.List;
+import java.util.Optional;
/**
* The {@link RPCServer} calls an arbitrary command implementing this
@@ -25,8 +27,13 @@ import java.util.List;
public interface ServerCommand {
/**
- * Executes the request, writing any output or error messages into err.
- * Returns 0 on success; any other value or exception indicates an error.
+ * Executes the request, writing any output or error messages into err. Returns 0 on success; any
+ * other value or exception indicates an error.
+ *
+ * @param startupOptionsTaggedWithBazelRc List of startup options in Pair(bazelRc, option) form.
+ * The empty string bazelRc is interpreted as the command line, and option should be in
+ * --[no]flag or --flag=value form. If we don't have access to this information (--batch),
+ * leave this parameter as Optional.empty().
*/
int exec(
InvocationPolicy policy,
@@ -34,7 +41,9 @@ public interface ServerCommand {
OutErr outErr,
BlazeCommandDispatcher.LockingMode lockingMode,
String clientDescription,
- long firstContactTime) throws InterruptedException;
+ long firstContactTime,
+ Optional<List<Pair<String, String>>> startupOptionsTaggedWithBazelRc)
+ throws InterruptedException;
/**
* Whether the server needs to be shut down.