Automatically add Java resources carried by static Java libraries.
Bug: 6892294 Change-Id: I3ff71ee3d7b9ccdfde6a5284cc350864fbffa71f
This commit is contained in:
parent
58a3051c84
commit
8548062922
|
@ -1484,7 +1484,6 @@ endef
|
||||||
define transform-java-to-classes.jar
|
define transform-java-to-classes.jar
|
||||||
@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||||
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
||||||
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Override the above definitions if we want to do incremetal javac
|
# 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)
|
$(AAPT) add -k $@ $$_adtp_classes_dex && rm -f $$_adtp_classes_dex)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Add java resources added by the current module.
|
||||||
|
#
|
||||||
define add-java-resources-to-package
|
define add-java-resources-to-package
|
||||||
$(call dump-words-to-file, $(PRIVATE_EXTRA_JAR_ARGS), $(dir $@)jar-arg-list)
|
$(call dump-words-to-file, $(PRIVATE_EXTRA_JAR_ARGS), $(dir $@)jar-arg-list)
|
||||||
$(hide) jar uf $@ @$(dir $@)jar-arg-list
|
$(hide) jar uf $@ @$(dir $@)jar-arg-list
|
||||||
@rm -f $(dir $@)jar-arg-list
|
@rm -f $(dir $@)jar-arg-list
|
||||||
endef
|
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.
|
# Sign a package using the specified key/cert.
|
||||||
#
|
#
|
||||||
define sign-package
|
define sign-package
|
||||||
|
|
|
@ -82,6 +82,7 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) | $(AAPT)
|
||||||
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
||||||
$(create-empty-package)
|
$(create-empty-package)
|
||||||
$(add-dex-to-package)
|
$(add-dex-to-package)
|
||||||
|
$(add-carried-java-resources)
|
||||||
ifneq ($(extra_jar_args),)
|
ifneq ($(extra_jar_args),)
|
||||||
$(add-java-resources-to-package)
|
$(add-java-resources-to-package)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -67,6 +67,7 @@ $(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(AAPT)
|
||||||
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
|
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
|
||||||
$(create-empty-package)
|
$(create-empty-package)
|
||||||
$(add-dex-to-package)
|
$(add-dex-to-package)
|
||||||
|
$(add-carried-java-resources)
|
||||||
ifneq ($(extra_jar_args),)
|
ifneq ($(extra_jar_args),)
|
||||||
$(add-java-resources-to-package)
|
$(add-java-resources-to-package)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -376,6 +376,7 @@ endif
|
||||||
ifneq ($(full_classes_jar),)
|
ifneq ($(full_classes_jar),)
|
||||||
$(add-dex-to-package)
|
$(add-dex-to-package)
|
||||||
endif
|
endif
|
||||||
|
$(add-carried-java-resources)
|
||||||
ifneq ($(extra_jar_args),)
|
ifneq ($(extra_jar_args),)
|
||||||
$(add-java-resources-to-package)
|
$(add-java-resources-to-package)
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue