aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/ConstantRuleVisibility.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java22
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/License.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Package.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Rule.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/RuleClass.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Type.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java7
11 files changed, 57 insertions, 48 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/ConstantRuleVisibility.java b/src/main/java/com/google/devtools/build/lib/packages/ConstantRuleVisibility.java
index bb64015fad..8d506937b8 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/ConstantRuleVisibility.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/ConstantRuleVisibility.java
@@ -14,6 +14,7 @@
package com.google.devtools.build.lib.packages;
import com.google.common.collect.ImmutableList;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.syntax.Label;
@@ -43,7 +44,7 @@ public class ConstantRuleVisibility implements RuleVisibility, Serializable {
PUBLIC_LABEL = Label.parseAbsolute("//visibility:public");
LEGACY_PUBLIC_LABEL = Label.parseAbsolute("//visibility:legacy_public");
PRIVATE_LABEL = Label.parseAbsolute("//visibility:private");
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new IllegalStateException();
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java b/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java
index cfb8143180..fdb63e262a 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/ExternalPackage.java
@@ -18,16 +18,15 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Verify;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.cmdline.PackageIdentifier.RepositoryName;
-import com.google.devtools.build.lib.cmdline.TargetParsingException;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.events.StoredEventHandler;
import com.google.devtools.build.lib.packages.RuleFactory.InvalidRuleException;
import com.google.devtools.build.lib.syntax.Environment;
import com.google.devtools.build.lib.syntax.FuncallExpression;
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.Map;
@@ -36,9 +35,15 @@ import java.util.Map;
* This creates the //external package, where targets not homed in this repository can be bound.
*/
public class ExternalPackage extends Package {
- public static final String NAME = "external";
- public static final PackageIdentifier PACKAGE_IDENTIFIER =
- PackageIdentifier.createInDefaultRepo(NAME);
+ public static final PackageIdentifier PACKAGE_IDENTIFIER;
+
+ static {
+ try {
+ PACKAGE_IDENTIFIER = PackageIdentifier.parse("//external");
+ } catch (LabelSyntaxException e) {
+ throw new IllegalStateException();
+ }
+ }
private Map<RepositoryName, Rule> repositoryMap;
@@ -133,15 +138,16 @@ public class ExternalPackage extends Package {
*/
public Builder createAndAddRepositoryRule(RuleClass ruleClass, RuleClass bindRuleClass,
Map<String, Object> kwargs, FuncallExpression ast, Environment env)
- throws InvalidRuleException, NameConflictException, SyntaxException, InterruptedException {
+ throws InvalidRuleException, NameConflictException, LabelSyntaxException,
+ InterruptedException {
StoredEventHandler eventHandler = new StoredEventHandler();
Rule tempRule = RuleFactory.createRule(
this, ruleClass, kwargs, eventHandler, ast, ast.getLocation(), env);
addEvents(eventHandler.getEvents());
try {
repositoryMap.put(RepositoryName.create("@" + tempRule.getName()), tempRule);
- } catch (TargetParsingException e) {
- throw new SyntaxException(e.getMessage());
+ } catch (LabelSyntaxException e) {
+ throw new LabelSyntaxException(e.getMessage());
}
for (Map.Entry<String, Label> entry :
ruleClass.getExternalBindingsFunction().apply(tempRule).entrySet()) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/License.java b/src/main/java/com/google/devtools/build/lib/packages/License.java
index f4e554e2ff..98ed31d38b 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/License.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/License.java
@@ -20,13 +20,13 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableTable;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import java.util.Collection;
import java.util.Collections;
@@ -209,7 +209,7 @@ public final class License {
try {
Label label = Label.parseAbsolute(str.substring("exception=".length()));
exceptions.add(label);
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new LicenseParsingException(e.getMessage());
}
} else {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index 256aab09df..0fbc72681a 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -24,6 +24,7 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.collect.CollectionUtils;
import com.google.devtools.build.lib.collect.ImmutableSortedKeyMap;
@@ -36,7 +37,6 @@ import com.google.devtools.build.lib.packages.PackageDeserializer.PackageDeseria
import com.google.devtools.build.lib.packages.PackageFactory.Globber;
import com.google.devtools.build.lib.syntax.FuncallExpression;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.vfs.Canonicalizer;
import com.google.devtools.build.lib.vfs.Path;
@@ -586,7 +586,7 @@ public class Package implements Serializable {
throw new NoSuchTargetException(createLabel(targetName), "target '" + targetName
+ "' not declared in package '" + name + "'" + suffix + " defined by "
+ this.filename);
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new IllegalArgumentException(targetName);
}
}
@@ -594,9 +594,9 @@ public class Package implements Serializable {
/**
* Creates a label for a target inside this package.
*
- * @throws SyntaxException if the {@code targetName} is invalid
+ * @throws LabelSyntaxException if the {@code targetName} is invalid
*/
- public Label createLabel(String targetName) throws SyntaxException {
+ public Label createLabel(String targetName) throws LabelSyntaxException {
return Label.create(packageIdentifier, targetName);
}
@@ -841,7 +841,7 @@ public class Package implements Serializable {
try {
buildFileLabel = createLabel(filename.getBaseName());
addInputFile(buildFileLabel, Location.fromFile(filename));
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
// This can't actually happen.
throw new AssertionError("Package BUILD file has an illegal name: " + filename);
}
@@ -1105,7 +1105,7 @@ public class Package implements Serializable {
if (existing == null) {
try {
return addInputFile(createLabel(targetName), location);
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new IllegalArgumentException("FileTarget in package " + pkg.getName()
+ " has illegal name: " + targetName);
}
@@ -1142,9 +1142,9 @@ public class Package implements Serializable {
/**
* Creates a label for a target inside this package.
*
- * @throws SyntaxException if the {@code targetName} is invalid
+ * @throws LabelSyntaxException if the {@code targetName} is invalid
*/
- Label createLabel(String targetName) throws SyntaxException {
+ Label createLabel(String targetName) throws LabelSyntaxException {
return Label.create(pkg.getPackageIdentifier(), targetName);
}
@@ -1153,7 +1153,7 @@ public class Package implements Serializable {
*/
void addPackageGroup(String name, Collection<String> packages, Collection<Label> includes,
EventHandler eventHandler, Location location)
- throws NameConflictException, Label.SyntaxException {
+ throws NameConflictException, LabelSyntaxException {
PackageGroup group =
new PackageGroup(createLabel(name), pkg, packages, includes, eventHandler, location);
Target existing = targets.get(group.getName());
@@ -1190,7 +1190,7 @@ public class Package implements Serializable {
*/
void addEnvironmentGroup(String name, List<Label> environments, List<Label> defaults,
EventHandler eventHandler, Location location)
- throws NameConflictException, SyntaxException {
+ throws NameConflictException, LabelSyntaxException {
if (!checkForDuplicateLabels(environments, name, "environments", location, eventHandler)
|| !checkForDuplicateLabels(defaults, name, "defaults", location, eventHandler)) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java b/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java
index 2f0715c139..9dbb7efdc4 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java
@@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
-import com.google.devtools.build.lib.cmdline.TargetParsingException;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.events.NullEventHandler;
@@ -40,7 +40,6 @@ import com.google.devtools.build.lib.syntax.FilesetEntry;
import com.google.devtools.build.lib.syntax.GlobCriteria;
import com.google.devtools.build.lib.syntax.GlobList;
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 com.google.devtools.build.lib.vfs.PathFragment;
@@ -92,7 +91,7 @@ public class PackageDeserializer {
public Label load(String labelString) throws PackageDeserializationException {
try {
return Label.parseAbsolute(labelString);
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new PackageDeserializationException("Invalid label: " + e.getMessage(), e);
}
}
@@ -160,7 +159,7 @@ public class PackageDeserializer {
deserializeLabels(packageGroupPb.getIncludedPackageGroupList()),
NullEventHandler.INSTANCE, // TODO(bazel-team): Handle errors properly
EmptyLocation.INSTANCE);
- } catch (Label.SyntaxException | Package.NameConflictException e) {
+ } catch (LabelSyntaxException | Package.NameConflictException e) {
throw new PackageDeserializationException(e);
}
}
@@ -183,7 +182,7 @@ public class PackageDeserializer {
context.packageBuilder.addRule(rule);
Preconditions.checkState(!rule.containsErrors());
- } catch (NameConflictException | SyntaxException e) {
+ } catch (NameConflictException | LabelSyntaxException e) {
throw new PackageDeserializationException(e);
}
}
@@ -452,7 +451,7 @@ public class PackageDeserializer {
builder = new Package.Builder(
new PackageIdentifier(packagePb.getRepository(), new PathFragment(packagePb.getName())),
null);
- } catch (TargetParsingException e) {
+ } catch (LabelSyntaxException e) {
throw new PackageDeserializationException(e);
}
StoredEventHandler eventHandler = new StoredEventHandler();
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
index 4fd5428153..1a7c376731 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
@@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.LabelValidator;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.events.Event;
@@ -626,7 +627,7 @@ public final class PackageFactory {
context.pkgBuilder.addEnvironmentGroup(
name, environments, defaults, context.eventHandler, loc);
return Runtime.NONE;
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new EvalException(loc,
"environment group has invalid name: " + name + ": " + e.getMessage());
} catch (Package.NameConflictException e) {
@@ -819,7 +820,7 @@ public final class PackageFactory {
context.pkgBuilder.addPackageGroup(name, packages, includes, context.eventHandler,
ast.getLocation());
return Runtime.NONE;
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new EvalException(ast.getLocation(),
"package group has invalid name: " + name + ": " + e.getMessage());
} catch (Package.NameConflictException e) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Rule.java b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
index da1c80494c..48021697ca 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Rule.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
@@ -27,6 +27,7 @@ import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.Location;
@@ -36,7 +37,6 @@ import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.syntax.FuncallExpression;
import com.google.devtools.build.lib.syntax.GlobList;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.util.BinaryPredicate;
import java.util.Collection;
@@ -484,7 +484,7 @@ public final class Rule implements Target {
* will retain the relative order in which they were declared.
*/
void populateOutputFiles(EventHandler eventHandler, Package.Builder pkgBuilder)
- throws SyntaxException, InterruptedException {
+ throws LabelSyntaxException, InterruptedException {
Preconditions.checkState(outputFiles == null);
// Order is important here: implicit before explicit
outputFiles = Lists.newArrayList();
@@ -496,7 +496,7 @@ public final class Rule implements Target {
}
// Explicit output files are user-specified attributes of type OUTPUT.
- private void populateExplicitOutputFiles(EventHandler eventHandler) throws SyntaxException {
+ private void populateExplicitOutputFiles(EventHandler eventHandler) throws LabelSyntaxException {
NonconfigurableAttributeMapper nonConfigurableAttributes =
NonconfigurableAttributeMapper.of(this);
for (Attribute attribute : ruleClass.getAttributes()) {
@@ -525,7 +525,7 @@ public final class Rule implements Target {
for (String out : ruleClass.getImplicitOutputsFunction().getImplicitOutputs(attributeMap)) {
try {
addOutputFile(pkgBuilder.createLabel(out), eventHandler);
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
reportError("illegal output file name '" + out + "' in rule "
+ getLabel(), eventHandler);
}
@@ -536,7 +536,7 @@ public final class Rule implements Target {
}
private void addLabelOutput(Attribute attribute, Label label, EventHandler eventHandler)
- throws SyntaxException {
+ throws LabelSyntaxException {
if (!label.getPackageIdentifier().equals(pkg.getPackageIdentifier())) {
throw new IllegalStateException("Label for attribute " + attribute
+ " should refer to '" + pkg.getName()
@@ -544,7 +544,7 @@ public final class Rule implements Target {
+ "' (label '" + label.getName() + "')");
}
if (label.getName().equals(".")) {
- throw new SyntaxException("output file name can't be equal '.'");
+ throw new LabelSyntaxException("output file name can't be equal '.'");
}
OutputFile outputFile = addOutputFile(label, eventHandler);
outputFileMap.put(attribute.getName(), outputFile);
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
index 1e7dd2a46f..34ff1aff55 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
@@ -29,6 +29,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Ordering;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition;
@@ -40,7 +41,6 @@ import com.google.devtools.build.lib.syntax.FragmentClassNameResolver;
import com.google.devtools.build.lib.syntax.FuncallExpression;
import com.google.devtools.build.lib.syntax.GlobList;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.syntax.Runtime;
import com.google.devtools.build.lib.util.StringUtil;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -1315,7 +1315,7 @@ public final class RuleClass {
*/
Rule createRuleWithLabel(Package.Builder pkgBuilder, Label ruleLabel,
Map<String, Object> attributeValues, EventHandler eventHandler, FuncallExpression ast,
- Location location) throws SyntaxException, InterruptedException {
+ Location location) throws LabelSyntaxException, InterruptedException {
Rule rule = pkgBuilder.newRuleWithLabel(ruleLabel, this, null, location);
createRuleCommon(rule, pkgBuilder, attributeValues, eventHandler, ast);
return rule;
@@ -1323,7 +1323,7 @@ public final class RuleClass {
private void createRuleCommon(Rule rule, Package.Builder pkgBuilder,
Map<String, Object> attributeValues, EventHandler eventHandler, FuncallExpression ast)
- throws SyntaxException, InterruptedException {
+ throws LabelSyntaxException, InterruptedException {
populateRuleAttributeValues(
rule, pkgBuilder, attributeValues, eventHandler, ast);
rule.populateOutputFiles(eventHandler, pkgBuilder);
@@ -1365,7 +1365,7 @@ public final class RuleClass {
Rule createRuleWithParsedAttributeValues(Label label,
Package.Builder pkgBuilder, Location ruleLocation,
Map<String, ParsedAttributeValue> attributeValues, EventHandler eventHandler)
- throws SyntaxException, InterruptedException {
+ throws LabelSyntaxException, InterruptedException {
Rule rule = pkgBuilder.newRuleWithLabel(label, this, null, ruleLocation);
rule.checkValidityPredicate(eventHandler);
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java b/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java
index f647c07cb4..1eb283485e 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.packages;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.packages.Package.NameConflictException;
@@ -24,7 +25,6 @@ import com.google.devtools.build.lib.syntax.BaseFunction;
import com.google.devtools.build.lib.syntax.Environment;
import com.google.devtools.build.lib.syntax.FuncallExpression;
import com.google.devtools.build.lib.syntax.Label;
-import com.google.devtools.build.lib.syntax.Label.SyntaxException;
import com.google.devtools.build.lib.syntax.UserDefinedFunction;
import com.google.devtools.build.lib.util.Pair;
@@ -98,7 +98,7 @@ public class RuleFactory {
// Test that this would form a valid label name -- in particular, this
// catches cases where Makefile variables $(foo) appear in "name".
label = pkgBuilder.createLabel(name);
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new InvalidRuleException("illegal rule name: " + name + ": " + e.getMessage());
}
boolean inWorkspaceFile =
@@ -115,7 +115,7 @@ public class RuleFactory {
try {
return ruleClass.createRuleWithLabel(
pkgBuilder, label, generator.attributes, eventHandler, ast, generator.location);
- } catch (SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new RuleFactory.InvalidRuleException(ruleClass + " " + e.getMessage());
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Type.java b/src/main/java/com/google/devtools/build/lib/packages/Type.java
index b88c7a1f31..fa2ce679b8 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Type.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Type.java
@@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.packages.License.DistributionType;
import com.google.devtools.build.lib.packages.License.LicenseParsingException;
import com.google.devtools.build.lib.syntax.EvalException;
@@ -670,7 +671,7 @@ public abstract class Type<T> {
try {
return currentRule.getRelative(
STRING.convert(x, what, currentRule));
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new ConversionException("invalid label '" + x + "' in "
+ what + ": " + e.getMessage());
}
@@ -796,7 +797,7 @@ public abstract class Type<T> {
throw new ConversionException("label '" + value + "' is not in the current package");
}
return result;
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new ConversionException(
"illegal output file name '" + value + "' in rule " + currentRule + ": "
+ e.getMessage());
@@ -1043,7 +1044,7 @@ public abstract class Type<T> {
try {
defaultConditionLabel = Label.parseAbsolute(DEFAULT_CONDITION_KEY);
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new IllegalStateException(DEFAULT_CONDITION_KEY + " is not a valid label");
}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java
index 74def59324..a19b36bd18 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.packages;
import static com.google.devtools.build.lib.syntax.Runtime.NONE;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.LabelValidator;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.Location;
@@ -119,11 +120,11 @@ public class WorkspaceFactory {
builder.addBindRule(ruleClass, nameLabel,
actual == null ? null : Label.parseAbsolute(actual), loc);
} catch (RuleFactory.InvalidRuleException | Package.NameConflictException |
- Label.SyntaxException e) {
+ LabelSyntaxException e) {
throw new EvalException(loc, e.getMessage());
}
- } catch (Label.SyntaxException e) {
+ } catch (LabelSyntaxException e) {
throw new EvalException(loc, e.getMessage());
}
return NONE;
@@ -146,7 +147,7 @@ public class WorkspaceFactory {
RuleClass bindRuleClass = ruleFactory.getRuleClass("bind");
builder.createAndAddRepositoryRule(ruleClass, bindRuleClass, kwargs, ast, env);
} catch (RuleFactory.InvalidRuleException | Package.NameConflictException |
- Label.SyntaxException e) {
+ LabelSyntaxException e) {
throw new EvalException(ast.getLocation(), e.getMessage());
}
return NONE;