diff options
author | 2017-03-03 14:44:56 +0000 | |
---|---|---|
committer | 2017-03-06 09:44:47 +0000 | |
commit | 934c1d5e1340bbae9bd7b61a9f3aa3029c7c2c1c (patch) | |
tree | e5c435a62441ccc6daff1228372fc945e03390ec /src/main/java | |
parent | 0768f3e444a121c5c8e8e0bd0bb98772fab0e0e2 (diff) |
Allow ' ', '(', ')' and '$' in labels
This just add the special characters in labels and fixes the
associated tests, left is the hard part to test adding
those characters everywhere.
This is experimental and several characters will break at several
location especial in the runfiles manifest file.
Follow-ups: Resolve quoting then test, test more and add even more tests.
Issue found during development:
Parentheses are not accepted in exclude pattern in globs
Building a binary includes build-runfiles that relies on the runfiles
manifest format so the added test would fails with a java_binary
instead of a library.
--
Change-Id: I9c87273a90318b931c61bdb86f1066962819960a
Reviewed-on: https://cr.bazel.build/9055
PiperOrigin-RevId: 149108027
MOS_MIGRATED_REVID=149108027
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java b/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java index 035bfbbe4d..a2f419eb23 100644 --- a/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java +++ b/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java @@ -25,7 +25,7 @@ import javax.annotation.Nullable; public final class LabelValidator { /** Matches punctuation in target names which requires quoting in a blaze query. */ - private static final CharMatcher PUNCTUATION_REQUIRING_QUOTING = CharMatcher.anyOf("+,=~#"); + private static final CharMatcher PUNCTUATION_REQUIRING_QUOTING = CharMatcher.anyOf("+,=~# ()$"); /** * Matches punctuation in target names which doesn't require quoting in a blaze query. @@ -36,13 +36,13 @@ public final class LabelValidator { private static final CharMatcher PUNCTUATION_NOT_REQUIRING_QUOTING = CharMatcher.anyOf("_@-"); /** - * Matches characters allowed in package name (allowed are A-Z, a-z, 0-9, '/', '-', '.' and '_') + * Matches characters allowed in package name. */ private static final CharMatcher ALLOWED_CHARACTERS_IN_PACKAGE_NAME = CharMatcher.inRange('0', '9') .or(CharMatcher.inRange('a', 'z')) .or(CharMatcher.inRange('A', 'Z')) - .or(CharMatcher.anyOf("/-._")) + .or(CharMatcher.anyOf("/-._ $()")) .precomputed(); /** @@ -59,7 +59,7 @@ public final class LabelValidator { @VisibleForTesting static final String PACKAGE_NAME_ERROR = - "package names may contain only A-Z, a-z, 0-9, '/', '-', '.' and '_'"; + "package names may contain only A-Z, a-z, 0-9, '/', '-', '.', ' ', '$', '(', ')' and '_'"; @VisibleForTesting static final String PACKAGE_NAME_DOT_ERROR = |