aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages/Rule.java
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/main/java/com/google/devtools/build/lib/packages/Rule.java
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/main/java/com/google/devtools/build/lib/packages/Rule.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Rule.java12
1 files changed, 6 insertions, 6 deletions
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);