| commit | 9993785fa0c4fa4172aa31d306f3abea76833abf | [log] [tgz] |
|---|---|---|
| author | aiuto <aiuto@google.com> | Mon Aug 17 21:29:50 2020 -0700 |
| committer | Copybara-Service <copybara-worker@google.com> | Mon Aug 17 21:30:56 2020 -0700 |
| tree | 21585b518e6853c5a45d6d4921bb08b406f28a3d | |
| parent | b9706675a7abf6ceebb250f0b3dfa4087a0c35f6 [diff] |
Allow dot ('.') in workspace names.
RELNOTES: Dot ('.') is now allowed in workspace names. See https://github.com/bazelbuild/bazel/issues/11837.
PiperOrigin-RevId: 327160423
diff --git a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceGlobals.java b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceGlobals.java index ab98b38..b024078 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceGlobals.java +++ b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceGlobals.java
@@ -50,7 +50,7 @@ public class WorkspaceGlobals implements WorkspaceGlobalsApi { // Must start with a letter and can contain letters, numbers, underscores and hyphens. - private static final Pattern LEGAL_WORKSPACE_NAME = Pattern.compile("^\\p{Alpha}[\\w-]*$"); + private static final Pattern LEGAL_WORKSPACE_NAME = Pattern.compile("^\\p{Alpha}[-.\\w]*$"); private final boolean allowOverride; private final RuleFactory ruleFactory;
diff --git a/src/test/java/com/google/devtools/build/lib/packages/WorkspaceFactoryTest.java b/src/test/java/com/google/devtools/build/lib/packages/WorkspaceFactoryTest.java index 7d1e676..c153fd4 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/WorkspaceFactoryTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/WorkspaceFactoryTest.java
@@ -53,8 +53,8 @@ @Test public void testWorkspaceWithIllegalCharacters() throws Exception { - helper.parse("workspace(name = 'a.b.c')"); - assertThat(helper.getParserError()).contains("a.b.c is not a legal workspace name"); + helper.parse("workspace(name = 'a+b+c')"); + assertThat(helper.getParserError()).contains("a+b+c is not a legal workspace name"); } @Test