diff options
author | janakr <janakr@google.com> | 2017-10-30 18:14:10 -0400 |
---|---|---|
committer | John Cater <jcater@google.com> | 2017-10-31 10:39:57 -0400 |
commit | 5625e7e02def24a91bfa0b99ecf428bc823a50d5 (patch) | |
tree | d2d8961312ac7e49e6572b43bb45ba5c3d6de342 /src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java | |
parent | 5af6138f293985bb13e3ae46eab7ac8e10ab6db1 (diff) |
Automated rollback of commit c6b6dbadd0a93936c51154b25abc5fbba8f2d1af.
Not a totally clean rollback because of the intervening https://github.com/bazelbuild/bazel/commit/b5158a9a677b149e04e844c40a01e9a9dde40783.
*** Reason for rollback ***
PiperOrigin-RevId: 173957187
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java | 84 |
1 files changed, 0 insertions, 84 deletions
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 29fa7d09c9..1f4e0d738f 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 @@ -13,21 +13,16 @@ // limitations under the License. package com.google.devtools.build.lib.runtime; -import static com.google.common.base.Strings.isNullOrEmpty; - import com.google.devtools.build.lib.runtime.CommandLineEvent.ToolCommandLineEvent; import com.google.devtools.build.lib.util.OptionsUtils; import com.google.devtools.build.lib.vfs.PathFragment; -import com.google.devtools.common.options.Converter; import com.google.devtools.common.options.Converters; import com.google.devtools.common.options.Option; import com.google.devtools.common.options.OptionDocumentationCategory; import com.google.devtools.common.options.OptionEffectTag; import com.google.devtools.common.options.OptionMetadataTag; import com.google.devtools.common.options.OptionsBase; -import com.google.devtools.common.options.OptionsParsingException; import java.util.List; -import java.util.UUID; import java.util.logging.Level; /** @@ -35,58 +30,6 @@ import java.util.logging.Level; */ public class CommonCommandOptions extends OptionsBase { - /** Converter for UUID. Accepts values as specified by {@link UUID#fromString(String)}. */ - public static class UUIDConverter implements Converter<UUID> { - - @Override - public UUID convert(String input) throws OptionsParsingException { - if (isNullOrEmpty(input)) { - return null; - } - try { - return UUID.fromString(input); - } catch (IllegalArgumentException e) { - throw new OptionsParsingException( - String.format("Value '%s' is not a value UUID.", input), e); - } - } - - @Override - public String getTypeDescription() { - return "a UUID"; - } - } - - /** - * Converter for options (--build_request_id) that accept prefixed UUIDs. Since we do not care - * about the structure of this value after validation, we store it as a string. - */ - public static class PrefixedUUIDConverter implements Converter<String> { - - @Override - public String convert(String input) throws OptionsParsingException { - if (isNullOrEmpty(input)) { - return null; - } - // UUIDs that are accepted by UUID#fromString have 36 characters. Interpret the last 36 - // characters as an UUID and the rest as a prefix. We do not check anything about the contents - // of the prefix. - try { - int uuidStartIndex = input.length() - 36; - UUID.fromString(input.substring(uuidStartIndex)); - } catch (IllegalArgumentException | IndexOutOfBoundsException e) { - throw new OptionsParsingException( - String.format("Value '%s' does end in a valid UUID.", input), e); - } - return input; - } - - @Override - public String getTypeDescription() { - return "An optionally prefixed UUID. The last 36 characters will be verified as a UUID."; - } - } - // To create a new incompatible change, see the javadoc for AllIncompatibleChangesExpansion. @Option( name = "all_incompatible_changes", @@ -269,33 +212,6 @@ public class CommonCommandOptions extends OptionsBase { ) public String toolTag; - // Command ID and build request ID can be set either by flag or environment variable. In most - // cases, the internally generated ids should be sufficient, but we allow these to be set - // externally if required. Option wins over environment variable, if both are set. - // TODO(b/67895628) Stop reading ids from the environment after the compatibility window has - // passed. - @Option( - name = "invocation_id", - defaultValue = "", - converter = UUIDConverter.class, - documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, - effectTags = {OptionEffectTag.BAZEL_MONITORING, OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION}, - metadataTags = {OptionMetadataTag.HIDDEN}, - help = "Unique identifier for the command being run." - ) - public UUID invocationId; - - @Option( - name = "build_request_id", - defaultValue = "", - converter = PrefixedUUIDConverter.class, - documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, - effectTags = {OptionEffectTag.BAZEL_MONITORING, OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION}, - metadataTags = {OptionMetadataTag.HIDDEN}, - help = "Unique identifier for the build being run." - ) - public String buildRequestId; - @Option( name = "restart_reason", defaultValue = "no_restart", |