summaryrefslogtreecommitdiffstats
path: root/core/prebuilt_internal.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2014-10-29 15:48:32 -0700
committerYing Wang <wangying@google.com>2014-10-29 23:40:52 +0000
commitf56729250448200834c5c95c86c937e887d73623 (patch)
tree6f015fdb97441180dae69a6b3e88c6f64b091a00 /core/prebuilt_internal.mk
parentc9594afa930e5400d35bbf24a17cb9be8d978888 (diff)
downloadbuild-f56729250448200834c5c95c86c937e887d73623.zip
build-f56729250448200834c5c95c86c937e887d73623.tar.gz
build-f56729250448200834c5c95c86c937e887d73623.tar.bz2
Add support for prebuilt AARs.
- You can give a .aar as source file to a prebuilt static Java library module. The build system will set up dependencies and rules to extract classes.jar and other resource files. - To build against a prebuilt AAR module, use: LOCAL_STATIC_JAVA_AAR_LIBRARIES := <module names of aar prebuilt AARs> The build system will set up rules to merge the library's AndroidManifest.xml with the main AndroidManifest.xml, add the AAR's resource dirs and link/merge the AAR's classes.jar. Bug: 18168693 Change-Id: I478913d5d498f800b322529d7c2c2c0ea78425e5
Diffstat (limited to 'core/prebuilt_internal.mk')
-rw-r--r--core/prebuilt_internal.mk22
1 files changed, 19 insertions, 3 deletions
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 284884c..5fcd3be 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -247,10 +247,26 @@ ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# while the deps should be in the common dir, so we make a copy in the common dir.
# For nonstatic library, $(common_javalib_jar) is the dependency file,
# while $(common_classes_jar) is used to link.
-common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
-common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
+common_classes_jar := $(intermediates.COMMON)/classes.jar
+common_javalib_jar := $(intermediates.COMMON)/javalib.jar
-$(common_classes_jar) : $(my_prebuilt_src_file) | $(ACP)
+$(common_classes_jar) $(common_javalib_jar): PRIVATE_MODULE := $(LOCAL_MODULE)
+
+ifneq ($(filter %.aar, $(my_prebuilt_src_file)),)
+# This is .aar file, archive of classes.jar and Android resources.
+my_src_jar := $(intermediates.COMMON)/aar/classes.jar
+
+$(my_src_jar) : $(my_prebuilt_src_file)
+ $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
+ $(hide) unzip -qo -d $(dir $@) $<
+ # Make sure the extracted classes.jar has a new timestamp.
+ $(hide) touch $@
+
+else
+# This is jar file.
+my_src_jar := $(my_prebuilt_src_file)
+endif
+$(common_classes_jar) : $(my_src_jar) | $(ACP)
$(transform-prebuilt-to-target)
$(common_javalib_jar) : $(common_classes_jar) | $(ACP)