Automatically add Java resources carried by static Java libraries.

Bug: 6892294
Change-Id: I3ff71ee3d7b9ccdfde6a5284cc350864fbffa71f
This commit is contained in:
Ying Wang 2012-08-09 15:20:50 -07:00
parent 58a3051c84
commit 8548062922
4 changed files with 18 additions and 1 deletions

View File

@ -1484,7 +1484,6 @@ endef
define transform-java-to-classes.jar
@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
endef
# Override the above definitions if we want to do incremetal javac
@ -1617,12 +1616,27 @@ cp $(PRIVATE_DEX_FILE) $$_adtp_classes_dex && \
$(AAPT) add -k $@ $$_adtp_classes_dex && rm -f $$_adtp_classes_dex)
endef
# Add java resources added by the current module.
#
define add-java-resources-to-package
$(call dump-words-to-file, $(PRIVATE_EXTRA_JAR_ARGS), $(dir $@)jar-arg-list)
$(hide) jar uf $@ @$(dir $@)jar-arg-list
@rm -f $(dir $@)jar-arg-list
endef
# Add java resources carried by static Java libraries.
#
define add-carried-java-resources
$(hide) if [ -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) ] ; then \
java_res_jar_flags=$$(find $(PRIVATE_CLASS_INTERMEDIATES_DIR) -type f -a -not -name "*.class" \
| sed -e "s?^$(PRIVATE_CLASS_INTERMEDIATES_DIR)/? -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ?"); \
if [ -n "$$java_res_jar_flags" ] ; then \
echo $$java_res_jar_flags >$(dir $@)java_res_jar_flags; \
jar uf $@ $$java_res_jar_flags; \
fi; \
fi
endef
# Sign a package using the specified key/cert.
#
define sign-package

View File

@ -82,6 +82,7 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) | $(AAPT)
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-dex-to-package)
$(add-carried-java-resources)
ifneq ($(extra_jar_args),)
$(add-java-resources-to-package)
endif

View File

@ -67,6 +67,7 @@ $(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(AAPT)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-dex-to-package)
$(add-carried-java-resources)
ifneq ($(extra_jar_args),)
$(add-java-resources-to-package)
endif

View File

@ -376,6 +376,7 @@ endif
ifneq ($(full_classes_jar),)
$(add-dex-to-package)
endif
$(add-carried-java-resources)
ifneq ($(extra_jar_args),)
$(add-java-resources-to-package)
endif