aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/analysis
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/lib/analysis
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/lib/analysis')
-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
3 files changed, 19 insertions, 18 deletions
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));