Convert non-informative multiple options' default values (e.g. "n/a") to "null".
Multiple options (allowMultiple = true) used to silently ignore their specified default values. This cange is a pre-requisite to making it more explicit by disallowing default values for multiple option.
RELNOTES: None.
PiperOrigin-RevId: 310880523
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
index ea42a1f..e1ae2a7 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
@@ -36,9 +36,7 @@
import java.util.UUID;
import java.util.logging.Level;
-/**
- * Options common to all commands.
- */
+/** Options common to all commands. */
public class CommonCommandOptions extends OptionsBase {
/**
@@ -85,42 +83,38 @@
public List<String> configs;
@Option(
- name = "logging",
- defaultValue = "3", // Level.INFO
- documentationCategory = OptionDocumentationCategory.LOGGING,
- effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
- converter = Converters.LogLevelConverter.class,
- help = "The logging level."
- )
+ name = "logging",
+ defaultValue = "3", // Level.INFO
+ documentationCategory = OptionDocumentationCategory.LOGGING,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
+ converter = Converters.LogLevelConverter.class,
+ help = "The logging level.")
public Level verbosity;
@Option(
- name = "client_cwd",
- defaultValue = "",
- documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
- metadataTags = {OptionMetadataTag.HIDDEN},
- effectTags = {OptionEffectTag.CHANGES_INPUTS},
- converter = OptionsUtils.PathFragmentConverter.class,
- help = "A system-generated parameter which specifies the client's working directory"
- )
+ name = "client_cwd",
+ defaultValue = "",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ metadataTags = {OptionMetadataTag.HIDDEN},
+ effectTags = {OptionEffectTag.CHANGES_INPUTS},
+ converter = OptionsUtils.PathFragmentConverter.class,
+ help = "A system-generated parameter which specifies the client's working directory")
public PathFragment clientCwd;
@Option(
- name = "announce_rc",
- defaultValue = "false",
- documentationCategory = OptionDocumentationCategory.LOGGING,
- effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
- help = "Whether to announce rc options."
- )
+ name = "announce_rc",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.LOGGING,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
+ help = "Whether to announce rc options.")
public boolean announceRcOptions;
@Option(
- name = "always_profile_slow_operations",
- defaultValue = "true",
- documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
- effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
- help = "Whether profiling slow operations is always turned on"
- )
+ name = "always_profile_slow_operations",
+ defaultValue = "true",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
+ help = "Whether profiling slow operations is always turned on")
public boolean alwaysProfileSlowOperations;
/** Converter for UUID. Accepts values as specified by {@link UUID#fromString(String)}. */
@@ -266,7 +260,7 @@
@Option(
name = "experimental_profile_additional_tasks",
converter = ProfilerTaskConverter.class,
- defaultValue = "none",
+ defaultValue = "null",
allowMultiple = true,
documentationCategory = OptionDocumentationCategory.LOGGING,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_MONITORING},
@@ -334,28 +328,26 @@
public boolean recordFullProfilerData;
@Option(
- name = "memory_profile",
- defaultValue = "null",
- documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
- effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_MONITORING},
- converter = OptionsUtils.PathFragmentConverter.class,
- help =
- "If set, write memory usage data to the specified file at phase ends and stable heap to"
- + " master log at end of build."
- )
+ name = "memory_profile",
+ defaultValue = "null",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_MONITORING},
+ converter = OptionsUtils.PathFragmentConverter.class,
+ help =
+ "If set, write memory usage data to the specified file at phase ends and stable heap to"
+ + " master log at end of build.")
public PathFragment memoryProfilePath;
@Option(
- name = "memory_profile_stable_heap_parameters",
- defaultValue = "1,0",
- documentationCategory = OptionDocumentationCategory.LOGGING,
- effectTags = {OptionEffectTag.BAZEL_MONITORING},
- converter = MemoryProfileStableHeapParameters.Converter.class,
- help =
- "Tune memory profile's computation of stable heap at end of build. Should be two integers "
- + "separated by a comma. First parameter is the number of GCs to perform. Second "
- + "parameter is the number of seconds to wait between GCs."
- )
+ name = "memory_profile_stable_heap_parameters",
+ defaultValue = "1,0",
+ documentationCategory = OptionDocumentationCategory.LOGGING,
+ effectTags = {OptionEffectTag.BAZEL_MONITORING},
+ converter = MemoryProfileStableHeapParameters.Converter.class,
+ help =
+ "Tune memory profile's computation of stable heap at end of build. Should be two"
+ + " integers separated by a comma. First parameter is the number of GCs to perform."
+ + " Second parameter is the number of seconds to wait between GCs.")
public MemoryProfileStableHeapParameters memoryProfileStableHeapParameters;
@Option(
@@ -404,13 +396,12 @@
public String toolTag;
@Option(
- name = "restart_reason",
- defaultValue = "no_restart",
- documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
- effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_MONITORING},
- metadataTags = {OptionMetadataTag.HIDDEN},
- help = "The reason for the server restart."
- )
+ name = "restart_reason",
+ defaultValue = "no_restart",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_MONITORING},
+ metadataTags = {OptionMetadataTag.HIDDEN},
+ help = "The reason for the server restart.")
public String restartReason;
@Option(
@@ -423,25 +414,23 @@
public String binaryPath;
@Option(
- name = "experimental_allow_project_files",
- defaultValue = "false",
- documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
- effectTags = {OptionEffectTag.CHANGES_INPUTS},
- metadataTags = {OptionMetadataTag.EXPERIMENTAL, OptionMetadataTag.HIDDEN},
- help = "Enable processing of +<file> parameters."
- )
+ name = "experimental_allow_project_files",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.CHANGES_INPUTS},
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL, OptionMetadataTag.HIDDEN},
+ help = "Enable processing of +<file> parameters.")
public boolean allowProjectFiles;
@Option(
- name = "block_for_lock",
- defaultValue = "true",
- documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
- effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
- metadataTags = {OptionMetadataTag.HIDDEN},
- help =
- "If set (the default), a command will block if there is another one running. If "
- + "unset, these commands will immediately return with an error."
- )
+ name = "block_for_lock",
+ defaultValue = "true",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
+ metadataTags = {OptionMetadataTag.HIDDEN},
+ help =
+ "If set (the default), a command will block if there is another one running. If "
+ + "unset, these commands will immediately return with an error.")
public boolean blockForLock;
// We could accept multiple of these, in the event where there's a chain of tools that led to a
@@ -449,21 +438,20 @@
// to guarantee that the "label" for each command line is unique. Unless a need is demonstrated,
// though, logs are a better place to track this information than flags, so let's try to avoid it.
@Option(
- // In May 2018, this feature will have been out for 6 months. If the format we accept has not
- // changed in that time, we can remove the "experimental" prefix and tag.
- name = "experimental_tool_command_line",
- defaultValue = "",
- documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
- effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
- // Keep this flag HIDDEN so that it is not listed with our reported command lines, it being
- // reported separately.
- metadataTags = {OptionMetadataTag.EXPERIMENTAL, OptionMetadataTag.HIDDEN},
- converter = ToolCommandLineEvent.Converter.class,
- help =
- "An extra command line to report with this invocation's command line. Useful for tools "
- + "that invoke Bazel and want the original information that the tool received to be "
- + "logged with the rest of the Bazel invocation."
- )
+ // In May 2018, this feature will have been out for 6 months. If the format we accept has not
+ // changed in that time, we can remove the "experimental" prefix and tag.
+ name = "experimental_tool_command_line",
+ defaultValue = "",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
+ // Keep this flag HIDDEN so that it is not listed with our reported command lines, it being
+ // reported separately.
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL, OptionMetadataTag.HIDDEN},
+ converter = ToolCommandLineEvent.Converter.class,
+ help =
+ "An extra command line to report with this invocation's command line. Useful for tools "
+ + "that invoke Bazel and want the original information that the tool received to be "
+ + "logged with the rest of the Bazel invocation.")
public ToolCommandLineEvent toolCommandLine;
@Option(
@@ -490,8 +478,7 @@
"If false, Blaze will not persist data that allows for invalidation and re-evaluation "
+ "on incremental builds in order to save memory on this build. Subsequent builds "
+ "will not have any incrementality with respect to this one. Usually you will want "
- + "to specify --batch when setting this to false."
- )
+ + "to specify --batch when setting this to false.")
public boolean trackIncrementalState;
@Option(
@@ -502,8 +489,7 @@
help =
"If false, Blaze will discard the inmemory state from this build when the build "
+ "finishes. Subsequent builds will not have any incrementality with respect to this "
- + "one."
- )
+ + "one.")
public boolean keepStateAfterBuild;
/** The option converter to check that the user can only specify legal profiler tasks. */