Support labels referencing external targets (with '@') in load with --incompatible_load_argument_is_label enabled (fixes #3560)
Closes #3562.
PiperOrigin-RevId: 167745885
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Eval.java b/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
index 2fc54df..b7b91d4 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
@@ -131,10 +131,10 @@
void execLoad(LoadStatement node) throws EvalException, InterruptedException {
if (env.getSemantics().incompatibleLoadArgumentIsLabel) {
String s = node.getImport().getValue();
- if (!s.startsWith("//") && !s.startsWith(":")) {
+ if (!s.startsWith("//") && !s.startsWith(":") && !s.startsWith("@")) {
throw new EvalException(
node.getLocation(),
- "First argument of 'load' must be a label and start with either '//' or ':'. "
+ "First argument of 'load' must be a label and start with either '//', ':', or '@'. "
+ "Use --incompatible_load_argument_is_label=false to temporarily disable this "
+ "check.");
}