diff options
author | Tobias Werth <twerth@google.com> | 2016-10-25 14:37:38 +0000 |
---|---|---|
committer | John Cater <jcater@google.com> | 2016-10-25 20:19:02 +0000 |
commit | b96a0952c9a05d3a0b56b54eb0b841c455929261 (patch) | |
tree | 452e5f584adce3c776b2f58662a378270cff9233 /src/main/java/com/google/devtools | |
parent | 5d038c0cd12653fbb666367049a33e079d7921e3 (diff) |
Trim labels in location expressions before expansion.
--
Change-Id: If626fd448ddbfbdf65b71569fda7a9b206e5f8b2
Reviewed-on: https://bazel-review.googlesource.com/c/6890/
MOS_MIGRATED_REVID=137155361
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/LocationExpander.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/LocationExpander.java b/src/main/java/com/google/devtools/build/lib/analysis/LocationExpander.java index 882b93bae5..225b3e14b6 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/LocationExpander.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/LocationExpander.java @@ -48,7 +48,7 @@ import java.util.TreeSet; * Note that //mypackage:myhelper should have just one output. */ public class LocationExpander { - + /** * List of options to tweak the LocationExpander. */ @@ -58,7 +58,7 @@ public class LocationExpander { /** Allow to take label from the data attribute */ ALLOW_DATA, } - + private static final int MAX_PATHS_SHOWN = 5; private static final String LOCATION = "$(location"; private final RuleContext ruleContext; @@ -105,7 +105,7 @@ public class LocationExpander { /** * Creates location expander helper bound to specific target. - * + * * @param ruleContext the BUILD rule's context * @param options the list of options, see {@link Options}. */ @@ -181,7 +181,7 @@ public class LocationExpander { message = String.format(" in %s expression", message); // (2) parse label - String labelText = value.substring(start + scannedLength, end); + String labelText = value.substring(start + scannedLength, end).trim(); Label label = parseLabel(labelText, message, reporter); if (label == null) { @@ -206,7 +206,7 @@ public class LocationExpander { restart = end + 1; } - + return result.toString(); } @@ -357,7 +357,7 @@ public class LocationExpander { } return values; } - + private static interface ErrorReporter { void report(RuleContext ctx, String error); } |