Simplify soong_java_prebuilt.mk and soong_app_prebuilt.mk
Simplify importing Soong modules into Make by always copying
LOCAL_PREBUILT_MODULE_FILE to LOCAL_BUILT_MODULE, which lets
Soong pick the final output file instead of trying to figure
out which of the various intermediate files should be the
output file.
Also fixes an issue where hostdex modules could attempt to
copy to both $(common_javalib.jar) and $(LOCAL_BUILT_MODULE),
which are the same file for host java modules.
Test: set compile_dex:true on core.platform.api.stubs. no warnings
of target overriding
Test: m checkbuild
Change-Id: Id84d499a0869961be5a906d8472b75b9c843b4b4
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index f723633..c50df07 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -27,8 +27,22 @@
full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
-$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
-$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
+ifdef LOCAL_SOONG_CLASSES_JAR
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
+ $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar)))
+
+ ifneq ($(TURBINE_ENABLED),false)
+ ifdef LOCAL_SOONG_HEADER_JAR
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
+ $(eval $(call add-dependency,$(full_classes_jar),$(full_classes_header_jar)))
+ else
+ $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
+ endif
+ endif # TURBINE_ENABLED != false
+endif
+
+$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
$(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
@@ -44,15 +58,6 @@
$(intermediates.COMMON)/proguard_dictionary)
endif
-ifneq ($(TURBINE_ENABLED),false)
-ifdef LOCAL_SOONG_HEADER_JAR
-$(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
-else
-$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
-endif
-endif # TURBINE_ENABLED != false
-
-
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
resource_export_package := $(intermediates.COMMON)/package-export.apk
resource_export_stamp := $(intermediates.COMMON)/src/R.stamp
@@ -74,8 +79,6 @@
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(dir $(LOCAL_BUILT_MODULE))package.dex.apk))
endif
-$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
-
my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\
$(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f)))
my_installed := $(call copy-many-files, $(my_built_installed))