From fcc8d8b26d9ea3a94796aa181d4d4919de259123 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 5 May 2017 17:22:37 -0700 Subject: [PATCH] Default profile usage based on the existence of the profile Currently this only checks vendor/google_data/art_profile, but the plan is to use a per product directory in the near future. (cherry picked from commit 6324c2d29133ccaf8230f663251e1f3305a1d66d) Bug: 38032017 Test: make and make sure the profile was used (calculator). Merged-In: I8de6484dbcac5fc040ad70f97e97d193b317af8c Change-Id: I8de6484dbcac5fc040ad70f97e97d193b317af8c --- core/dex_preopt_odex_install.mk | 26 +++++++++++++++++++------- core/product.mk | 1 + core/product_config.mk | 3 +++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 602ad008a..7340ddc44 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -59,6 +59,25 @@ built_installed_vdex := built_installed_art := ifdef LOCAL_DEX_PREOPT + +ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE)) +LOCAL_DEX_PREOPT_GENERATE_PROFILE := false +endif + +ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE +# If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the +# profile class listing. TODO: Use product specific directory here. +my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR) +LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING := $(my_classes_directory)/$(LOCAL_MODULE).prof.txt +ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING))) +# Profile listing exists, use it to generate the profile. +ifeq ($(LOCAL_DEX_PREOPT_APP_IMAGE),) +LOCAL_DEX_PREOPT_APP_IMAGE := true +endif +LOCAL_DEX_PREOPT_GENERATE_PROFILE := true +endif +endif + dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)) ifdef dexpreopt_boot_jar_module # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE). @@ -113,13 +132,6 @@ installed_vdex := $(strip $(installed_vdex)) installed_art := $(strip $(installed_art)) ifdef built_odex - -ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE -ifeq (true,$(WITH_DEX_PREOPT_GENERATE_PROFILE)) - LOCAL_DEX_PREOPT_GENERATE_PROFILE := true -endif -endif - ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE)) ifndef LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING $(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)) diff --git a/core/product.mk b/core/product.mk index c5ddf817a..070986b06 100644 --- a/core/product.mk +++ b/core/product.mk @@ -123,6 +123,7 @@ _product_var_list := \ PRODUCT_DEX_PREOPT_MODULE_CONFIGS \ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \ PRODUCT_DEX_PREOPT_BOOT_FLAGS \ + PRODUCT_DEX_PREOPT_PROFILE_DIR \ PRODUCT_SANITIZER_MODULE_CONFIGS \ PRODUCT_SYSTEM_BASE_FS_PATH \ PRODUCT_VENDOR_BASE_FS_PATH \ diff --git a/core/product_config.mk b/core/product_config.mk index 36f473ff0..ed8b9a72b 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -380,6 +380,9 @@ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)) PRODUCT_DEX_PREOPT_BOOT_FLAGS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_FLAGS)) +PRODUCT_DEX_PREOPT_PROFILE_DIR := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_PROFILE_DIR)) + # Resolve and setup per-module dex-preopt configs. PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_MODULE_CONFIGS))