diff options
Diffstat (limited to 'src/main/java/com/google/devtools')
4 files changed, 7 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java b/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java index 20fdf493e0..5067f30e75 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java @@ -63,9 +63,7 @@ public class AarImport implements RuleConfiguredTargetFactory { @Override public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException, RuleErrorException { - if (!AndroidSdkProvider.verifyPresence(ruleContext)) { - return null; - } + AndroidSdkProvider.verifyPresence(ruleContext); RuleConfiguredTargetBuilder ruleBuilder = new RuleConfiguredTargetBuilder(ruleContext); Artifact aar = ruleContext.getPrerequisiteArtifact("aar", Mode.TARGET); diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java index d806620b12..b3044d3f0e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java @@ -101,9 +101,7 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory { CppSemantics cppSemantics = createCppSemantics(); JavaSemantics javaSemantics = createJavaSemantics(); AndroidSemantics androidSemantics = createAndroidSemantics(); - if (!AndroidSdkProvider.verifyPresence(ruleContext)) { - return null; - } + AndroidSdkProvider.verifyPresence(ruleContext); NestedSetBuilder<Artifact> filesBuilder = NestedSetBuilder.stableOrder(); JavaCommon javaCommon = diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java index d5bd4cb0b6..480b4a6ab2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibrary.java @@ -175,9 +175,7 @@ public abstract class AndroidLibrary implements RuleConfiguredTargetFactory { validateRuleContext(ruleContext); JavaSemantics javaSemantics = createJavaSemantics(); AndroidSemantics androidSemantics = createAndroidSemantics(); - if (!AndroidSdkProvider.verifyPresence(ruleContext)) { - return null; - } + AndroidSdkProvider.verifyPresence(ruleContext); checkResourceInlining(ruleContext); NestedSetBuilder<Aar> transitiveAars = NestedSetBuilder.naiveLinkOrder(); NestedSetBuilder<Artifact> transitiveAarArtifacts = NestedSetBuilder.stableOrder(); diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkProvider.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkProvider.java index 2b662a9b1f..741f17d23a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkProvider.java @@ -21,6 +21,7 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException; import javax.annotation.Nullable; /** Description of the tools Blaze needs from an Android SDK. */ @@ -83,16 +84,13 @@ public abstract class AndroidSdkProvider implements TransitiveInfoProvider { } /** - * Signals an error if the Android SDK cannot be found. + * Throws an error if the Android SDK cannot be found. */ - public static boolean verifyPresence(RuleContext ruleContext) { + public static void verifyPresence(RuleContext ruleContext) throws RuleErrorException { if (fromRuleContext(ruleContext) == null) { - ruleContext.ruleError( + throw ruleContext.throwWithRuleError( "No Android SDK found. Use the --android_sdk command line option to specify one."); - return false; } - - return true; } /** The value of build_tools_version. May be null or empty. */ |