blob: 5bdeb3a1aa2fb86d97d431b190d34458aec58286 [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
102# If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
103# profile class listing. TODO: Use product specific directory here.
104my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
Calin Juravlef99ab752018-04-19 20:32:57 -0700105LOCAL_DEX_PREOPT_PROFILE := $(my_classes_directory)/$(LOCAL_MODULE).prof
106ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE)))
107my_process_profile := true
108my_profile_is_text_listing := false
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700109endif
Calin Juravlef99ab752018-04-19 20:32:57 -0700110else
111my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE)
112my_profile_is_text_listing := true
113LOCAL_DEX_PREOPT_PROFILE := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700114endif
Mathieu Chartier48762292017-09-13 22:08:45 -0700115
Calin Juravlef99ab752018-04-19 20:32:57 -0700116ifeq (true,$(my_process_profile))
Mathieu Chartier48762292017-09-13 22:08:45 -0700117
118ifdef LOCAL_VENDOR_MODULE
119$(call pretty-error, Internal error: profiles are not supported for vendor modules)
120else
121LOCAL_DEX_PREOPT_APP_IMAGE := true
Mathieu Chartier44c9c072017-05-09 19:17:33 -0700122endif
Mathieu Chartier6324c2d2017-05-05 17:22:37 -0700123
Calin Juravlef99ab752018-04-19 20:32:57 -0700124ifndef LOCAL_DEX_PREOPT_PROFILE
125$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE))
Mathieu Chartier48762292017-09-13 22:08:45 -0700126endif
127ifeq (,$(dex_preopt_profile_src_file))
128$(call pretty-error, Internal error: dex_preopt_profile_src_file must be set)
129endif
130my_built_profile := $(dir $(LOCAL_BUILT_MODULE))/profile.prof
131my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
132# Remove compressed APK extension.
133my_dex_location := $(patsubst %.gz,%,$(my_dex_location))
134$(my_built_profile): PRIVATE_BUILT_MODULE := $(dex_preopt_profile_src_file)
135$(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
Calin Juravlef99ab752018-04-19 20:32:57 -0700136$(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE)
137$(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE)
Mathieu Chartier48762292017-09-13 22:08:45 -0700138$(my_built_profile): $(PROFMAN)
139$(my_built_profile): $(dex_preopt_profile_src_file)
Calin Juravlef99ab752018-04-19 20:32:57 -0700140ifeq (true,$(my_profile_is_text_listing))
141# The profile is a test listing of classes (used for framework jars).
142# We need to generate the actual binary profile before being able to compile.
Mathieu Chartier48762292017-09-13 22:08:45 -0700143 $(hide) mkdir -p $(dir $@)
144 ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
145 --create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
146 --apk=$(PRIVATE_BUILT_MODULE) \
147 --dex-location=$(PRIVATE_DEX_LOCATION) \
148 --reference-profile-file=$@
Calin Juravlef99ab752018-04-19 20:32:57 -0700149else
150# The profile is binary profile (used for apps). Run it through profman to
151# ensure the profile keys match the apk.
152$(my_built_profile):
153 $(hide) mkdir -p $(dir $@)
154 touch $@
155 ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
156 --copy-and-update-profile-key \
157 --profile-file=$(PRIVATE_SOURCE_CLASSES) \
158 --apk=$(PRIVATE_BUILT_MODULE) \
159 --reference-profile-file=$@ \
160 || echo "Profile out of date for $(PRIVATE_BUILT_MODULE)"
161endif
162
163my_process_profile :=
164my_profile_is_text_listing :=
165dex_preopt_profile_src_file :=
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800166
167# Remove compressed APK extension.
Mathieu Chartier48762292017-09-13 22:08:45 -0700168my_installed_profile := $(patsubst %.gz,%,$(LOCAL_INSTALLED_MODULE)).prof
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800169
Mathieu Chartier48762292017-09-13 22:08:45 -0700170# my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
171$(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
172build_installed_profile:=$(my_built_profile):$(my_installed_profile)
173else
174build_installed_profile:=
175my_installed_profile :=
176endif
177
178ifdef LOCAL_DEX_PREOPT
179
Brian Carlstromced4bff2013-11-14 23:44:56 -0800180dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
Andreas Gampe039bb482018-01-19 10:56:23 -0800181
182# Filter org.apache.http.legacy.boot.
183ifeq ($(dexpreopt_boot_jar_module),org.apache.http.legacy.boot)
184dexpreopt_boot_jar_module :=
185endif
186
Brian Carlstromced4bff2013-11-14 23:44:56 -0800187ifdef dexpreopt_boot_jar_module
Brian Carlstromced4bff2013-11-14 23:44:56 -0800188# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
189# We use this installed_odex trick to get boot.art installed.
190installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
Ying Wangb9aa5d42014-05-13 13:57:28 -0700191# Append the odex for the 2nd arch if we have one.
192installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
Brian Carlstromced4bff2013-11-14 23:44:56 -0800193else # boot jar
Ying Wangb9aa5d42014-05-13 13:57:28 -0700194ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
Ying Wangc7ca6172015-03-09 17:17:51 -0700195# For a Java library, by default we build odex for both 1st arch and 2nd arch.
196# But it can be overridden with "LOCAL_MULTILIB := first".
197ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
198# For system server jars, we build for only "first".
199my_module_multilib := first
200else
201my_module_multilib := $(LOCAL_MULTILIB)
202endif
Ying Wangb9aa5d42014-05-13 13:57:28 -0700203# #################################################
204# Odex for the 1st arch
Ying Wangdb48da72014-09-13 11:26:39 -0700205my_2nd_arch_prefix :=
206include $(BUILD_SYSTEM)/setup_one_odex.mk
Ying Wangb9aa5d42014-05-13 13:57:28 -0700207# #################################################
208# Odex for the 2nd arch
209ifdef TARGET_2ND_ARCH
Ying Wang62630222016-04-20 11:53:39 -0700210ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
Ying Wangc7ca6172015-03-09 17:17:51 -0700211ifneq (first,$(my_module_multilib))
Ying Wangdb48da72014-09-13 11:26:39 -0700212my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
213include $(BUILD_SYSTEM)/setup_one_odex.mk
Ying Wangc7ca6172015-03-09 17:17:51 -0700214endif # my_module_multilib is not first.
Ying Wang62630222016-04-20 11:53:39 -0700215endif # TARGET_TRANSLATE_2ND_ARCH not true
Ying Wangb9aa5d42014-05-13 13:57:28 -0700216endif # TARGET_2ND_ARCH
217# #################################################
218else # must be APPS
Ying Wangdb48da72014-09-13 11:26:39 -0700219# The preferred arch
220my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
221include $(BUILD_SYSTEM)/setup_one_odex.mk
Ying Wang7a899192014-09-15 11:45:52 -0700222ifdef TARGET_2ND_ARCH
Ying Wangdb48da72014-09-13 11:26:39 -0700223ifeq ($(LOCAL_MULTILIB),both)
224# The non-preferred arch
225my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
226include $(BUILD_SYSTEM)/setup_one_odex.mk
227endif # LOCAL_MULTILIB is both
Ying Wang7a899192014-09-15 11:45:52 -0700228endif # TARGET_2ND_ARCH
Ying Wangb9aa5d42014-05-13 13:57:28 -0700229endif # LOCAL_MODULE_CLASS
Ying Wang7a899192014-09-15 11:45:52 -0700230endif # boot jar
Brian Carlstromced4bff2013-11-14 23:44:56 -0800231
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800232built_odex := $(strip $(built_odex))
David Brazdil70470162016-08-25 13:50:15 +0100233built_vdex := $(strip $(built_vdex))
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800234built_art := $(strip $(built_art))
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800235installed_odex := $(strip $(installed_odex))
David Brazdil70470162016-08-25 13:50:15 +0100236installed_vdex := $(strip $(installed_vdex))
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800237installed_art := $(strip $(installed_art))
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800238
Brian Carlstromced4bff2013-11-14 23:44:56 -0800239ifdef built_odex
Mathieu Chartier2ac264f2017-03-03 11:17:36 -0800240ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
Mathieu Chartier2ac264f2017-03-03 11:17:36 -0800241$(built_odex): $(my_built_profile)
242$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
Mathieu Chartier2ac264f2017-03-03 11:17:36 -0800243else
244$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
245endif
246
Ying Wang20ebd2e2014-10-07 18:07:23 -0700247ifndef LOCAL_DEX_PREOPT_FLAGS
248LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
249ifndef LOCAL_DEX_PREOPT_FLAGS
250LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
251endif
252endif
Nicolas Geoffrayb08ada12017-03-22 12:36:05 +0000253
Mathieu Chartier6a902102017-06-23 10:44:45 -0700254my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
255ifeq (,$(my_system_server_compiler_filter))
256my_system_server_compiler_filter := speed
257endif
258
Mathieu Chartiere8fb7cf2018-02-15 13:19:38 -0800259my_default_compiler_filter := $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER)
260ifeq (,$(my_default_compiler_filter))
261# If no default compiler filter is specified, default to 'quicken' to save on storage.
262my_default_compiler_filter := quicken
263endif
264
Mathieu Chartierb8d3cc02017-06-16 11:17:53 -0700265ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
Mathieu Chartier6a902102017-06-23 10:44:45 -0700266 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
267 # Jars of system server, use the product option if it is set, speed otherwise.
268 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter)
Mathieu Chartierb8d3cc02017-06-16 11:17:53 -0700269 else
Mathieu Chartier6a902102017-06-23 10:44:45 -0700270 ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
271 # Apps loaded into system server, and apps the product default to being compiled with the
272 # 'speed' compiler filter.
273 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700274 else
Mathieu Chartier6a902102017-06-23 10:44:45 -0700275 ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
276 # For non system server jars, use speed-profile when we have a profile.
277 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
278 else
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800279 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_default_compiler_filter)
Mathieu Chartier6a902102017-06-23 10:44:45 -0700280 endif
Mathieu Chartierc5536ff2017-05-05 14:59:06 -0700281 endif
Nicolas Geoffray24f54692017-03-30 13:50:12 +0100282 endif
Nicolas Geoffrayb08ada12017-03-22 12:36:05 +0000283endif
284
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800285my_generate_dm := $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)
286ifeq (,$(filter $(LOCAL_DEX_PREOPT_FLAGS),--compiler-filter=verify))
287# Generating DM files only makes sense for verify, avoid doing for non verify compiler filter APKs.
288my_generate_dm := false
289endif
290
291# No reason to use a dm file if the dex is already uncompressed.
292ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
293my_generate_dm := false
294endif
295
296ifeq (true,$(my_generate_dm))
297LOCAL_DEX_PREOPT_FLAGS += --copy-dex-files=false
298LOCAL_DEX_PREOPT := nostripping
299my_built_dm := $(dir $(LOCAL_BUILT_MODULE))generated.dm
300my_installed_dm := $(patsubst %.apk,%,$(LOCAL_INSTALLED_MODULE)).dm
301my_copied_vdex := $(dir $(LOCAL_BUILT_MODULE))primary.vdex
302$(eval $(call copy-one-file,$(built_vdex),$(my_copied_vdex)))
303$(my_built_dm): PRIVATE_INPUT_VDEX := $(my_copied_vdex)
304$(my_built_dm): $(my_copied_vdex) $(ZIPTIME)
305 $(hide) mkdir -p $(dir $@)
306 $(hide) rm -f $@
307 $(hide) zip -qD -j -X -9 $@ $(PRIVATE_INPUT_VDEX)
308 $(ZIPTIME) $@
309$(eval $(call copy-one-file,$(my_built_dm),$(my_installed_dm)))
310endif
311
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700312# By default, emit debug info.
313my_dexpreopt_debug_info := true
314# If the global setting suppresses mini-debug-info, disable it.
315ifeq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
316 my_dexpreopt_debug_info := false
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700317endif
318
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700319# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
320# PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
321ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
322 ifeq (true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
323 my_dexpreopt_debug_info := true
324 else ifeq (false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
325 my_dexpreopt_debug_info := false
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700326 endif
Andreas Gampecdfe46b2018-03-19 14:28:15 -0700327else
328 ifeq (true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
329 my_dexpreopt_debug_info := true
330 else ifeq (false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
331 my_dexpreopt_debug_info := false
332 endif
333endif
334
335# Never enable on eng.
336ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
337my_dexpreopt_debug_info := false
338endif
339
340# Add dex2oat flag for debug-info/no-debug-info.
341ifeq (true,$(my_dexpreopt_debug_info))
342 LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
343else ifeq (false,$(my_dexpreopt_debug_info))
344 LOCAL_DEX_PREOPT_FLAGS += --no-generate-mini-debug-info
Mathieu Chartier94f5f932017-06-23 14:47:56 -0700345endif
346
Calin Juravle55f14922018-02-15 12:51:08 -0800347# Set the compiler reason to 'prebuilt' to identify the oat files produced
348# during the build, as opposed to compiled on the device.
349LOCAL_DEX_PREOPT_FLAGS += --compilation-reason=prebuilt
350
Ying Wang20ebd2e2014-10-07 18:07:23 -0700351$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
David Brazdil70470162016-08-25 13:50:15 +0100352$(built_vdex): $(built_odex)
Mathieu Chartier192b91c2017-02-08 18:30:31 -0800353$(built_art): $(built_odex)
Brian Carlstromced4bff2013-11-14 23:44:56 -0800354endif
355
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800356ifneq (true,$(my_generate_dm))
357 # Add the installed_odex to the list of installed files for this module if we aren't generating a
358 # dm file.
359 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
360 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
361 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
Mathieu Chartier48762292017-09-13 22:08:45 -0700362
Mathieu Chartier5c658ac2018-02-15 13:19:38 -0800363 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
364 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
365 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
366
367 # Make sure to install the .odex and .vdex when you run "make <module_name>"
368 $(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
369else
370 ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_dm)
371 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_dm) $(my_installed_dm)
372
373 # Make sure to install the .dm when you run "make <module_name>"
374 $(my_all_targets): $(installed_dm)
375endif
Ying Wang74c98502014-05-19 13:03:36 -0700376
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800377# Record dex-preopt config.
378DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
379DEXPREOPT.$(LOCAL_MODULE).MULTILIB := $(LOCAL_MULTILIB)
380DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
381DEXPREOPT.$(LOCAL_MODULE).PRIVILEGED_MODULE := $(LOCAL_PRIVILEGED_MODULE)
Dan Willemsen05a2b932017-03-20 18:31:17 -0700382DEXPREOPT.$(LOCAL_MODULE).VENDOR_MODULE := $(LOCAL_VENDOR_MODULE)
Ying Wangfbc5b9f2016-03-11 10:32:01 -0800383DEXPREOPT.$(LOCAL_MODULE).TARGET_ARCH := $(LOCAL_MODULE_TARGET_ARCH)
384DEXPREOPT.$(LOCAL_MODULE).INSTALLED := $(installed_odex)
385DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE)
386DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
387 $(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE))
388
Brian Carlstromced4bff2013-11-14 23:44:56 -0800389endif # LOCAL_DEX_PREOPT
Mathieu Chartier48762292017-09-13 22:08:45 -0700390
391# Profile doesn't depend on LOCAL_DEX_PREOPT.
392ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
393ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
394
395$(my_all_targets): $(my_installed_profile)