diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java index e06a8933d5..4fa4f8f859 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java @@ -114,31 +114,17 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction { Transience.PERSISTENT); } - Integer defaultApiLevel; + String defaultApiLevel; if (attributes.isAttributeValueExplicitlySpecified("api_level")) { try { - defaultApiLevel = attributes.get("api_level", Type.INTEGER); + defaultApiLevel = attributes.get("api_level", Type.INTEGER).toString(); } catch (EvalException e) { throw new RepositoryFunctionException(e, Transience.PERSISTENT); } - if (!apiLevels.contains(defaultApiLevel)) { - throw new RepositoryFunctionException( - new EvalException( - rule.getLocation(), - String.format( - "Android SDK api level %s was requested but it is not installed in the Android " - + "SDK at %s. The api levels found were %s. Please choose an available api " - + "level or install api level %s from the Android SDK Manager.", - defaultApiLevel, - androidSdkPath, - apiLevels.toString(), - defaultApiLevel)), - Transience.PERSISTENT); - } } else { // If the api_level attribute is not explicitly set, we select the highest api level that is // available in the SDK. - defaultApiLevel = apiLevels.first(); + defaultApiLevel = String.valueOf(apiLevels.first()); } String buildToolsDirectory; @@ -203,7 +189,7 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction { .replace("%build_tools_version%", buildToolsVersion) .replace("%build_tools_directory%", buildToolsDirectory) .replace("%api_levels%", Iterables.toString(apiLevels)) - .replace("%default_api_level%", String.valueOf(defaultApiLevel)) + .replace("%default_api_level%", defaultApiLevel) .replace("%system_image_dirs%", systemImageDirsList); // All local maven repositories that are shipped in the Android SDK. |