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)