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
diff --git a/core/definitions.mk b/core/definitions.mk
index 48cb0ad..c91220d 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1638,10 +1638,10 @@
 #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.
diff --git a/core/java_library.mk b/core/java_library.mk
index 6392108..62b16c3 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -73,7 +73,7 @@
 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 @@
 	@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,$@)