Fix classes.jack extraction from platform.zip

The copy is handled by the common rule, so JAVA_dependency_template
really only needs to add the extra dependencies. Otherwise we were
getting duplicate rule warnings.

This may extract more files than necessary, but that's better than not
enough.

Bug: 26510884
Change-Id: I022f3cc6ddd1982af3f948740917ac03e795f4c5
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index b63031f..41c3590 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -152,10 +152,8 @@
 endif
 
 define JAVA_dependency_template
-$(PDK_FUSION_OUT_DIR)/$(strip $(1)): $(_pdk_fusion_intermediates)/$(strip $(1)) \
-  $(foreach d,$(2),$(PDK_FUSION_OUT_DIR)/$(d)) $(_pdk_fusion_stamp)
-	@mkdir -p $$(dir $$@)
-	$(hide) cp -fpPR $$< $$@
+$(call add-dependency,$(PDK_FUSION_OUT_DIR)/$(strip $(1)),\
+  $(foreach d,$(filter $(2),$(_pdk_fusion_java_file_list)),$(PDK_FUSION_OUT_DIR)/$(d)))
 endef
 
 # needs explicit dependency as package-export.apk is not explicitly pulled
@@ -174,7 +172,7 @@
     $(lib_dir)/classes.jar $(lib_dir)/classes.jack)))
 $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
   $(eval $(call JAVA_dependency_template,$(lib_dir)/classes.dex.toc,\
-    $(filter $(lib_dir)/classes%.dex, $(_pdk_fusion_java_file_list)))))
+    $(lib_dir)/classes.jar $(lib_dir)/classes.jack $(lib_dir)/classes%.dex)))
 
 # implicit rules for all other target files
 $(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp)