Build libcore without a dep on aapt.

Currently building libcore (i.e. to get the core Java libraries) has a
dependency on AAPT. This is problematic for some users that don't want to pull
in the entirety of frameworks/base, e.g. for Dalvik development.

It turns out that all definitions.mk is using aapt for in this case is 'aapt
add -k <jar> <dex>', which adds a file to a JAR while stripping path info.
This is functionally equivalent to 'zip -j', and this CL just makes that
switch.

Change-Id: I292ecaf9d0321018bb7d2e68a49b2cc81de98a20
This commit is contained in:
-b master 2013-01-23 16:54:32 -08:00
parent e79c71ff8a
commit c3ccfeee88
2 changed files with 4 additions and 4 deletions

View File

@ -1638,10 +1638,10 @@ endef
#TODO: update the manifest to point to the dex file
define add-dex-to-package
$(if $(filter classes.dex,$(notdir $(PRIVATE_DEX_FILE))),\
$(hide) $(AAPT) add -k $@ $(PRIVATE_DEX_FILE),\
$(hide) zip -qj $@ $(PRIVATE_DEX_FILE),\
$(hide) _adtp_classes_dex=$(dir $(PRIVATE_DEX_FILE))classes.dex; \
cp $(PRIVATE_DEX_FILE) $$_adtp_classes_dex && \
$(AAPT) add -k $@ $$_adtp_classes_dex && rm -f $$_adtp_classes_dex)
zip -qj $@ $$_adtp_classes_dex && rm -f $$_adtp_classes_dex)
endef
# Add java resources added by the current module.

View File

@ -73,7 +73,7 @@ $(LOCAL_BUILT_MODULE): $(common_javalib.jar)
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(AAPT)
$(common_javalib.jar) : $(built_dex) $(java_resource_sources)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-dex-to-package)
@ -106,7 +106,7 @@ $(built_odex) : $(common_javalib.jar) | $(DEXPREOPT) $(DEXOPT)
@mkdir -p $(dir $@)
$(call dexpreopt-one-file,$<,$@)
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) $(AAPT)
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
$(call copy-file-to-target)
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
$(call dexpreopt-remove-classes.dex,$@)