blob: 62597d14df00ad9fcf9f217c8dde89b797a7cde8 [file] [log] [blame]
Brian Carlstromced4bff2013-11-14 23:44:56 -08001# dexpreopt_odex_install.mk is used to define odex creation rules for JARs and APKs
2# This file depends on variables set in base_rules.mk
Nicolas Geoffray3972a472018-01-09 11:46:30 +00003# Output variables: LOCAL_DEX_PREOPT, LOCAL_UNCOMPRESS_DEX, built_odex,
4# dexpreopt_boot_jar_module
5
6# We explicitly uncompress APKs of privileged apps, and used by
7# privileged apps
Nicolas Geoffray3972a472018-01-09 11:46:30 +00008ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
Colin Cross0a69bb62018-10-09 16:14:44 -07009 ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
Nicolas Geoffray3972a472018-01-09 11:46:30 +000010 LOCAL_UNCOMPRESS_DEX := true
Colin Crossc18757e2018-10-09 16:33:27 -070011 endif
12
Nicolas Geoffray3972a472018-01-09 11:46:30 +000013 ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
14 LOCAL_UNCOMPRESS_DEX := true
Colin Crossc18757e2018-10-09 16:33:27 -070015 endif
Nicolas Geoffray3972a472018-01-09 11:46:30 +000016endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
Brian Carlstromced4bff2013-11-14 23:44:56 -080017
18# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
19LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
Colin Crossc18757e2018-10-09 16:33:27 -070020ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
21 LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
22
23 ifeq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Not installed to system.img.
24 # Default to nostripping for non system preopt (enables preopt).
25 # Don't strip in case the oat/vdex version in system ROM doesn't match the one in other
26 # partitions. It needs to be able to fall back to the APK for that case.
27 LOCAL_DEX_PREOPT := nostripping
28 endif
29
30 ifneq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES not empty
31 LOCAL_DEX_PREOPT := nostripping
32 endif
33endif
34
Colin Crossfc782ad2018-10-22 13:44:27 -070035ifeq (nostripping,$(LOCAL_DEX_PREOPT))
36 LOCAL_DEX_PREOPT := true
37 LOCAL_STRIP_DEX :=
38else
39 LOCAL_STRIP_DEX := true
40endif
41
Brian Carlstromced4bff2013-11-14 23:44:56 -080042ifeq (false,$(LOCAL_DEX_PREOPT))
43 LOCAL_DEX_PREOPT :=
44endif
Colin Cross0a69bb62018-10-09 16:14:44 -070045
Colin Crossc18757e2018-10-09 16:33:27 -070046# Only enable preopt for non tests.
47ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests))
48 LOCAL_DEX_PREOPT :=
49endif
50
51# If we have product-specific config for this module?
52ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
53 LOCAL_DEX_PREOPT :=
54endif
55
56# Disable preopt for TARGET_BUILD_APPS
57ifneq (,$(TARGET_BUILD_APPS))
58 LOCAL_DEX_PREOPT :=
59endif
60
61# Disable preopt if not WITH_DEXPREOPT
62ifneq (true,$(WITH_DEXPREOPT))
63 LOCAL_DEX_PREOPT :=
64endif
65
Brian Carlstromced4bff2013-11-14 23:44:56 -080066ifdef LOCAL_UNINSTALLABLE_MODULE
Colin Cross0a69bb62018-10-09 16:14:44 -070067 LOCAL_DEX_PREOPT :=
Brian Carlstromced4bff2013-11-14 23:44:56 -080068endif
Colin Cross0a69bb62018-10-09 16:14:44 -070069
Colin Crossf229de42017-10-05 16:01:00 -070070ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) # contains no java code
Colin Cross0a69bb62018-10-09 16:14:44 -070071 LOCAL_DEX_PREOPT :=
Brian Carlstromced4bff2013-11-14 23:44:56 -080072endif
Colin Cross0a69bb62018-10-09 16:14:44 -070073
Mathieu Chartier418258c2017-08-28 14:19:35 -070074# if WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true and module is not in boot class path skip
75# Also preopt system server jars since selinux prevents system server from loading anything from
76# /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
Mathieu Chartier0fbb8362017-09-15 13:40:48 -070077# or performance. If my_preopt_for_extracted_apk is true, we ignore the only preopt boot image
78# options.
79ifneq (true,$(my_preopt_for_extracted_apk))
Colin Cross0a69bb62018-10-09 16:14:44 -070080 ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
81 ifeq ($(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)
82 LOCAL_DEX_PREOPT :=
83 endif
84 endif
Mathieu Chartier0fbb8362017-09-15 13:40:48 -070085endif
86
Alex Light4e358ab2016-06-16 14:47:10 -070087ifeq ($(LOCAL_DEX_PREOPT),true)
Colin Cross0a69bb62018-10-09 16:14:44 -070088 # Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
89 ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
Colin Crossfc782ad2018-10-22 13:44:27 -070090 LOCAL_STRIP_DEX :=
Colin Cross0a69bb62018-10-09 16:14:44 -070091 endif # LOCAL_UNCOMPRESS_DEX
Nicolas Geoffray3972a472018-01-09 11:46:30 +000092
Colin Cross0a69bb62018-10-09 16:14:44 -070093 # system_other isn't there for an OTA, so don't strip
94 # if module is on system, and odex is on system_other.
95 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
96 ifneq ($(call install-on-system-other, $(my_module_path)),)
Colin Crossfc782ad2018-10-22 13:44:27 -070097 LOCAL_STRIP_DEX :=
Colin Cross0a69bb62018-10-09 16:14:44 -070098 endif # install-on-system-other
99 endif # BOARD_USES_SYSTEM_OTHER_ODEX
Nicolas Geoffray3972a472018-01-09 11:46:30 +0000100
Colin Cross0a69bb62018-10-09 16:14:44 -0700101 # We also don't strip if all dexs are uncompressed (dexopt will not store the dex code),
102 # but that requires to inspect the source file, which is too early at this point (as we
103 # don't know if the source file will actually be used).
104 # See dexpreopt-remove-classes.dex.
Nicolas Geoffray3972a472018-01-09 11:46:30 +0000105endif # LOCAL_DEX_PREOPT
Brian Carlstromced4bff2013-11-14 23:44:56 -0800106
107built_odex :=
David Brazdil70470162016-08-25 13:50:15 +0100108built_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800109built_art :=
Brian Carlstromced4bff2013-11-14 23:44:56 -0800110installed_odex :=
David Brazdil70470162016-08-25 13:50:15 +0100111installed_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800112installed_art :=
Ying Wang74c98502014-05-19 13:03:36 -0700113built_installed_odex :=
David Brazdil70470162016-08-25 13:50:15 +0100114built_installed_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800115built_installed_art :=
Calin Juravlef99ab752018-04-19 20:32:57 -0700116my_process_profile :=
117my_profile_is_text_listing :=
Po Hueaef4d82018-10-10 13:13:38 +0800118my_generate_dm :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800119
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700120ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
Colin Cross0a69bb62018-10-09 16:14:44 -0700121 LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700122endif
123
124ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
Colin Cross0a69bb62018-10-09 16:14:44 -0700125 # If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
126 # profile class listing. TODO: Use product specific directory here.
127 my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
128 LOCAL_DEX_PREOPT_PROFILE := $(my_classes_directory)/$(LOCAL_MODULE).prof
Calin Juravle7d701352018-04-25 15:25:46 -0700129
Colin Cross0a69bb62018-10-09 16:14:44 -0700130 ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE)))
131 my_process_profile := true
132 my_profile_is_text_listing := false
133 endif
Calin Juravlef99ab752018-04-19 20:32:57 -0700134else
Colin Cross0a69bb62018-10-09 16:14:44 -0700135 my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE)
136 my_profile_is_text_listing := true
137 LOCAL_DEX_PREOPT_PROFILE := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700138endif
Mathieu Chartier48762292017-09-13 22:08:45 -0700139
Calin Juravlef99ab752018-04-19 20:32:57 -0700140ifeq (true,$(my_process_profile))
Mathieu Chartier48762292017-09-13 22:08:45 -0700141
Colin Cross0a69bb62018-10-09 16:14:44 -0700142 ifeq (,$(LOCAL_DEX_PREOPT_APP_IMAGE))
143 LOCAL_DEX_PREOPT_APP_IMAGE := true
144 endif
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700145
Colin Cross0a69bb62018-10-09 16:14:44 -0700146 ifndef LOCAL_DEX_PREOPT_PROFILE
147 $(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE))
148 endif
149 ifeq (,$(dex_preopt_profile_src_file))
150 $(call pretty-error, Internal error: dex_preopt_profile_src_file must be set)
151 endif
152 my_built_profile := $(dir $(LOCAL_BUILT_MODULE))/profile.prof
153 my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
154 # Remove compressed APK extension.
155 my_dex_location := $(patsubst %.gz,%,$(my_dex_location))
156 $(my_built_profile): PRIVATE_BUILT_MODULE := $(dex_preopt_profile_src_file)
157 $(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
158 $(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE)
159 $(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE)
160 $(my_built_profile): $(PROFMAN)
161 $(my_built_profile): $(dex_preopt_profile_src_file)
162 ifeq (true,$(my_profile_is_text_listing))
163 # The profile is a test listing of classes (used for framework jars).
164 # We need to generate the actual binary profile before being able to compile.
165 $(my_built_profile):
Mathieu Chartier48762292017-09-13 22:08:45 -0700166 $(hide) mkdir -p $(dir $@)
167 ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
168 --create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
169 --apk=$(PRIVATE_BUILT_MODULE) \
170 --dex-location=$(PRIVATE_DEX_LOCATION) \
171 --reference-profile-file=$@
Colin Cross0a69bb62018-10-09 16:14:44 -0700172 else
173 # The profile is binary profile (used for apps). Run it through profman to
174 # ensure the profile keys match the apk.
175 $(my_built_profile):
Calin Juravlef99ab752018-04-19 20:32:57 -0700176 $(hide) mkdir -p $(dir $@)
177 touch $@
178 ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
179 --copy-and-update-profile-key \
180 --profile-file=$(PRIVATE_SOURCE_CLASSES) \
181 --apk=$(PRIVATE_BUILT_MODULE) \
Calin Juravle60216612018-04-26 18:52:45 -0700182 --dex-location=$(PRIVATE_DEX_LOCATION) \
Calin Juravlef99ab752018-04-19 20:32:57 -0700183 --reference-profile-file=$@ \
184 || echo "Profile out of date for $(PRIVATE_BUILT_MODULE)"
Colin Cross0a69bb62018-10-09 16:14:44 -0700185 endif
Calin Juravlef99ab752018-04-19 20:32:57 -0700186
Colin Cross0a69bb62018-10-09 16:14:44 -0700187 my_profile_is_text_listing :=
188 dex_preopt_profile_src_file :=
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800189
Colin Cross0a69bb62018-10-09 16:14:44 -0700190 # Remove compressed APK extension.
191 my_installed_profile := $(patsubst %.gz,%,$(LOCAL_INSTALLED_MODULE)).prof
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800192
Colin Cross0a69bb62018-10-09 16:14:44 -0700193 # my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
194 $(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
195 build_installed_profile:=$(my_built_profile):$(my_installed_profile)
Mathieu Chartier48762292017-09-13 22:08:45 -0700196else
Colin Cross0a69bb62018-10-09 16:14:44 -0700197 build_installed_profile:=
198 my_installed_profile :=
Mathieu Chartier48762292017-09-13 22:08:45 -0700199endif
200
201ifdef LOCAL_DEX_PREOPT
202
Colin Cross0a69bb62018-10-09 16:14:44 -0700203 dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
Andreas Gampe039bb482018-01-19 10:56:23 -0800204
Colin Cross0a69bb62018-10-09 16:14:44 -0700205 ifdef dexpreopt_boot_jar_module
206 # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
207 # We use this installed_odex trick to get boot.art installed.
208 installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
209 # Append the odex for the 2nd arch if we have one.
210 installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
211 else # boot jar
212 ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
Andreas Gampe039bb482018-01-19 10:56:23 -0800213
Colin Cross0a69bb62018-10-09 16:14:44 -0700214 my_module_multilib := $(LOCAL_MULTILIB)
215 # If the module is not an SDK library and it's a system server jar, only preopt the primary arch.
216 my_filtered_lib_name := $(patsubst %.impl,%,$(LOCAL_MODULE))
217 ifeq (,$(filter $(JAVA_SDK_LIBRARIES),$(my_filtered_lib_name)))
218 # For a Java library, by default we build odex for both 1st arch and 2nd arch.
219 # But it can be overridden with "LOCAL_MULTILIB := first".
220 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
221 # For system server jars, we build for only "first".
222 my_module_multilib := first
223 endif
224 endif
Mathieu Chartier502892a2018-07-06 13:29:43 -0700225
Colin Cross0a69bb62018-10-09 16:14:44 -0700226 # Only preopt primary arch for translated arch since there is only an image there.
227 ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
228 my_module_multilib := first
229 endif
Mathieu Chartier502892a2018-07-06 13:29:43 -0700230
Colin Cross0a69bb62018-10-09 16:14:44 -0700231 # #################################################
232 # Odex for the 1st arch
233 my_2nd_arch_prefix :=
234 include $(BUILD_SYSTEM)/setup_one_odex.mk
235 # #################################################
236 # Odex for the 2nd arch
237 ifdef TARGET_2ND_ARCH
238 ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
239 ifneq (first,$(my_module_multilib))
240 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
241 include $(BUILD_SYSTEM)/setup_one_odex.mk
242 endif # my_module_multilib is not first.
243 endif # TARGET_TRANSLATE_2ND_ARCH not true
244 endif # TARGET_2ND_ARCH
245 # #################################################
246 else # must be APPS
247 # The preferred arch
248 my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
249 # Save the module multilib since setup_one_odex modifies it.
250 saved_my_module_multilib := $(my_module_multilib)
251 include $(BUILD_SYSTEM)/setup_one_odex.mk
252 my_module_multilib := $(saved_my_module_multilib)
253 ifdef TARGET_2ND_ARCH
254 ifeq ($(my_module_multilib),both)
255 # The non-preferred arch
256 my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
257 include $(BUILD_SYSTEM)/setup_one_odex.mk
258 endif # LOCAL_MULTILIB is both
259 endif # TARGET_2ND_ARCH
260 endif # LOCAL_MODULE_CLASS
261 endif # boot jar
Mathieu Chartierfd5dfb82018-07-12 18:17:54 -0700262
Colin Cross0a69bb62018-10-09 16:14:44 -0700263 built_odex := $(strip $(built_odex))
264 built_vdex := $(strip $(built_vdex))
265 built_art := $(strip $(built_art))
266 installed_odex := $(strip $(installed_odex))
267 installed_vdex := $(strip $(installed_vdex))
268 installed_art := $(strip $(installed_art))
Brian Carlstromced4bff2013-11-14 23:44:56 -0800269
Colin Cross0a69bb62018-10-09 16:14:44 -0700270 ifdef built_odex
271 ifeq (true,$(my_process_profile))
272 $(built_odex): $(my_built_profile)
273 $(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700274 else
Colin Cross0a69bb62018-10-09 16:14:44 -0700275 $(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
276 endif
277
278 ifndef LOCAL_DEX_PREOPT_FLAGS
279 LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
280 ifndef LOCAL_DEX_PREOPT_FLAGS
281 LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
Mathieu Chartier6a902102017-06-23 10:44:45 -0700282 endif
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700283 endif
Nicolas Geoffrayb08ada12017-03-22 12:36:05 +0000284
Colin Cross0a69bb62018-10-09 16:14:44 -0700285 my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
286 ifeq (,$(my_system_server_compiler_filter))
287 my_system_server_compiler_filter := speed
288 endif
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800289
Colin Cross0a69bb62018-10-09 16:14:44 -0700290 my_default_compiler_filter := $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER)
291 ifeq (,$(my_default_compiler_filter))
292 # If no default compiler filter is specified, default to 'quicken' to save on storage.
293 my_default_compiler_filter := quicken
294 endif
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800295
Colin Cross0a69bb62018-10-09 16:14:44 -0700296 ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
297 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
298 # Jars of system server, use the product option if it is set, speed otherwise.
299 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter)
300 else
301 ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
302 # Apps loaded into system server, and apps the product default to being compiled with the
303 # 'speed' compiler filter.
304 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
305 else
306 ifeq (true,$(my_process_profile))
307 # For non system server jars, use speed-profile when we have a profile.
308 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
309 else
310 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_default_compiler_filter)
311 endif
312 endif
313 endif
314 endif
315
316 my_generate_dm := $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)
317 ifeq (,$(filter $(LOCAL_DEX_PREOPT_FLAGS),--compiler-filter=verify))
318 # Generating DM files only makes sense for verify, avoid doing for non verify compiler filter APKs.
319 my_generate_dm := false
320 endif
321
322 # No reason to use a dm file if the dex is already uncompressed.
323 ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
324 my_generate_dm := false
325 endif
326
327 ifeq (true,$(my_generate_dm))
328 LOCAL_DEX_PREOPT_FLAGS += --copy-dex-files=false
Colin Crossfc782ad2018-10-22 13:44:27 -0700329 LOCAL_DEX_PREOPT := true
330 LOCAL_STRIP_DEX :=
Colin Cross0a69bb62018-10-09 16:14:44 -0700331 my_built_dm := $(dir $(LOCAL_BUILT_MODULE))generated.dm
332 my_installed_dm := $(patsubst %.apk,%,$(LOCAL_INSTALLED_MODULE)).dm
333 my_copied_vdex := $(dir $(LOCAL_BUILT_MODULE))primary.vdex
334 $(eval $(call copy-one-file,$(built_vdex),$(my_copied_vdex)))
335 $(my_built_dm): PRIVATE_INPUT_VDEX := $(my_copied_vdex)
336 $(my_built_dm): $(my_copied_vdex) $(ZIPTIME)
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800337 $(hide) mkdir -p $(dir $@)
338 $(hide) rm -f $@
339 $(hide) zip -qD -j -X -9 $@ $(PRIVATE_INPUT_VDEX)
340 $(ZIPTIME) $@
Colin Cross0a69bb62018-10-09 16:14:44 -0700341 $(eval $(call copy-one-file,$(my_built_dm),$(my_installed_dm)))
342 endif
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800343
Colin Cross0a69bb62018-10-09 16:14:44 -0700344 # By default, emit debug info.
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700345 my_dexpreopt_debug_info := true
Colin Cross0a69bb62018-10-09 16:14:44 -0700346 # If the global setting suppresses mini-debug-info, disable it.
347 ifeq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
348 my_dexpreopt_debug_info := false
349 endif
350
351 # PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
352 # PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
353 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
354 ifeq (true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
355 my_dexpreopt_debug_info := true
356 else ifeq (false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
357 my_dexpreopt_debug_info := false
358 endif
359 else
360 ifeq (true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
361 my_dexpreopt_debug_info := true
362 else ifeq (false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
363 my_dexpreopt_debug_info := false
364 endif
365 endif
366
367 # Never enable on eng.
368 ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
369 my_dexpreopt_debug_info := false
370 endif
371
372 # Add dex2oat flag for debug-info/no-debug-info.
373 ifeq (true,$(my_dexpreopt_debug_info))
374 LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
375 else ifeq (false,$(my_dexpreopt_debug_info))
376 LOCAL_DEX_PREOPT_FLAGS += --no-generate-mini-debug-info
377 endif
378
379 # Set the compiler reason to 'prebuilt' to identify the oat files produced
380 # during the build, as opposed to compiled on the device.
381 LOCAL_DEX_PREOPT_FLAGS += --compilation-reason=prebuilt
382
383 $(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
384 $(built_vdex): $(built_odex)
385 $(built_art): $(built_odex)
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700386 endif
Colin Cross0a69bb62018-10-09 16:14:44 -0700387
388 ifneq (true,$(my_generate_dm))
389 # Add the installed_odex to the list of installed files for this module if we aren't generating a
390 # dm file.
391 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
392 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
393 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
394
395 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
396 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
397 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
398
399 # Make sure to install the .odex and .vdex when you run "make <module_name>"
400 $(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
401 else
402 ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_dm)
403 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_dm) $(my_installed_dm)
404
405 # Make sure to install the .dm when you run "make <module_name>"
406 $(my_all_targets): $(installed_dm)
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700407 endif
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700408
Colin Cross0a69bb62018-10-09 16:14:44 -0700409 # Record dex-preopt config.
410 DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
411 DEXPREOPT.$(LOCAL_MODULE).MULTILIB := $(LOCAL_MULTILIB)
412 DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
413 DEXPREOPT.$(LOCAL_MODULE).PRIVILEGED_MODULE := $(LOCAL_PRIVILEGED_MODULE)
414 DEXPREOPT.$(LOCAL_MODULE).VENDOR_MODULE := $(LOCAL_VENDOR_MODULE)
415 DEXPREOPT.$(LOCAL_MODULE).TARGET_ARCH := $(LOCAL_MODULE_TARGET_ARCH)
416 DEXPREOPT.$(LOCAL_MODULE).INSTALLED := $(installed_odex)
417 DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE)
418 DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
419 $(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE))
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800420
Brian Carlstromced4bff2013-11-14 23:44:56 -0800421endif # LOCAL_DEX_PREOPT
Mathieu Chartier48762292017-09-13 22:08:45 -0700422
423# Profile doesn't depend on LOCAL_DEX_PREOPT.
424ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
425ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
426
Calin Juravle7d701352018-04-25 15:25:46 -0700427my_process_profile :=
428
Mathieu Chartier48762292017-09-13 22:08:45 -0700429$(my_all_targets): $(my_installed_profile)