diff options
author | 2015-07-22 09:23:45 +0000 | |
---|---|---|
committer | 2015-07-23 10:59:42 +0000 | |
commit | 9117e140547a0f47fea33ce0cbb869b61334d05a (patch) | |
tree | c7a38ca2b28d831fe91b468a58275bd8ad6f6e64 /src/main | |
parent | 8a0ce7bafdd08580949d1d0beac2025ea4d20393 (diff) |
Make Android appcompat libraries available using external labels.
This probably doesn't work with old SDKs and I have only tested with 21.1.1, but I assume the path to these libraries is not changed willy-nilly.
--
MOS_MIGRATED_REVID=98816286
Diffstat (limited to 'src/main')
3 files changed, 24 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryRule.java index 5e97f303a0..95bd3c72fb 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryRule.java @@ -44,8 +44,11 @@ public class AndroidSdkRepositoryRule implements RuleDefinition { @Nullable @Override public Map<String, Label> apply(Rule rule) { + String prefix = "@" + rule.getName() + "//:"; return ImmutableMap.of( - "android/sdk", Label.parseAbsoluteUnchecked("@" + rule.getName() + "//:sdk")); + "android/sdk", Label.parseAbsoluteUnchecked(prefix + "sdk"), + "android/appcompat_v4", Label.parseAbsoluteUnchecked(prefix + "appcompat_v4"), + "android/appcompat_v7", Label.parseAbsoluteUnchecked(prefix + "appcompat_v7")); } }; diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE index e59df8ea64..27bbd95078 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE @@ -13,3 +13,5 @@ bind(name = "android/shuffle_jars", actual = "//tools/android:shuffle_jars") bind(name = "android/merge_dexzips", actual = "//tools/android:merge_dexzips") bind(name = "android/sdk") bind(name = "android/crosstool", actual = "//tools/cpp:toolchain") +bind(name = "android/appcompat_v4") +bind(name = "android/appcompat_v7") diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt index 06f8f650c8..9f92c24799 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt @@ -1,5 +1,23 @@ package(default_visibility = ["//visibility:public"]) +java_import( + name = "appcompat_v7_import", + jars = ["extras/android/support/v7/appcompat/libs/android-support-v7-appcompat.jar"] +) + +android_library( + name = "appcompat_v7", + custom_package = "android.support.v7.appcompat", + manifest = "extras/android/support/v7/appcompat/AndroidManifest.xml", + resource_files = glob(["extras/android/support/v7/appcompat/res/**"]), + deps = [":appcompat_v7_import"] +) + +java_import( + name = "appcompat_v4", + jars = ["extras/android/support/v4/android-support-v4.jar"] +) + android_sdk( name = "sdk", proguard = "tools/proguard/bin/proguard.sh", |