From bb219fc3dc29e832f3cd8e435c94a894ef2ee87f Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Wed, 26 Jan 2011 15:09:47 -0800 Subject: [PATCH] Add LOCAL_JARJAR_RULES support for BUILD_HOST_JAVA_LIBRARY Bug: 3086427 Change-Id: Ibe73dfa70d4c3d82968c43e74ced38cd74f60e0f --- core/host_java_library.mk | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/core/host_java_library.mk b/core/host_java_library.mk index 27174f2722..322d10fb56 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -27,10 +27,14 @@ ifeq ($(LOCAL_BUILD_HOST_DEX),true) intermediates := $(call local-intermediates-dir) intermediates.COMMON := $(call local-intermediates-dir,COMMON) +full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar +full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar full_classes_jar := $(intermediates.COMMON)/classes.jar built_dex := $(intermediates.COMMON)/classes.dex LOCAL_INTERMEDIATE_TARGETS += \ + $(full_classes_compiled_jar) \ + $(full_classes_jarjar_jar) \ $(full_classes_jar) \ $(built_dex) @@ -47,10 +51,26 @@ $(LOCAL_INTERMEDIATE_TARGETS): \ $(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON) -$(full_classes_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) -$(full_classes_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) $(jar_manifest_file) +$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) +$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) $(jar_manifest_file) $(transform-host-java-to-package) +# Run jarjar if necessary, otherwise just copy the file. +ifneq ($(strip $(LOCAL_JARJAR_RULES)),) +$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) +$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(JARJAR) + @echo JarJar: $@ + $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@ +else +$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP) + @echo Copying: $@ + $(hide) $(ACP) -fp $< $@ +endif + +$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP) + @echo Copying: $@ + $(hide) $(ACP) -fp $< $@ + $(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON) $(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) $(built_dex): $(full_classes_jar) $(DX)