From 9993785fa0c4fa4172aa31d306f3abea76833abf Mon Sep 17 00:00:00 2001 From: aiuto Date: Mon, 17 Aug 2020 21:29:50 -0700 Subject: [PATCH] Allow dot ('.') in workspace names. RELNOTES: Dot ('.') is now allowed in workspace names. See https://github.com/bazelbuild/bazel/issues/11837. PiperOrigin-RevId: 327160423 --- .../google/devtools/build/lib/packages/WorkspaceGlobals.java | 2 +- .../devtools/build/lib/packages/WorkspaceFactoryTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 ab98b38f460358..b0240784235719 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 7d1e67634a9b20..c153fd45ddc85f 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 @@ public void testWorkspaceStartsWithNumber() throws Exception { @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