aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross2019-01-14 16:10:20 -0600
committerColin Cross2019-01-15 12:16:55 -0600
commita76cc6d732431ebb2ceddaf87445aedd548d1623 (patch)
treebb81e307c173cf3ba7d9a36b9f2fc632442f5509
parent1a2e9dc10c71e70648cf82254fe75e45ea7e6153 (diff)
downloadplatform-build-a76cc6d732431ebb2ceddaf87445aedd548d1623.tar.gz
platform-build-a76cc6d732431ebb2ceddaf87445aedd548d1623.tar.xz
platform-build-a76cc6d732431ebb2ceddaf87445aedd548d1623.zip
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
-rw-r--r--core/soong_app_prebuilt.mk29
-rw-r--r--core/soong_java_prebuilt.mk91
2 files changed, 59 insertions, 61 deletions
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index f7236335b..c50df07f4 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -27,8 +27,22 @@ full_classes_jar := $(intermediates.COMMON)/classes.jar
27full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar 27full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
28full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar 28full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
29 29
30$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar))) 30ifdef LOCAL_SOONG_CLASSES_JAR
31$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar))) 31 $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
32 $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
33 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar)))
34
35 ifneq ($(TURBINE_ENABLED),false)
36 ifdef LOCAL_SOONG_HEADER_JAR
37 $(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
38 $(eval $(call add-dependency,$(full_classes_jar),$(full_classes_header_jar)))
39 else
40 $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
41 endif
42 endif # TURBINE_ENABLED != false
43endif
44
45$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
32 46
33ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR 47ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
34 $(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\ 48 $(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
@@ -44,15 +58,6 @@ ifdef LOCAL_SOONG_PROGUARD_DICT
44 $(intermediates.COMMON)/proguard_dictionary) 58 $(intermediates.COMMON)/proguard_dictionary)
45endif 59endif
46 60
47ifneq ($(TURBINE_ENABLED),false)
48ifdef LOCAL_SOONG_HEADER_JAR
49$(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
50else
51$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
52endif
53endif # TURBINE_ENABLED != false
54
55
56ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE 61ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
57resource_export_package := $(intermediates.COMMON)/package-export.apk 62resource_export_package := $(intermediates.COMMON)/package-export.apk
58resource_export_stamp := $(intermediates.COMMON)/src/R.stamp 63resource_export_stamp := $(intermediates.COMMON)/src/R.stamp
@@ -74,8 +79,6 @@ ifneq ($(BUILD_PLATFORM_ZIP),)
74 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(dir $(LOCAL_BUILT_MODULE))package.dex.apk)) 79 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(dir $(LOCAL_BUILT_MODULE))package.dex.apk))
75endif 80endif
76 81
77$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
78
79my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\ 82my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\
80 $(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f))) 83 $(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f)))
81my_installed := $(call copy-many-files, $(my_built_installed)) 84my_installed := $(call copy-many-files, $(my_built_installed))
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index cfda44e0e..81a65d098 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -24,8 +24,22 @@ common_javalib.jar := $(intermediates.COMMON)/javalib.jar
24hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv 24hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv
25hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv 25hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
26 26
27$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar))) 27ifdef LOCAL_SOONG_CLASSES_JAR
28$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar))) 28 $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
29 $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
30 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar)))
31
32 ifneq ($(TURBINE_ENABLED),false)
33 ifdef LOCAL_SOONG_HEADER_JAR
34 $(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
35 $(eval $(call add-dependency,$(full_classes_jar),$(full_classes_header_jar)))
36 else
37 $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
38 endif
39 endif # TURBINE_ENABLED != false
40endif
41
42$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
29 43
30ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR 44ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
31 $(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\ 45 $(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
@@ -64,49 +78,33 @@ ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
64 $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_static_library_android_manifest)) 78 $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_static_library_android_manifest))
65endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE 79endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
66 80
67ifneq ($(TURBINE_ENABLED),false)
68ifdef LOCAL_SOONG_HEADER_JAR
69$(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
70else
71$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
72endif
73endif # TURBINE_ENABLED != false
74 81
75ifdef LOCAL_SOONG_DEX_JAR 82ifdef LOCAL_SOONG_DEX_JAR
76 ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true) 83 ifndef LOCAL_IS_HOST_MODULE
77 ifndef LOCAL_IS_HOST_MODULE 84 ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
78 ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar 85 # Derive greylist from classes.jar.
79 # Derive greylist from classes.jar. 86 # We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
80 # We use full_classes_jar here, which is the post-proguard jar (on the basis that we also 87 # have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
81 # have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in 88 # java.mk.
82 # java.mk. 89 $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
83 $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv))) 90 $(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
84 $(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) 91
85 92 ifeq (true,$(WITH_DEXPREOPT))
86 ifeq (true,$(WITH_DEXPREOPT)) 93 # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
87 # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE). 94 # We use this installed_odex trick to get boot.art installed.
88 # We use this installed_odex trick to get boot.art installed. 95 installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
89 installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) 96 # Append the odex for the 2nd arch if we have one.
90 # Append the odex for the 2nd arch if we have one. 97 installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
91 installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) 98 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
92 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex) 99 # Make sure to install the .odex and .vdex when you run "make <module_name>"
93 # Make sure to install the .odex and .vdex when you run "make <module_name>" 100 $(my_all_targets): $(installed_odex)
94 $(my_all_targets): $(installed_odex) 101 endif
95 endif 102 else # !is_boot_jar
96 else # !is_boot_jar 103 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
97 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) 104 endif # is_boot_jar
98 endif # is_boot_jar 105
99 $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar))) 106 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(common_javalib.jar)))
100 107 $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar)))
101 $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
102 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(common_javalib.jar)))
103 else # LOCAL_IS_HOST_MODULE
104 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE)))
105 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar) $(full_classes_header_jar)))
106 endif
107
108 java-dex : $(LOCAL_BUILT_MODULE)
109 else # LOCAL_UNINSTALLABLE_MODULE
110 108
111 ifneq ($(filter $(LOCAL_MODULE),$(HIDDENAPI_EXTRA_APP_USAGE_JARS)),) 109 ifneq ($(filter $(LOCAL_MODULE),$(HIDDENAPI_EXTRA_APP_USAGE_JARS)),)
112 # Derive greylist from classes.jar. 110 # Derive greylist from classes.jar.
@@ -115,18 +113,15 @@ ifdef LOCAL_SOONG_DEX_JAR
115 # java.mk. 113 # java.mk.
116 $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv))) 114 $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
117 endif 115 endif
116 endif
118 117
119 $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE))) 118 java-dex : $(LOCAL_BUILT_MODULE)
120 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
121 java-dex : $(common_javalib.jar)
122 endif # LOCAL_UNINSTALLABLE_MODULE
123else # LOCAL_SOONG_DEX_JAR 119else # LOCAL_SOONG_DEX_JAR
124 ifndef LOCAL_UNINSTALLABLE_MODULE 120 ifndef LOCAL_UNINSTALLABLE_MODULE
125 ifndef LOCAL_IS_HOST_MODULE 121 ifndef LOCAL_IS_HOST_MODULE
126 $(call pretty-error,Installable device module must have LOCAL_SOONG_DEX_JAR set) 122 $(call pretty-error,Installable device module must have LOCAL_SOONG_DEX_JAR set)
127 endif 123 endif
128 endif 124 endif
129 $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
130endif # LOCAL_SOONG_DEX_JAR 125endif # LOCAL_SOONG_DEX_JAR
131 126
132my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\ 127my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\