aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-09-15 13:56:14 +0000
committerGravatar John Field <jfield@google.com>2015-09-15 20:27:47 +0000
commita6434361097c0ee18c706bf7a86a93324f68e284 (patch)
tree98a3109cb41b1f6cbcb5bae4f9452fdb81553ae4 /src/test/java/com/google/devtools/build
parent5d737d642623749c8672916548b7c7c85b2ca9e6 (diff)
Parse the label syntax "@//a:b" so that eventually we can make that the syntax that means "refer to the main repository".
There isn't an overarching plan for what we are going to do with the cmdline package, which seems to be separated from the .syntax one in all sorts of awkward ways. -- MOS_MIGRATED_REVID=103088960
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r--src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/LabelExpanderTest.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java27
-rw-r--r--src/test/java/com/google/devtools/build/lib/cmdline/LabelValidatorTest.java2
-rw-r--r--src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java22
-rw-r--r--src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java8
-rw-r--r--src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java16
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/util/SkyframeExecutorTestUtils.java2
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java18
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java8
12 files changed, 60 insertions, 60 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java b/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java
index 3a7db343ca..c5e1eafdf1 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java
@@ -20,9 +20,9 @@ import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.CustomArgv;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.CustomMultiArgv;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.testutil.Scratch;
import org.junit.Before;
@@ -56,7 +56,7 @@ public class CustomCommandLineTest {
}
@Test
- public void testLabelArgs() throws SyntaxException {
+ public void testLabelArgs() throws LabelSyntaxException {
CustomCommandLine cl = CustomCommandLine.builder().add(Label.parseAbsolute("//a:b")).build();
assertEquals(ImmutableList.of("//a:b"), cl.arguments());
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/LabelExpanderTest.java b/src/test/java/com/google/devtools/build/lib/analysis/LabelExpanderTest.java
index 708408f9d9..f574cefe45 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/LabelExpanderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/LabelExpanderTest.java
@@ -17,8 +17,8 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.testutil.Suite;
import com.google.devtools.build.lib.testutil.TestSpec;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -88,7 +88,7 @@ public class LabelExpanderTest extends BuildViewTestCase {
/**
* Creates fake label in package "foo".
*/
- private static Label labelFor(String targetName) throws SyntaxException {
+ private static Label labelFor(String targetName) throws LabelSyntaxException {
return Label.create("foo", targetName);
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java
index 59a74a8eb4..4e6e041f69 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java
@@ -35,6 +35,7 @@ import com.google.devtools.build.lib.analysis.config.BuildConfigurationCollectio
import com.google.devtools.build.lib.analysis.config.BuildOptions;
import com.google.devtools.build.lib.analysis.config.ConfigurationFactory;
import com.google.devtools.build.lib.buildtool.BuildRequest.BuildRequestOptions;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.exec.ExecutionOptions;
import com.google.devtools.build.lib.packages.PackageFactory;
import com.google.devtools.build.lib.packages.Preprocessor;
@@ -53,7 +54,6 @@ import com.google.devtools.build.lib.skyframe.SkyValueDirtinessChecker;
import com.google.devtools.build.lib.skyframe.SkyframeExecutor;
import com.google.devtools.build.lib.skyframe.util.SkyframeExecutorTestUtils;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.testutil.FoundationTestCase;
import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.build.lib.testutil.TestRuleClassProvider;
@@ -289,7 +289,7 @@ public abstract class AnalysisTestCase extends FoundationTestCase {
try {
return SkyframeExecutorTestUtils.getExistingTarget(skyframeExecutor,
Label.parseAbsolute(label));
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new AssertionError(e);
}
}
@@ -304,7 +304,7 @@ public abstract class AnalysisTestCase extends FoundationTestCase {
Label parsedLabel;
try {
parsedLabel = Label.parseAbsolute(label);
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new AssertionError(e);
}
return skyframeExecutor.getConfiguredTargetForTesting(parsedLabel, configuration);
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
index 641781fc2c..ac9311d793 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
@@ -76,6 +76,7 @@ import com.google.devtools.build.lib.analysis.config.BuildOptions;
import com.google.devtools.build.lib.analysis.config.ConfigurationFactory;
import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException;
import com.google.devtools.build.lib.buildtool.BuildRequest;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
@@ -113,7 +114,6 @@ import com.google.devtools.build.lib.skyframe.PrecomputedValue;
import com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor;
import com.google.devtools.build.lib.skyframe.SkyValueDirtinessChecker;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.testutil.FoundationTestCase;
import com.google.devtools.build.lib.testutil.MoreAsserts;
import com.google.devtools.build.lib.testutil.TestConstants;
@@ -273,7 +273,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
protected Target getTarget(String label)
throws NoSuchPackageException, NoSuchTargetException,
- Label.SyntaxException, InterruptedException {
+ LabelSyntaxException, InterruptedException {
return getTarget(Label.parseAbsolute(label));
}
@@ -569,7 +569,8 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
}
protected boolean ensureTargetsVisited(String... labels)
- throws InterruptedException, NoSuchTargetException, NoSuchPackageException, SyntaxException {
+ throws InterruptedException, NoSuchTargetException, NoSuchPackageException,
+ LabelSyntaxException {
List<Label> actualLabels = new ArrayList<>();
for (String label : labels) {
actualLabels.add(Label.parseAbsolute(label));
@@ -583,7 +584,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
*/
protected ConfiguredTarget getConfiguredTarget(String label)
throws NoSuchPackageException, NoSuchTargetException,
- Label.SyntaxException, InterruptedException {
+ LabelSyntaxException, InterruptedException {
return getConfiguredTarget(label, targetConfig);
}
@@ -593,7 +594,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
*/
protected ConfiguredTarget getConfiguredTarget(String label, BuildConfiguration config)
throws NoSuchPackageException, NoSuchTargetException,
- Label.SyntaxException, InterruptedException {
+ LabelSyntaxException, InterruptedException {
ensureTargetsVisited(label);
return view.getConfiguredTargetForTesting(getTarget(label), config);
}
@@ -614,7 +615,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
*/
protected FileConfiguredTarget getFileConfiguredTarget(String label)
throws NoSuchPackageException, NoSuchTargetException,
- Label.SyntaxException, InterruptedException {
+ LabelSyntaxException, InterruptedException {
return (FileConfiguredTarget) getConfiguredTarget(label, targetConfig);
}
@@ -624,7 +625,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
*/
protected ConfiguredTarget getHostConfiguredTarget(String label)
throws NoSuchPackageException, NoSuchTargetException,
- Label.SyntaxException, InterruptedException {
+ LabelSyntaxException, InterruptedException {
return getConfiguredTarget(label, getHostConfiguration());
}
@@ -634,7 +635,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
*/
protected FileConfiguredTarget getHostFileConfiguredTarget(String label)
throws NoSuchPackageException, NoSuchTargetException,
- Label.SyntaxException, InterruptedException {
+ LabelSyntaxException, InterruptedException {
return (FileConfiguredTarget) getHostConfiguredTarget(label);
}
@@ -1070,7 +1071,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
private static Label makeLabel(String label) {
try {
return Label.parseAbsolute(label);
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new IllegalStateException(e);
}
}
@@ -1328,9 +1329,9 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
* Utility method for tests. Converts an array of strings into a set of labels.
*
* @param strings the set of strings to be converted to labels.
- * @throws SyntaxException if there are any syntax errors in the strings.
+ * @throws LabelSyntaxException if there are any syntax errors in the strings.
*/
- public static Set<Label> asLabelSet(String... strings) throws SyntaxException {
+ public static Set<Label> asLabelSet(String... strings) throws LabelSyntaxException {
return asLabelSet(ImmutableList.copyOf(strings));
}
@@ -1338,9 +1339,9 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
* Utility method for tests. Converts an array of strings into a set of labels.
*
* @param strings the set of strings to be converted to labels.
- * @throws SyntaxException if there are any syntax errors in the strings.
+ * @throws LabelSyntaxException if there are any syntax errors in the strings.
*/
- public static Set<Label> asLabelSet(Iterable<String> strings) throws SyntaxException {
+ public static Set<Label> asLabelSet(Iterable<String> strings) throws LabelSyntaxException {
Set<Label> result = Sets.newTreeSet();
for (String s : strings) {
result.add(Label.parseAbsolute(s));
diff --git a/src/test/java/com/google/devtools/build/lib/cmdline/LabelValidatorTest.java b/src/test/java/com/google/devtools/build/lib/cmdline/LabelValidatorTest.java
index f14943d0e5..547851fb01 100644
--- a/src/test/java/com/google/devtools/build/lib/cmdline/LabelValidatorTest.java
+++ b/src/test/java/com/google/devtools/build/lib/cmdline/LabelValidatorTest.java
@@ -98,6 +98,8 @@ public class LabelValidatorTest extends TestCase {
assertEquals(emptyPackage, LabelValidator.validateAbsoluteLabel("@repo//:bar"));
assertEquals(new PackageAndTarget("foo", "bar"),
LabelValidator.validateAbsoluteLabel("@repo//foo:bar"));
+ assertEquals(new PackageAndTarget("foo", "bar"),
+ LabelValidator.validateAbsoluteLabel("@//foo:bar"));
try {
LabelValidator.validateAbsoluteLabel("@foo");
diff --git a/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java b/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java
index 86f295b9dd..f5ee2bf47d 100644
--- a/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java
+++ b/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java
@@ -49,6 +49,9 @@ public class PackageIdentifierTest {
PackageIdentifier plainA = PackageIdentifier.parse("a");
assertThat(plainA.getRepository().strippedName()).isEqualTo("");
assertThat(fooA.getPackageFragment().getPathString()).isEqualTo("a");
+
+ PackageIdentifier mainA = PackageIdentifier.parse("@//a");
+ assertThat(mainA.getRepository()).isEqualTo(PackageIdentifier.MAIN_REPOSITORY_NAME);
}
@Test
@@ -59,45 +62,38 @@ public class PackageIdentifierTest {
assertEquals("@foo/bar", RepositoryName.create("@foo/bar").toString());
assertEquals("@foo.bar", RepositoryName.create("@foo.bar").toString());
- // Bad:
- try {
- RepositoryName.create("@");
- fail();
- } catch (TargetParsingException expected) {
- assertThat(expected.getMessage()).contains("empty workspace name");
- }
try {
RepositoryName.create("@abc/");
fail();
- } catch (TargetParsingException expected) {
+ } catch (LabelSyntaxException expected) {
assertThat(expected.getMessage()).contains(
"workspace names cannot start nor end with '/'");
}
try {
RepositoryName.create("@/abc");
fail();
- } catch (TargetParsingException expected) {
+ } catch (LabelSyntaxException expected) {
assertThat(expected.getMessage()).contains(
"workspace names cannot start nor end with '/'");
}
try {
RepositoryName.create("@a//////b");
fail();
- } catch (TargetParsingException expected) {
+ } catch (LabelSyntaxException expected) {
assertThat(expected.getMessage()).contains(
"workspace names cannot contain multiple '/'s in a row");
}
try {
RepositoryName.create("@foo@");
fail();
- } catch (TargetParsingException expected) {
+ } catch (LabelSyntaxException expected) {
assertThat(expected.getMessage()).contains(
"workspace names may contain only A-Z, a-z, 0-9, '-', '_', '.', and '/'");
}
try {
RepositoryName.create("x");
fail();
- } catch (TargetParsingException expected) {
+ } catch (LabelSyntaxException expected) {
assertThat(expected.getMessage()).contains("workspace name must start with '@'");
}
}
@@ -132,7 +128,7 @@ public class PackageIdentifierTest {
try {
new PackageIdentifier("foo", new PathFragment("bar/baz"));
fail("'foo' is not a legal repository name");
- } catch (TargetParsingException expected) {
+ } catch (LabelSyntaxException expected) {
assertThat(expected.getMessage()).contains("workspace name must start with '@'");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java b/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java
index f5041d27e4..9666b029cb 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java
@@ -34,6 +34,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventCollector;
@@ -46,7 +47,6 @@ import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
import com.google.devtools.build.lib.packages.RuleClass.MissingFragmentPolicy;
import com.google.devtools.build.lib.packages.util.PackageLoadingTestCase;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.vfs.Path;
import java.util.ArrayList;
@@ -78,7 +78,7 @@ public class RuleClassTest extends PackageLoadingTestCase {
private static final Predicate<String> PREFERRED_DEPENDENCY_PREDICATE = Predicates.alwaysFalse();
- private static RuleClass createRuleClassA() throws Label.SyntaxException {
+ private static RuleClass createRuleClassA() throws LabelSyntaxException {
return new RuleClass("ruleA", false, false, false, false, false, false,
ImplicitOutputsFunction.NONE, RuleClass.NO_CHANGE,
DUMMY_CONFIGURED_TARGET_FACTORY, PredicatesWithMessage.<Rule>alwaysTrue(),
@@ -650,12 +650,12 @@ public class RuleClassTest extends PackageLoadingTestCase {
}
private Rule createRule(RuleClass ruleClass, String name, Map<String, Object> attributeValues,
- Location location) throws SyntaxException, InterruptedException {
+ Location location) throws LabelSyntaxException, InterruptedException {
Package.Builder pkgBuilder = createDummyPackageBuilder();
Label ruleLabel;
try {
ruleLabel = pkgBuilder.createLabel(name);
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new IllegalArgumentException("Rule has illegal label");
}
return ruleClass.createRuleWithLabel(pkgBuilder, ruleLabel, attributeValues,
diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java b/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java
index dd44efc42e..7a73418fbc 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java
@@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.packages.ConstantRuleVisibility;
import com.google.devtools.build.lib.packages.NoSuchPackageException;
import com.google.devtools.build.lib.packages.NoSuchTargetException;
@@ -38,7 +39,6 @@ import com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor;
import com.google.devtools.build.lib.skyframe.SkyValueDirtinessChecker;
import com.google.devtools.build.lib.skyframe.SkyframeExecutor;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.testutil.FoundationTestCase;
import com.google.devtools.build.lib.testutil.TestRuleClassProvider;
import com.google.devtools.build.lib.util.BlazeClock;
@@ -118,7 +118,7 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase {
protected Target getTarget(String label)
throws NoSuchPackageException, NoSuchTargetException,
- Label.SyntaxException, InterruptedException {
+ LabelSyntaxException, InterruptedException {
return getTarget(Label.parseAbsolute(label));
}
@@ -187,9 +187,9 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase {
* Utility method for tests. Converts an array of strings into a set of labels.
*
* @param strings the set of strings to be converted to labels.
- * @throws SyntaxException if there are any syntax errors in the strings.
+ * @throws LabelSyntaxException if there are any syntax errors in the strings.
*/
- public static Set<Label> asLabelSet(String... strings) throws SyntaxException {
+ public static Set<Label> asLabelSet(String... strings) throws LabelSyntaxException {
return asLabelSet(ImmutableList.copyOf(strings));
}
@@ -197,9 +197,9 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase {
* Utility method for tests. Converts an array of strings into a set of labels.
*
* @param strings the set of strings to be converted to labels.
- * @throws SyntaxException if there are any syntax errors in the strings.
+ * @throws LabelSyntaxException if there are any syntax errors in the strings.
*/
- public static Set<Label> asLabelSet(Iterable<String> strings) throws SyntaxException {
+ public static Set<Label> asLabelSet(Iterable<String> strings) throws LabelSyntaxException {
Set<Label> result = Sets.newTreeSet();
for (String s : strings) {
result.add(Label.parseAbsolute(s));
@@ -208,12 +208,12 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase {
}
protected final Set<Target> asTargetSet(String... strLabels)
- throws SyntaxException, NoSuchThingException, InterruptedException {
+ throws LabelSyntaxException, NoSuchThingException, InterruptedException {
return asTargetSet(Arrays.asList(strLabels));
}
protected Set<Target> asTargetSet(Iterable<String> strLabels)
- throws SyntaxException, NoSuchThingException, InterruptedException {
+ throws LabelSyntaxException, NoSuchThingException, InterruptedException {
Set<Target> targets = new HashSet<>();
for (String strLabel : strLabels) {
targets.add(getTarget(strLabel));
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/util/SkyframeExecutorTestUtils.java b/src/test/java/com/google/devtools/build/lib/skyframe/util/SkyframeExecutorTestUtils.java
index ea964ce610..2867ea40ec 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/util/SkyframeExecutorTestUtils.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/util/SkyframeExecutorTestUtils.java
@@ -131,7 +131,7 @@ public class SkyframeExecutorTestUtils {
public static Target getExistingTarget(SkyframeExecutor skyframeExecutor,
Label label) {
PackageValue value = (PackageValue) getExistingValue(skyframeExecutor,
- PackageValue.key(label.getPackageFragment()));
+ PackageValue.key(label.getPackageIdentifier()));
if (value == null) {
return null;
}
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java
index bf9672e573..bcad177f47 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/EvalUtilsTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.Lists;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -55,7 +56,7 @@ public class EvalUtilsTest {
return new FilesetEntry(Label.parseAbsolute("//foo:bar"),
Lists.<Label>newArrayList(), Lists.newArrayList("xyz"), "",
FilesetEntry.SymlinkBehavior.COPY, ".");
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new RuntimeException("Bad label: ", e);
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java b/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java
index 322fb64e46..2ac874c5a8 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java
@@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.testutil.TestUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -60,7 +60,7 @@ public class LabelTest {
}
}
- private static String parseCommandLine(String label, String prefix) throws SyntaxException {
+ private static String parseCommandLine(String label, String prefix) throws LabelSyntaxException {
return Label.parseCommandLineLabel(label, new PathFragment(prefix)).toString();
}
@@ -91,7 +91,7 @@ public class LabelTest {
try {
parseCommandLine("//absolute:A+bad%syntax", "");
fail();
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
// Expected exception
}
}
@@ -112,25 +112,25 @@ public class LabelTest {
try {
base.getRelative("/p1/p2:target");
fail();
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
/* ok */
}
try {
base.getRelative("quux:");
fail();
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
/* ok */
}
try {
base.getRelative(":");
fail();
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
/* ok */
}
try {
base.getRelative("::");
fail();
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
/* ok */
}
}
@@ -186,7 +186,7 @@ public class LabelTest {
try {
Label.parseAbsolute(label);
fail("Label '" + label + "' did not contain a syntax error");
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
assertContainsRegex(Pattern.quote(expectedError), e.getMessage());
}
}
@@ -358,7 +358,7 @@ public class LabelTest {
try {
Label.parseAbsolute("foo//bar/baz:bat/boo");
fail();
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
assertThat(e).hasMessage("invalid repository name 'foo': workspace name must start with '@'");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java b/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java
index 21c1de155a..63d52368a6 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/PrinterTest.java
@@ -20,7 +20,7 @@ import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -52,7 +52,7 @@ public class PrinterTest {
return new FilesetEntry(Label.parseAbsolute("//foo:bar"),
Lists.<Label>newArrayList(), Lists.newArrayList("xyz"), "",
FilesetEntry.SymlinkBehavior.COPY, ".");
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new RuntimeException("Bad label: ", e);
}
}
@@ -245,13 +245,13 @@ public class PrinterTest {
}
private FilesetEntry createTestFilesetEntry(FilesetEntry.SymlinkBehavior symlinkBehavior)
- throws SyntaxException {
+ throws LabelSyntaxException {
Label label = Label.parseAbsolute("//x");
return new FilesetEntry(
label, Arrays.asList(label), Arrays.<String>asList(), "", symlinkBehavior, ".");
}
- private FilesetEntry createTestFilesetEntry() throws SyntaxException {
+ private FilesetEntry createTestFilesetEntry() throws LabelSyntaxException {
return createTestFilesetEntry(FilesetEntry.SymlinkBehavior.COPY);
}
}