aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java16
2 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
index 2de3167e86..1f8d05750a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
@@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
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.PackageIdentifier.RepositoryName;
import com.google.devtools.build.lib.events.Event;
@@ -516,7 +517,14 @@ public class PackageFunction implements SkyFunction {
*/
private boolean fetchIncludeRepositoryDeps(Environment env, BuildFileAST ast) {
boolean ok = true;
- for (Label label : ast.getIncludes()) {
+ for (String include : ast.getIncludes()) {
+ Label label;
+ try {
+ label = Label.parseAbsolute(include);
+ } catch (LabelSyntaxException e) {
+ // Ignore. This will be reported when the BUILD file is actually evaluated.
+ continue;
+ }
if (!label.getPackageIdentifier().getRepository().isDefault()) {
// If this is the default repository, the include refers to the same repository, whose
// RepositoryValue is already a dependency of this PackageValue.
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java b/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
index bbaf3b0834..60e84f94a5 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
@@ -17,7 +17,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.hash.HashCode;
-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;
@@ -41,7 +40,7 @@ public class BuildFileAST extends ASTNode {
private ImmutableMap<Location, PathFragment> loads;
- private ImmutableSet<Label> includes;
+ private ImmutableSet<String> includes;
/**
* Whether any errors were encountered during scanning or parsing.
@@ -72,8 +71,8 @@ public class BuildFileAST extends ASTNode {
}
}
- private ImmutableSet<Label> fetchIncludes(List<Statement> stmts) {
- ImmutableSet.Builder<Label> result = new ImmutableSet.Builder<>();
+ private ImmutableSet<String> fetchIncludes(List<Statement> stmts) {
+ ImmutableSet.Builder<String> result = new ImmutableSet.Builder<>();
for (Statement stmt : stmts) {
if (!(stmt instanceof ExpressionStatement)) {
continue;
@@ -95,12 +94,7 @@ public class BuildFileAST extends ASTNode {
continue;
}
- try {
- Label label = Label.parseAbsolute(((StringLiteral) arg).getValue());
- result.add(label);
- } catch (LabelSyntaxException e) {
- // Ignore. This will be reported when the BUILD file is actually evaluated.
- }
+ result.add(((StringLiteral) arg).getValue());
}
return result.build();
@@ -151,7 +145,7 @@ public class BuildFileAST extends ASTNode {
return loads;
}
- public synchronized ImmutableSet<Label> getIncludes() {
+ public synchronized ImmutableSet<String> getIncludes() {
if (includes == null) {
includes = fetchIncludes(stmts);
}