diff options
author | 2016-10-26 12:51:38 +0000 | |
---|---|---|
committer | 2016-10-27 09:23:05 +0000 | |
commit | 3d4868303d9b4a0b682de77cbe231d9e59771192 (patch) | |
tree | da91cb24293e46acb7609b76d2b40a2299e4b9c3 /src/main | |
parent | 1afb0b24ca35028bf994083d909ac9bf1776ba18 (diff) |
Clarify how startup options are conveyed between the client and the server.
--
MOS_MIGRATED_REVID=137266505
Diffstat (limited to 'src/main')
3 files changed, 20 insertions, 11 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index a4519c54bd..3f2883ef21 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -451,10 +451,12 @@ static vector<string> GetArgumentArray() { globals->extracted_binaries[0], &result); - // JVM arguments are complete. Now pass in Blaze startup flags. + // JVM arguments are complete. Now pass in Blaze startup options. + // Note that we always use the --flag=ARG form (instead of the --flag ARG one) + // so that BlazeRuntime#splitStartupOptions has an easy job. if (!globals->options->batch) { - result.push_back("--max_idle_secs"); - result.push_back(ToString(globals->options->max_idle_secs)); + result.push_back("--max_idle_secs=" + + ToString(globals->options->max_idle_secs)); } else { // --batch must come first in the arguments to Java main() because // the code expects it to be at args[0] if it's been set. @@ -1058,13 +1060,14 @@ static bool ServerNeedsToBeKilled(const vector<string>& args1, continue; } - if (args1[i] != args2[i]) { - return true; + string max_idle_secs = "--max_idle_secs="; + if (args1[i].substr(0, max_idle_secs.size()) == max_idle_secs && + args2[i].substr(0, max_idle_secs.size()) == max_idle_secs) { + continue; } - if (args1[i] == "--max_idle_secs") { - // Skip the argument of --max_idle_secs. - i++; + if (args1[i] != args2[i]) { + return true; } } diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoLibrary.java index 1a3d7c4bcf..6678202dcd 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoLibrary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoLibrary.java @@ -20,6 +20,7 @@ import static com.google.devtools.build.lib.collect.nestedset.Order.STABLE_ORDER import static com.google.devtools.build.lib.rules.java.proto.JavaLiteProtoAspect.LITE_PROTO_RUNTIME_ATTR; import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.OutputGroupProvider; @@ -48,7 +49,7 @@ public class JavaLiteProtoLibrary implements RuleConfiguredTargetFactory { JavaCompilationArgsProvider dependencyArgsProviders = JavaCompilationArgsProvider.merge( - transform( + Iterables.<JavaCompilationArgsAspectProvider, JavaCompilationArgsProvider>transform( getDeps(ruleContext, JavaCompilationArgsAspectProvider.class), JavaCompilationArgsAspectProvider.GET_PROVIDER)); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java index 9d040bd31d..5037ee6d3e 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java @@ -632,8 +632,13 @@ public final class BlazeRuntime { } /** - * Splits given arguments into two lists - arguments matching options defined in this class - * and everything else, while preserving order in each list. + * Splits given options into two lists - arguments matching options defined in this class and + * everything else, while preserving order in each list. + * + * <p>Note that this method relies on the startup options always being in the + * <code>--flag=ARG</code> form (instead of <code>--flag ARG</code>). This is enforced by + * <code>GetArgumentArray()</code> in <code>blaze.cc</code> by reconstructing the startup + * options from their parsed versions instead of using <code>argv</code> verbatim. */ static CommandLineOptions splitStartupOptions( Iterable<BlazeModule> modules, String... args) { |