diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 85cd2d5144..34e88cebfa 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -118,14 +118,10 @@ $(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | @echo JarJar: $@ $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@ else -$(full_classes_jarjar_jar): $(full_classes_desugar_jar) | $(ACP) - @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ +full_classes_jarjar_jar := $(full_classes_desugar_jar) endif -$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP) - @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ +$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar))) ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) # No dex; all we want are the .class files with resources. diff --git a/core/host_java_library.mk b/core/host_java_library.mk index cc26d7cc9b..42d3efb1bf 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -82,9 +82,7 @@ $(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | @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 $< $@ +full_classes_jarjar_jar := $(full_classes_compiled_jar) endif ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) @@ -101,13 +99,8 @@ endif # $(full_classes_emma_jar) $(full_classes_emma_jar) : $(full_classes_jarjar_jar) | $(EMMA_JAR) $(transform-classes.jar-to-emma) - -$(LOCAL_BUILT_MODULE) : $(full_classes_emma_jar) - @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ - else # LOCAL_EMMA_INSTRUMENT -$(LOCAL_BUILT_MODULE) : $(full_classes_jarjar_jar) | $(ACP) - @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ +full_classes_emma_jar := $(full_classes_jarjar_jar) endif # LOCAL_EMMA_INSTRUMENT + +$(eval $(call copy-one-file,$(full_classes_emma_jar),$(LOCAL_BUILT_MODULE))) diff --git a/core/java.mk b/core/java.mk index e73e762678..8cc3f04815 100644 --- a/core/java.mk +++ b/core/java.mk @@ -109,12 +109,6 @@ ifeq ($(LOCAL_PROGUARD_ENABLED),disabled) LOCAL_PROGUARD_ENABLED := endif -ifdef LOCAL_PROGUARD_ENABLED -proguard_jar_leaf := proguard.classes.jar -else -proguard_jar_leaf := noproguard.classes.jar -endif - full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf) full_classes_desugar_jar := $(intermediates.COMMON)/desugar.classes.jar jarjar_leaf := classes-jarjar.jar @@ -123,7 +117,7 @@ emma_intermediates_dir := $(intermediates.COMMON)/emma_out # emma is hardcoded to use the leaf name of its input for the output file -- # only the output directory can be changed full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf) -full_classes_proguard_jar := $(intermediates.COMMON)/$(proguard_jar_leaf) +full_classes_proguard_jar := $(intermediates.COMMON)/proguard.classes.jar built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar @@ -411,15 +405,7 @@ ifdef full_classes_jar # Droiddoc isn't currently able to generate stubs for modules, so we're just # allowing it to use the classes.jar as the "stubs" that would be use to link # against, for the cases where someone needs the jar to link against. -# - Use the classes.jar instead of the handful of other intermediates that -# we have, because it's the most processed, but still hasn't had dex run on -# it, so it's closest to what's on the device. -# - This extra copy, with the dependency on LOCAL_BUILT_MODULE allows the -# PRIVATE_ vars to be preserved. -$(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar) -$(full_classes_stubs_jar) : $(full_classes_jar) | $(ACP) - @echo Copying $(PRIVATE_SOURCE_FILE) - $(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@ +$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar))) ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar) # The layers file allows you to enforce a layering between java packages. @@ -466,16 +452,14 @@ ifndef my_desugaring full_classes_desugar_jar := $(full_classes_compiled_jar) endif -# Run jarjar if necessary, otherwise just copy the file. +# Run jarjar if necessary ifneq ($(strip $(LOCAL_JARJAR_RULES)),) $(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) $(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR) @echo JarJar: $@ $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@ else -$(full_classes_jarjar_jar): $(full_classes_desugar_jar) | $(ACP) - @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ +full_classes_jarjar_jar := $(full_classes_desugar_jar) endif ifeq ($(LOCAL_EMMA_INSTRUMENT),true) @@ -496,20 +480,16 @@ $(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR) $(transform-classes.jar-to-emma) else -$(full_classes_emma_jar): $(full_classes_jarjar_jar) - @echo Copying: $@ - $(copy-file-to-target) +full_classes_emma_jar := $(full_classes_jarjar_jar) endif # Keep a copy of the jar just before proguard processing. # TODO: this should depend on full_classes_emma_jar once coverage works again -$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP) - @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ +$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar))) $(call define-jar-to-toc-rule, $(full_classes_jar)) -# Run proguard if necessary, otherwise just copy the file. +# Run proguard if necessary ifdef LOCAL_PROGUARD_ENABLED ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),) $(warning while processing: $(LOCAL_MODULE)) @@ -642,10 +622,7 @@ $(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_suppo $(call transform-jar-to-proguard) else # LOCAL_PROGUARD_ENABLED not defined -$(full_classes_proguard_jar) : $(full_classes_jar) | $(ACP) - @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ - +full_classes_proguard_jar := $(full_classes_jar) endif # LOCAL_PROGUARD_ENABLED defined ifndef LOCAL_JACK_ENABLED @@ -663,11 +640,11 @@ $(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(transform-classes.jar-to-dex) endif # LOCAL_JACK_ENABLED is disabled -$(built_dex): $(built_dex_intermediate) | $(ACP) +$(built_dex): $(built_dex_intermediate) @echo Copying: $@ $(hide) mkdir -p $(dir $@) $(hide) rm -f $(dir $@)/classes*.dex - $(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@) + $(hide) cp -fp $(dir $<)/classes*.dex $(dir $@) findbugs_xml := $(intermediates.COMMON)/findbugs.xml $(findbugs_xml): PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \