blob: faaa5ad7ca6e03d738910e33092a1f0b6ec92a08 [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))
10ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
11 LOCAL_UNCOMPRESS_DEX := true
12else
13 ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
14 LOCAL_UNCOMPRESS_DEX := true
15 endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
16endif # LOCAL_PRIVILEGED_MODULE
17endif # 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))
21ifneq (true,$(WITH_DEXPREOPT))
22 LOCAL_DEX_PREOPT :=
23else # WITH_DEXPREOPT=true
24 ifeq (,$(TARGET_BUILD_APPS)) # TARGET_BUILD_APPS empty
Ying Wang9db168c2014-01-03 16:24:56 -080025 ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
Ying Wangedfd55a2014-07-09 10:57:32 -070026 ifneq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Installed to system.img.
27 ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty
Ying Wang20ebd2e2014-10-07 18:07:23 -070028 # If we have product-specific config for this module?
29 ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
30 LOCAL_DEX_PREOPT := false
31 else
32 LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
33 endif
Ying Wangedfd55a2014-07-09 10:57:32 -070034 else # LOCAL_APK_LIBRARIES not empty
35 LOCAL_DEX_PREOPT := nostripping
36 endif # LOCAL_APK_LIBRARIES not empty
37 endif # Installed to system.img.
Ying Wang9db168c2014-01-03 16:24:56 -080038 endif # LOCAL_DEX_PREOPT undefined
Brian Carlstromced4bff2013-11-14 23:44:56 -080039 endif # TARGET_BUILD_APPS empty
40endif # WITH_DEXPREOPT=true
41ifeq (false,$(LOCAL_DEX_PREOPT))
42 LOCAL_DEX_PREOPT :=
43endif
44ifdef LOCAL_UNINSTALLABLE_MODULE
45LOCAL_DEX_PREOPT :=
46endif
Colin Crossf229de42017-10-05 16:01:00 -070047ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) # contains no java code
Brian Carlstromced4bff2013-11-14 23:44:56 -080048LOCAL_DEX_PREOPT :=
49endif
Mathieu Chartier418258c2017-08-28 14:19:35 -070050# if WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true and module is not in boot class path skip
51# Also preopt system server jars since selinux prevents system server from loading anything from
52# /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 -070053# or performance. If my_preopt_for_extracted_apk is true, we ignore the only preopt boot image
54# options.
55ifneq (true,$(my_preopt_for_extracted_apk))
Mathieu Chartier418258c2017-08-28 14:19:35 -070056ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
57ifeq ($(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)
Alex Light7326f7b2014-08-04 17:09:41 -070058LOCAL_DEX_PREOPT :=
59endif
60endif
Mathieu Chartier0fbb8362017-09-15 13:40:48 -070061endif
62
Alex Light4e358ab2016-06-16 14:47:10 -070063ifeq ($(LOCAL_DEX_PREOPT),true)
Nicolas Geoffray3972a472018-01-09 11:46:30 +000064
65# Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
66ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
67LOCAL_DEX_PREOPT := nostripping
68endif # LOCAL_UNCOMPRESS_DEX
69
70# system_other isn't there for an OTA, so don't strip
71# if module is on system, and odex is on system_other.
72ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
Nicolas Geoffraycdd43432017-03-24 14:45:59 +000073ifneq ($(call install-on-system-other, $(my_module_path)),)
Alex Light4e358ab2016-06-16 14:47:10 -070074LOCAL_DEX_PREOPT := nostripping
Nicolas Geoffray3972a472018-01-09 11:46:30 +000075endif # install-on-system-other
76endif # BOARD_USES_SYSTEM_OTHER_ODEX
77
78# We also don't strip if all dexs are uncompressed (dexopt will not store the dex code),
79# but that requires to inspect the source file, which is too early at this point (as we
80# don't know if the source file will actually be used).
81# See dexpreopt-remove-classes.dex.
82
83endif # LOCAL_DEX_PREOPT
Brian Carlstromced4bff2013-11-14 23:44:56 -080084
85built_odex :=
David Brazdil70470162016-08-25 13:50:15 +010086built_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -080087built_art :=
Brian Carlstromced4bff2013-11-14 23:44:56 -080088installed_odex :=
David Brazdil70470162016-08-25 13:50:15 +010089installed_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -080090installed_art :=
Ying Wang74c98502014-05-19 13:03:36 -070091built_installed_odex :=
David Brazdil70470162016-08-25 13:50:15 +010092built_installed_vdex :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -080093built_installed_art :=
Calin Juravlef99ab752018-04-19 20:32:57 -070094my_process_profile :=
95my_profile_is_text_listing :=
Mathieu Chartier192b91c2017-02-08 18:30:31 -080096
Mathieu Chartier6324c2d2017-05-05 17:22:37 -070097ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
98LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
99endif
100
101ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
Calin Juravle7d701352018-04-25 15:25:46 -0700102
103
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700104# If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
105# profile class listing. TODO: Use product specific directory here.
106my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
Calin Juravlef99ab752018-04-19 20:32:57 -0700107LOCAL_DEX_PREOPT_PROFILE := $(my_classes_directory)/$(LOCAL_MODULE).prof
Calin Juravle7d701352018-04-25 15:25:46 -0700108
Calin Juravlef99ab752018-04-19 20:32:57 -0700109ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE)))
110my_process_profile := true
111my_profile_is_text_listing := false
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700112endif
Calin Juravlef99ab752018-04-19 20:32:57 -0700113else
114my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE)
115my_profile_is_text_listing := true
116LOCAL_DEX_PREOPT_PROFILE := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700117endif
Mathieu Chartier48762292017-09-13 22:08:45 -0700118
Calin Juravlef99ab752018-04-19 20:32:57 -0700119ifeq (true,$(my_process_profile))
Mathieu Chartier48762292017-09-13 22:08:45 -0700120
121ifdef LOCAL_VENDOR_MODULE
122$(call pretty-error, Internal error: profiles are not supported for vendor modules)
123else
124LOCAL_DEX_PREOPT_APP_IMAGE := true
Mathieu Chartier44c9c072017-05-09 19:17:33 -0700125endif
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700126
Calin Juravlef99ab752018-04-19 20:32:57 -0700127ifndef LOCAL_DEX_PREOPT_PROFILE
128$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE))
Mathieu Chartier48762292017-09-13 22:08:45 -0700129endif
130ifeq (,$(dex_preopt_profile_src_file))
131$(call pretty-error, Internal error: dex_preopt_profile_src_file must be set)
132endif
133my_built_profile := $(dir $(LOCAL_BUILT_MODULE))/profile.prof
134my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
135# Remove compressed APK extension.
136my_dex_location := $(patsubst %.gz,%,$(my_dex_location))
137$(my_built_profile): PRIVATE_BUILT_MODULE := $(dex_preopt_profile_src_file)
138$(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
Calin Juravlef99ab752018-04-19 20:32:57 -0700139$(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE)
140$(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE)
Mathieu Chartier48762292017-09-13 22:08:45 -0700141$(my_built_profile): $(PROFMAN)
142$(my_built_profile): $(dex_preopt_profile_src_file)
Calin Juravlef99ab752018-04-19 20:32:57 -0700143ifeq (true,$(my_profile_is_text_listing))
144# The profile is a test listing of classes (used for framework jars).
145# We need to generate the actual binary profile before being able to compile.
Mathieu Chartier48762292017-09-13 22:08:45 -0700146 $(hide) mkdir -p $(dir $@)
147 ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
148 --create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
149 --apk=$(PRIVATE_BUILT_MODULE) \
150 --dex-location=$(PRIVATE_DEX_LOCATION) \
151 --reference-profile-file=$@
Calin Juravlef99ab752018-04-19 20:32:57 -0700152else
153# The profile is binary profile (used for apps). Run it through profman to
154# ensure the profile keys match the apk.
155$(my_built_profile):
156 $(hide) mkdir -p $(dir $@)
157 touch $@
158 ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
159 --copy-and-update-profile-key \
160 --profile-file=$(PRIVATE_SOURCE_CLASSES) \
161 --apk=$(PRIVATE_BUILT_MODULE) \
162 --reference-profile-file=$@ \
163 || echo "Profile out of date for $(PRIVATE_BUILT_MODULE)"
164endif
165
Calin Juravlef99ab752018-04-19 20:32:57 -0700166my_profile_is_text_listing :=
167dex_preopt_profile_src_file :=
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800168
169# Remove compressed APK extension.
Mathieu Chartier48762292017-09-13 22:08:45 -0700170my_installed_profile := $(patsubst %.gz,%,$(LOCAL_INSTALLED_MODULE)).prof
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800171
Mathieu Chartier48762292017-09-13 22:08:45 -0700172# my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
173$(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
174build_installed_profile:=$(my_built_profile):$(my_installed_profile)
175else
176build_installed_profile:=
177my_installed_profile :=
178endif
179
180ifdef LOCAL_DEX_PREOPT
181
Brian Carlstromced4bff2013-11-14 23:44:56 -0800182dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
Andreas Gampe039bb482018-01-19 10:56:23 -0800183
184# Filter org.apache.http.legacy.boot.
185ifeq ($(dexpreopt_boot_jar_module),org.apache.http.legacy.boot)
186dexpreopt_boot_jar_module :=
187endif
188
Brian Carlstromced4bff2013-11-14 23:44:56 -0800189ifdef dexpreopt_boot_jar_module
Brian Carlstromced4bff2013-11-14 23:44:56 -0800190# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
191# We use this installed_odex trick to get boot.art installed.
192installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
Ying Wangb9aa5d42014-05-13 13:57:28 -0700193# Append the odex for the 2nd arch if we have one.
194installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
Brian Carlstromced4bff2013-11-14 23:44:56 -0800195else # boot jar
Ying Wangb9aa5d42014-05-13 13:57:28 -0700196ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
Ying Wangc7ca6172015-03-09 17:17:51 -0700197# For a Java library, by default we build odex for both 1st arch and 2nd arch.
198# But it can be overridden with "LOCAL_MULTILIB := first".
199ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
200# For system server jars, we build for only "first".
201my_module_multilib := first
202else
203my_module_multilib := $(LOCAL_MULTILIB)
204endif
Ying Wangb9aa5d42014-05-13 13:57:28 -0700205# #################################################
206# Odex for the 1st arch
Ying Wangdb48da72014-09-13 11:26:39 -0700207my_2nd_arch_prefix :=
208include $(BUILD_SYSTEM)/setup_one_odex.mk
Ying Wangb9aa5d42014-05-13 13:57:28 -0700209# #################################################
210# Odex for the 2nd arch
211ifdef TARGET_2ND_ARCH
Ying Wang62630222016-04-20 11:53:39 -0700212ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
Ying Wangc7ca6172015-03-09 17:17:51 -0700213ifneq (first,$(my_module_multilib))
Ying Wangdb48da72014-09-13 11:26:39 -0700214my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
215include $(BUILD_SYSTEM)/setup_one_odex.mk
Ying Wangc7ca6172015-03-09 17:17:51 -0700216endif # my_module_multilib is not first.
Ying Wang62630222016-04-20 11:53:39 -0700217endif # TARGET_TRANSLATE_2ND_ARCH not true
Ying Wangb9aa5d42014-05-13 13:57:28 -0700218endif # TARGET_2ND_ARCH
219# #################################################
220else # must be APPS
Ying Wangdb48da72014-09-13 11:26:39 -0700221# The preferred arch
222my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
223include $(BUILD_SYSTEM)/setup_one_odex.mk
Ying Wang7a899192014-09-15 11:45:52 -0700224ifdef TARGET_2ND_ARCH
Ying Wangdb48da72014-09-13 11:26:39 -0700225ifeq ($(LOCAL_MULTILIB),both)
226# The non-preferred arch
227my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
228include $(BUILD_SYSTEM)/setup_one_odex.mk
229endif # LOCAL_MULTILIB is both
Ying Wang7a899192014-09-15 11:45:52 -0700230endif # TARGET_2ND_ARCH
Ying Wangb9aa5d42014-05-13 13:57:28 -0700231endif # LOCAL_MODULE_CLASS
Ying Wang7a899192014-09-15 11:45:52 -0700232endif # boot jar
Brian Carlstromced4bff2013-11-14 23:44:56 -0800233
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800234built_odex := $(strip $(built_odex))
David Brazdil70470162016-08-25 13:50:15 +0100235built_vdex := $(strip $(built_vdex))
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800236built_art := $(strip $(built_art))
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800237installed_odex := $(strip $(installed_odex))
David Brazdil70470162016-08-25 13:50:15 +0100238installed_vdex := $(strip $(installed_vdex))
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800239installed_art := $(strip $(installed_art))
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800240
Brian Carlstromced4bff2013-11-14 23:44:56 -0800241ifdef built_odex
Calin Juravle7d701352018-04-25 15:25:46 -0700242ifeq (true,$(my_process_profile))
Mathieu Chartier2ac264f2017-03-03 11:17:36 -0800243$(built_odex): $(my_built_profile)
244$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
Mathieu Chartier2ac264f2017-03-03 11:17:36 -0800245else
246$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
247endif
248
Ying Wang20ebd2e2014-10-07 18:07:23 -0700249ifndef LOCAL_DEX_PREOPT_FLAGS
250LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
251ifndef LOCAL_DEX_PREOPT_FLAGS
252LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
253endif
254endif
Nicolas Geoffrayb08ada12017-03-22 12:36:05 +0000255
Mathieu Chartier6a902102017-06-23 10:44:45 -0700256my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
257ifeq (,$(my_system_server_compiler_filter))
258my_system_server_compiler_filter := speed
259endif
260
Mathieu Chartiere8fb7cf2018-02-15 13:19:38 -0800261my_default_compiler_filter := $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER)
262ifeq (,$(my_default_compiler_filter))
263# If no default compiler filter is specified, default to 'quicken' to save on storage.
264my_default_compiler_filter := quicken
265endif
266
Mathieu Chartierb8d3cc02017-06-16 11:17:53 -0700267ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
Mathieu Chartier6a902102017-06-23 10:44:45 -0700268 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
269 # Jars of system server, use the product option if it is set, speed otherwise.
270 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter)
Mathieu Chartierb8d3cc02017-06-16 11:17:53 -0700271 else
Mathieu Chartier6a902102017-06-23 10:44:45 -0700272 ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
273 # Apps loaded into system server, and apps the product default to being compiled with the
274 # 'speed' compiler filter.
275 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700276 else
Calin Juravle7d701352018-04-25 15:25:46 -0700277 ifeq (true,$(my_process_profile))
Mathieu Chartier6a902102017-06-23 10:44:45 -0700278 # For non system server jars, use speed-profile when we have a profile.
279 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
280 else
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800281 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_default_compiler_filter)
Mathieu Chartier6a902102017-06-23 10:44:45 -0700282 endif
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700283 endif
Nicolas Geoffray24f54692017-03-30 13:50:12 +0100284 endif
Nicolas Geoffrayb08ada12017-03-22 12:36:05 +0000285endif
286
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800287my_generate_dm := $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)
288ifeq (,$(filter $(LOCAL_DEX_PREOPT_FLAGS),--compiler-filter=verify))
289# Generating DM files only makes sense for verify, avoid doing for non verify compiler filter APKs.
290my_generate_dm := false
291endif
292
293# No reason to use a dm file if the dex is already uncompressed.
294ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
295my_generate_dm := false
296endif
297
298ifeq (true,$(my_generate_dm))
299LOCAL_DEX_PREOPT_FLAGS += --copy-dex-files=false
300LOCAL_DEX_PREOPT := nostripping
301my_built_dm := $(dir $(LOCAL_BUILT_MODULE))generated.dm
302my_installed_dm := $(patsubst %.apk,%,$(LOCAL_INSTALLED_MODULE)).dm
303my_copied_vdex := $(dir $(LOCAL_BUILT_MODULE))primary.vdex
304$(eval $(call copy-one-file,$(built_vdex),$(my_copied_vdex)))
305$(my_built_dm): PRIVATE_INPUT_VDEX := $(my_copied_vdex)
306$(my_built_dm): $(my_copied_vdex) $(ZIPTIME)
307 $(hide) mkdir -p $(dir $@)
308 $(hide) rm -f $@
309 $(hide) zip -qD -j -X -9 $@ $(PRIVATE_INPUT_VDEX)
310 $(ZIPTIME) $@
311$(eval $(call copy-one-file,$(my_built_dm),$(my_installed_dm)))
312endif
313
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700314# By default, emit debug info.
315my_dexpreopt_debug_info := true
316# If the global setting suppresses mini-debug-info, disable it.
317ifeq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
318 my_dexpreopt_debug_info := false
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700319endif
320
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700321# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
322# PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
323ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
324 ifeq (true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
325 my_dexpreopt_debug_info := true
326 else ifeq (false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
327 my_dexpreopt_debug_info := false
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700328 endif
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700329else
330 ifeq (true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
331 my_dexpreopt_debug_info := true
332 else ifeq (false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
333 my_dexpreopt_debug_info := false
334 endif
335endif
336
337# Never enable on eng.
338ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
339my_dexpreopt_debug_info := false
340endif
341
342# Add dex2oat flag for debug-info/no-debug-info.
343ifeq (true,$(my_dexpreopt_debug_info))
344 LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
345else ifeq (false,$(my_dexpreopt_debug_info))
346 LOCAL_DEX_PREOPT_FLAGS += --no-generate-mini-debug-info
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700347endif
348
Calin Juravle55f14922018-02-15 12:51:08 -0800349# Set the compiler reason to 'prebuilt' to identify the oat files produced
350# during the build, as opposed to compiled on the device.
351LOCAL_DEX_PREOPT_FLAGS += --compilation-reason=prebuilt
352
Ying Wang20ebd2e2014-10-07 18:07:23 -0700353$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
David Brazdil70470162016-08-25 13:50:15 +0100354$(built_vdex): $(built_odex)
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800355$(built_art): $(built_odex)
Brian Carlstromced4bff2013-11-14 23:44:56 -0800356endif
357
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800358ifneq (true,$(my_generate_dm))
359 # Add the installed_odex to the list of installed files for this module if we aren't generating a
360 # dm file.
361 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
362 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
363 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
Mathieu Chartier48762292017-09-13 22:08:45 -0700364
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800365 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
366 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
367 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
368
369 # Make sure to install the .odex and .vdex when you run "make <module_name>"
370 $(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
371else
372 ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_dm)
373 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_dm) $(my_installed_dm)
374
375 # Make sure to install the .dm when you run "make <module_name>"
376 $(my_all_targets): $(installed_dm)
377endif
Ying Wang74c98502014-05-19 13:03:36 -0700378
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800379# Record dex-preopt config.
380DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
381DEXPREOPT.$(LOCAL_MODULE).MULTILIB := $(LOCAL_MULTILIB)
382DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
383DEXPREOPT.$(LOCAL_MODULE).PRIVILEGED_MODULE := $(LOCAL_PRIVILEGED_MODULE)
Dan Willemsen05a2b932017-03-20 18:31:17 -0700384DEXPREOPT.$(LOCAL_MODULE).VENDOR_MODULE := $(LOCAL_VENDOR_MODULE)
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800385DEXPREOPT.$(LOCAL_MODULE).TARGET_ARCH := $(LOCAL_MODULE_TARGET_ARCH)
386DEXPREOPT.$(LOCAL_MODULE).INSTALLED := $(installed_odex)
387DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE)
388DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
389 $(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE))
390
Brian Carlstromced4bff2013-11-14 23:44:56 -0800391endif # LOCAL_DEX_PREOPT
Mathieu Chartier48762292017-09-13 22:08:45 -0700392
393# Profile doesn't depend on LOCAL_DEX_PREOPT.
394ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
395ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
396
Calin Juravle7d701352018-04-25 15:25:46 -0700397my_process_profile :=
398
Mathieu Chartier48762292017-09-13 22:08:45 -0700399$(my_all_targets): $(my_installed_profile)