diff options
Diffstat (limited to 'src/main/java')
3 files changed, 14 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/DefaultsPackage.java b/src/main/java/com/google/devtools/build/lib/analysis/config/DefaultsPackage.java index c231e81310..03f688418d 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/DefaultsPackage.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/DefaultsPackage.java @@ -158,14 +158,10 @@ public final class DefaultsPackage { } public static Label parseOptionalLabel(String value) { - if (value.startsWith("//")) { - try { - return Label.parseAbsolute(value); - } catch (LabelSyntaxException e) { - // We ignore this exception here - it will cause an error message at a later time. - return null; - } - } else { + try { + return Label.parseAbsolute(value); + } catch (LabelSyntaxException e) { + // We ignore this exception here - it will cause an error message at a later time. return null; } } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java index 673b3123f9..4ce03493ea 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java @@ -112,7 +112,7 @@ public abstract class FragmentOptions extends OptionsBase implements Cloneable, } private static Label parseOptionalLabel(String value) { - if ((value != null) && value.startsWith("//")) { + if (value != null) { try { return Label.parseAbsolute(value); } catch (LabelSyntaxException e) { diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java index 34b95aab58..70c4fb2974 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JvmConfigurationLoader.java @@ -77,11 +77,15 @@ public final class JvmConfigurationLoader implements ConfigurationFragmentFactor return null; } - if (!forceLegacy && javaHome.startsWith("//")) { - return createDefault(env, javaHome, cpu); - } else { - return createLegacy(javaHome); + if (!forceLegacy) { + try { + return createDefault(env, javaHome, cpu); + } catch (LabelSyntaxException e) { + // Try again with legacy + } } + + return createLegacy(javaHome); } @Override @@ -96,7 +100,7 @@ public final class JvmConfigurationLoader implements ConfigurationFragmentFactor @Nullable private Jvm createDefault(ConfigurationEnvironment lookup, String javaHome, String cpu) - throws InvalidConfigurationException { + throws InvalidConfigurationException, LabelSyntaxException { try { Label label = Label.parseAbsolute(javaHome); label = RedirectChaser.followRedirects(lookup, label, "jdk"); @@ -157,8 +161,6 @@ public final class JvmConfigurationLoader implements ConfigurationFragmentFactor throw new InvalidConfigurationException(e.getMessage(), e); } catch (NoSuchTargetException e) { throw new InvalidConfigurationException("No such target: " + e.getMessage(), e); - } catch (LabelSyntaxException e) { - throw new InvalidConfigurationException(e.getMessage(), e); } } |