blob: b1a0a23469322232ffd082865423b116f98dcc87 [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
8LOCAL_UNCOMPRESS_DEX := false
9ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
Colin Cross0a69bb62018-10-09 16:14:44 -070010 ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
Nicolas Geoffray3972a472018-01-09 11:46:30 +000011 LOCAL_UNCOMPRESS_DEX := true
Colin Crossc18757e2018-10-09 16:33:27 -070012 endif
13
14 ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
15 LOCAL_UNCOMPRESS_DEX := true
16 endif
Nicolas Geoffray3972a472018-01-09 11:46:30 +000017endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
Brian Carlstromced4bff2013-11-14 23:44:56 -080018
19# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
20LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
Colin Crossc18757e2018-10-09 16:33:27 -070021ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
22 LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
23
24 ifeq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Not installed to system.img.
25 # Default to nostripping for non system preopt (enables preopt).
26 # Don't strip in case the oat/vdex version in system ROM doesn't match the one in other
27 # partitions. It needs to be able to fall back to the APK for that case.
28 LOCAL_DEX_PREOPT := nostripping
29 endif
30
31 ifneq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES not empty
32 LOCAL_DEX_PREOPT := nostripping
33 endif
34endif
35
Brian Carlstromced4bff2013-11-14 23:44:56 -080036ifeq (false,$(LOCAL_DEX_PREOPT))
37 LOCAL_DEX_PREOPT :=
38endif
Colin Cross0a69bb62018-10-09 16:14:44 -070039
Colin Crossc18757e2018-10-09 16:33:27 -070040# Only enable preopt for non tests.
41ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests))
42 LOCAL_DEX_PREOPT :=
43endif
44
45# If we have product-specific config for this module?
46ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
47 LOCAL_DEX_PREOPT :=
48endif
49
50# Disable preopt for TARGET_BUILD_APPS
51ifneq (,$(TARGET_BUILD_APPS))
52 LOCAL_DEX_PREOPT :=
53endif
54
55# Disable preopt if not WITH_DEXPREOPT
56ifneq (true,$(WITH_DEXPREOPT))
57 LOCAL_DEX_PREOPT :=
58endif
59
Brian Carlstromced4bff2013-11-14 23:44:56 -080060ifdef LOCAL_UNINSTALLABLE_MODULE
Colin Cross0a69bb62018-10-09 16:14:44 -070061 LOCAL_DEX_PREOPT :=
Brian Carlstromced4bff2013-11-14 23:44:56 -080062endif
Colin Cross0a69bb62018-10-09 16:14:44 -070063
Colin Crossf229de42017-10-05 16:01:00 -070064ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) # contains no java code
Colin Cross0a69bb62018-10-09 16:14:44 -070065 LOCAL_DEX_PREOPT :=
Brian Carlstromced4bff2013-11-14 23:44:56 -080066endif
Colin Cross0a69bb62018-10-09 16:14:44 -070067
Mathieu Chartier418258c2017-08-28 14:19:35 -070068# if WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true and module is not in boot class path skip
69# Also preopt system server jars since selinux prevents system server from loading anything from
70# /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 -070071# or performance. If my_preopt_for_extracted_apk is true, we ignore the only preopt boot image
72# options.
73ifneq (true,$(my_preopt_for_extracted_apk))
Colin Cross0a69bb62018-10-09 16:14:44 -070074 ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
75 ifeq ($(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)
76 LOCAL_DEX_PREOPT :=
77 endif
78 endif
Mathieu Chartier0fbb8362017-09-15 13:40:48 -070079endif
80
Alex Light4e358ab2016-06-16 14:47:10 -070081ifeq ($(LOCAL_DEX_PREOPT),true)
Colin Cross0a69bb62018-10-09 16:14:44 -070082 # Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
83 ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
84 LOCAL_DEX_PREOPT := nostripping
85 endif # LOCAL_UNCOMPRESS_DEX
Nicolas Geoffray3972a472018-01-09 11:46:30 +000086
Colin Cross0a69bb62018-10-09 16:14:44 -070087 # system_other isn't there for an OTA, so don't strip
88 # if module is on system, and odex is on system_other.
89 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
90 ifneq ($(call install-on-system-other, $(my_module_path)),)
91 LOCAL_DEX_PREOPT := nostripping
92 endif # install-on-system-other
93 endif # BOARD_USES_SYSTEM_OTHER_ODEX
Nicolas Geoffray3972a472018-01-09 11:46:30 +000094
Colin Cross0a69bb62018-10-09 16:14:44 -070095 # We also don't strip if all dexs are uncompressed (dexopt will not store the dex code),
96 # but that requires to inspect the source file, which is too early at this point (as we
97 # don't know if the source file will actually be used).
98 # See dexpreopt-remove-classes.dex.
Nicolas Geoffray3972a472018-01-09 11:46:30 +000099endif # LOCAL_DEX_PREOPT
Brian Carlstromced4bff2013-11-14 23:44:56 -0800100
101built_odex :=
David Brazdil70470162016-08-25 13:50:15 +0100102built_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800103built_art :=
Brian Carlstromced4bff2013-11-14 23:44:56 -0800104installed_odex :=
David Brazdil70470162016-08-25 13:50:15 +0100105installed_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800106installed_art :=
Ying Wang74c98502014-05-19 13:03:36 -0700107built_installed_odex :=
David Brazdil70470162016-08-25 13:50:15 +0100108built_installed_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800109built_installed_art :=
Calin Juravlef99ab752018-04-19 20:32:57 -0700110my_process_profile :=
111my_profile_is_text_listing :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800112
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700113ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
Colin Cross0a69bb62018-10-09 16:14:44 -0700114 LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700115endif
116
117ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
Colin Cross0a69bb62018-10-09 16:14:44 -0700118 # If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
119 # profile class listing. TODO: Use product specific directory here.
120 my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
121 LOCAL_DEX_PREOPT_PROFILE := $(my_classes_directory)/$(LOCAL_MODULE).prof
Calin Juravle7d701352018-04-25 15:25:46 -0700122
Colin Cross0a69bb62018-10-09 16:14:44 -0700123 ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE)))
124 my_process_profile := true
125 my_profile_is_text_listing := false
126 endif
Calin Juravlef99ab752018-04-19 20:32:57 -0700127else
Colin Cross0a69bb62018-10-09 16:14:44 -0700128 my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE)
129 my_profile_is_text_listing := true
130 LOCAL_DEX_PREOPT_PROFILE := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700131endif
Mathieu Chartier48762292017-09-13 22:08:45 -0700132
Calin Juravlef99ab752018-04-19 20:32:57 -0700133ifeq (true,$(my_process_profile))
Mathieu Chartier48762292017-09-13 22:08:45 -0700134
Colin Cross0a69bb62018-10-09 16:14:44 -0700135 ifeq (,$(LOCAL_DEX_PREOPT_APP_IMAGE))
136 LOCAL_DEX_PREOPT_APP_IMAGE := true
137 endif
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700138
Colin Cross0a69bb62018-10-09 16:14:44 -0700139 ifndef LOCAL_DEX_PREOPT_PROFILE
140 $(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE))
141 endif
142 ifeq (,$(dex_preopt_profile_src_file))
143 $(call pretty-error, Internal error: dex_preopt_profile_src_file must be set)
144 endif
145 my_built_profile := $(dir $(LOCAL_BUILT_MODULE))/profile.prof
146 my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
147 # Remove compressed APK extension.
148 my_dex_location := $(patsubst %.gz,%,$(my_dex_location))
149 $(my_built_profile): PRIVATE_BUILT_MODULE := $(dex_preopt_profile_src_file)
150 $(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
151 $(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE)
152 $(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE)
153 $(my_built_profile): $(PROFMAN)
154 $(my_built_profile): $(dex_preopt_profile_src_file)
155 ifeq (true,$(my_profile_is_text_listing))
156 # The profile is a test listing of classes (used for framework jars).
157 # We need to generate the actual binary profile before being able to compile.
158 $(my_built_profile):
Mathieu Chartier48762292017-09-13 22:08:45 -0700159 $(hide) mkdir -p $(dir $@)
160 ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
161 --create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
162 --apk=$(PRIVATE_BUILT_MODULE) \
163 --dex-location=$(PRIVATE_DEX_LOCATION) \
164 --reference-profile-file=$@
Colin Cross0a69bb62018-10-09 16:14:44 -0700165 else
166 # The profile is binary profile (used for apps). Run it through profman to
167 # ensure the profile keys match the apk.
168 $(my_built_profile):
Calin Juravlef99ab752018-04-19 20:32:57 -0700169 $(hide) mkdir -p $(dir $@)
170 touch $@
171 ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
172 --copy-and-update-profile-key \
173 --profile-file=$(PRIVATE_SOURCE_CLASSES) \
174 --apk=$(PRIVATE_BUILT_MODULE) \
Calin Juravle60216612018-04-26 18:52:45 -0700175 --dex-location=$(PRIVATE_DEX_LOCATION) \
Calin Juravlef99ab752018-04-19 20:32:57 -0700176 --reference-profile-file=$@ \
177 || echo "Profile out of date for $(PRIVATE_BUILT_MODULE)"
Colin Cross0a69bb62018-10-09 16:14:44 -0700178 endif
Calin Juravlef99ab752018-04-19 20:32:57 -0700179
Colin Cross0a69bb62018-10-09 16:14:44 -0700180 my_profile_is_text_listing :=
181 dex_preopt_profile_src_file :=
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800182
Colin Cross0a69bb62018-10-09 16:14:44 -0700183 # Remove compressed APK extension.
184 my_installed_profile := $(patsubst %.gz,%,$(LOCAL_INSTALLED_MODULE)).prof
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800185
Colin Cross0a69bb62018-10-09 16:14:44 -0700186 # my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
187 $(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
188 build_installed_profile:=$(my_built_profile):$(my_installed_profile)
Mathieu Chartier48762292017-09-13 22:08:45 -0700189else
Colin Cross0a69bb62018-10-09 16:14:44 -0700190 build_installed_profile:=
191 my_installed_profile :=
Mathieu Chartier48762292017-09-13 22:08:45 -0700192endif
193
194ifdef LOCAL_DEX_PREOPT
195
Colin Cross0a69bb62018-10-09 16:14:44 -0700196 dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
Mathieu Chartier502892a2018-07-06 13:29:43 -0700197
Colin Cross0a69bb62018-10-09 16:14:44 -0700198 ifdef dexpreopt_boot_jar_module
199 # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
200 # We use this installed_odex trick to get boot.art installed.
201 installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
202 # Append the odex for the 2nd arch if we have one.
203 installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
204 else # boot jar
205 ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
Mathieu Chartier502892a2018-07-06 13:29:43 -0700206
Colin Cross0a69bb62018-10-09 16:14:44 -0700207 my_module_multilib := $(LOCAL_MULTILIB)
208 # If the module is not an SDK library and it's a system server jar, only preopt the primary arch.
209 my_filtered_lib_name := $(patsubst %.impl,%,$(LOCAL_MODULE))
210 ifeq (,$(filter $(JAVA_SDK_LIBRARIES),$(my_filtered_lib_name)))
211 # For a Java library, by default we build odex for both 1st arch and 2nd arch.
212 # But it can be overridden with "LOCAL_MULTILIB := first".
213 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
214 # For system server jars, we build for only "first".
215 my_module_multilib := first
216 endif
217 endif
Mathieu Chartierfd5dfb82018-07-12 18:17:54 -0700218
Colin Cross0a69bb62018-10-09 16:14:44 -0700219 # Only preopt primary arch for translated arch since there is only an image there.
220 ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
221 my_module_multilib := first
222 endif
Brian Carlstromced4bff2013-11-14 23:44:56 -0800223
Colin Cross0a69bb62018-10-09 16:14:44 -0700224 # #################################################
225 # Odex for the 1st arch
226 my_2nd_arch_prefix :=
227 include $(BUILD_SYSTEM)/setup_one_odex.mk
228 # #################################################
229 # Odex for the 2nd arch
230 ifdef TARGET_2ND_ARCH
231 ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
232 ifneq (first,$(my_module_multilib))
233 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
234 include $(BUILD_SYSTEM)/setup_one_odex.mk
235 endif # my_module_multilib is not first.
236 endif # TARGET_TRANSLATE_2ND_ARCH not true
237 endif # TARGET_2ND_ARCH
238 # #################################################
239 else # must be APPS
240 # The preferred arch
241 my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
242 # Save the module multilib since setup_one_odex modifies it.
243 saved_my_module_multilib := $(my_module_multilib)
244 include $(BUILD_SYSTEM)/setup_one_odex.mk
245 my_module_multilib := $(saved_my_module_multilib)
246 ifdef TARGET_2ND_ARCH
247 ifeq ($(my_module_multilib),both)
248 # The non-preferred arch
249 my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
250 include $(BUILD_SYSTEM)/setup_one_odex.mk
251 endif # LOCAL_MULTILIB is both
252 endif # TARGET_2ND_ARCH
253 endif # LOCAL_MODULE_CLASS
254 endif # boot jar
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800255
Colin Cross0a69bb62018-10-09 16:14:44 -0700256 built_odex := $(strip $(built_odex))
257 built_vdex := $(strip $(built_vdex))
258 built_art := $(strip $(built_art))
259 installed_odex := $(strip $(installed_odex))
260 installed_vdex := $(strip $(installed_vdex))
261 installed_art := $(strip $(installed_art))
Mathieu Chartier2ac264f2017-03-03 11:17:36 -0800262
Colin Cross0a69bb62018-10-09 16:14:44 -0700263 ifdef built_odex
264 ifeq (true,$(my_process_profile))
265 $(built_odex): $(my_built_profile)
266 $(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700267 else
Colin Cross0a69bb62018-10-09 16:14:44 -0700268 $(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
269 endif
270
271 ifndef LOCAL_DEX_PREOPT_FLAGS
272 LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
273 ifndef LOCAL_DEX_PREOPT_FLAGS
274 LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
Mathieu Chartier6a902102017-06-23 10:44:45 -0700275 endif
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700276 endif
Nicolas Geoffrayb08ada12017-03-22 12:36:05 +0000277
Colin Cross0a69bb62018-10-09 16:14:44 -0700278 my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
279 ifeq (,$(my_system_server_compiler_filter))
280 my_system_server_compiler_filter := speed
281 endif
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800282
Colin Cross0a69bb62018-10-09 16:14:44 -0700283 my_default_compiler_filter := $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER)
284 ifeq (,$(my_default_compiler_filter))
285 # If no default compiler filter is specified, default to 'quicken' to save on storage.
286 my_default_compiler_filter := quicken
287 endif
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800288
Colin Cross0a69bb62018-10-09 16:14:44 -0700289 ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
290 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
291 # Jars of system server, use the product option if it is set, speed otherwise.
292 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter)
293 else
294 ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
295 # Apps loaded into system server, and apps the product default to being compiled with the
296 # 'speed' compiler filter.
297 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
298 else
299 ifeq (true,$(my_process_profile))
300 # For non system server jars, use speed-profile when we have a profile.
301 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
302 else
303 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_default_compiler_filter)
304 endif
305 endif
306 endif
307 endif
308
309 my_generate_dm := $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)
310 ifeq (,$(filter $(LOCAL_DEX_PREOPT_FLAGS),--compiler-filter=verify))
311 # Generating DM files only makes sense for verify, avoid doing for non verify compiler filter APKs.
312 my_generate_dm := false
313 endif
314
315 # No reason to use a dm file if the dex is already uncompressed.
316 ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
317 my_generate_dm := false
318 endif
319
320 ifeq (true,$(my_generate_dm))
321 LOCAL_DEX_PREOPT_FLAGS += --copy-dex-files=false
322 LOCAL_DEX_PREOPT := nostripping
323 my_built_dm := $(dir $(LOCAL_BUILT_MODULE))generated.dm
324 my_installed_dm := $(patsubst %.apk,%,$(LOCAL_INSTALLED_MODULE)).dm
325 my_copied_vdex := $(dir $(LOCAL_BUILT_MODULE))primary.vdex
326 $(eval $(call copy-one-file,$(built_vdex),$(my_copied_vdex)))
327 $(my_built_dm): PRIVATE_INPUT_VDEX := $(my_copied_vdex)
328 $(my_built_dm): $(my_copied_vdex) $(ZIPTIME)
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800329 $(hide) mkdir -p $(dir $@)
330 $(hide) rm -f $@
331 $(hide) zip -qD -j -X -9 $@ $(PRIVATE_INPUT_VDEX)
332 $(ZIPTIME) $@
Colin Cross0a69bb62018-10-09 16:14:44 -0700333 $(eval $(call copy-one-file,$(my_built_dm),$(my_installed_dm)))
334 endif
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800335
Colin Cross0a69bb62018-10-09 16:14:44 -0700336 # By default, emit debug info.
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700337 my_dexpreopt_debug_info := true
Colin Cross0a69bb62018-10-09 16:14:44 -0700338 # If the global setting suppresses mini-debug-info, disable it.
339 ifeq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
340 my_dexpreopt_debug_info := false
341 endif
342
343 # PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
344 # PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
345 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
346 ifeq (true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
347 my_dexpreopt_debug_info := true
348 else ifeq (false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
349 my_dexpreopt_debug_info := false
350 endif
351 else
352 ifeq (true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
353 my_dexpreopt_debug_info := true
354 else ifeq (false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
355 my_dexpreopt_debug_info := false
356 endif
357 endif
358
359 # Never enable on eng.
360 ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
361 my_dexpreopt_debug_info := false
362 endif
363
364 # Add dex2oat flag for debug-info/no-debug-info.
365 ifeq (true,$(my_dexpreopt_debug_info))
366 LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
367 else ifeq (false,$(my_dexpreopt_debug_info))
368 LOCAL_DEX_PREOPT_FLAGS += --no-generate-mini-debug-info
369 endif
370
371 # Set the compiler reason to 'prebuilt' to identify the oat files produced
372 # during the build, as opposed to compiled on the device.
373 LOCAL_DEX_PREOPT_FLAGS += --compilation-reason=prebuilt
374
375 $(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
376 $(built_vdex): $(built_odex)
377 $(built_art): $(built_odex)
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700378 endif
Colin Cross0a69bb62018-10-09 16:14:44 -0700379
380 ifneq (true,$(my_generate_dm))
381 # Add the installed_odex to the list of installed files for this module if we aren't generating a
382 # dm file.
383 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
384 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
385 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
386
387 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
388 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
389 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
390
391 # Make sure to install the .odex and .vdex when you run "make <module_name>"
392 $(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
393 else
394 ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_dm)
395 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_dm) $(my_installed_dm)
396
397 # Make sure to install the .dm when you run "make <module_name>"
398 $(my_all_targets): $(installed_dm)
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700399 endif
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700400
Colin Cross0a69bb62018-10-09 16:14:44 -0700401 # Record dex-preopt config.
402 DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
403 DEXPREOPT.$(LOCAL_MODULE).MULTILIB := $(LOCAL_MULTILIB)
404 DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
405 DEXPREOPT.$(LOCAL_MODULE).PRIVILEGED_MODULE := $(LOCAL_PRIVILEGED_MODULE)
406 DEXPREOPT.$(LOCAL_MODULE).VENDOR_MODULE := $(LOCAL_VENDOR_MODULE)
407 DEXPREOPT.$(LOCAL_MODULE).TARGET_ARCH := $(LOCAL_MODULE_TARGET_ARCH)
408 DEXPREOPT.$(LOCAL_MODULE).INSTALLED := $(installed_odex)
409 DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE)
410 DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
411 $(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE))
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800412
Brian Carlstromced4bff2013-11-14 23:44:56 -0800413endif # LOCAL_DEX_PREOPT
Mathieu Chartier48762292017-09-13 22:08:45 -0700414
415# Profile doesn't depend on LOCAL_DEX_PREOPT.
416ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
417ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
418
Calin Juravle7d701352018-04-25 15:25:46 -0700419my_process_profile :=
420
Mathieu Chartier48762292017-09-13 22:08:45 -0700421$(my_all_targets): $(my_installed_profile)