dex_preopt: differentiate between updatable boot jars and non-updatable boot jars.

bug: 119868597
Test: m
Change-Id: I2f12ed6f37b629effc30e7b0c3310dc32e5ff4c8
This commit is contained in:
Nicolas Geoffray 2019-01-15 11:46:32 +00:00
parent e7f127491a
commit 6ce12f56de
3 changed files with 29 additions and 18 deletions

View File

@ -1,21 +1,24 @@
DEX_PREOPT_CONFIG := $(PRODUCT_OUT)/dexpreopt.config
# list of boot classpath jars for dexpreopt
DEXPREOPT_BOOT_JARS_MODULES := $(strip $(filter-out conscrypt,$(PRODUCT_BOOT_JARS)))
PRODUCT_BOOTCLASSPATH_JARS := $(strip $(DEXPREOPT_BOOT_JARS_MODULES) $(filter conscrypt,$(PRODUCT_BOOT_JARS)))
PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_BOOTCLASSPATH_JARS),/system/framework/$(m).jar))
UPDATABLE_BOOT_MODULES := conscrypt
UPDATABLE_BOOT_JARS := /apex/com.android.conscrypt/javalib/conscrypt.jar
NON_UPDATABLE_BOOT_MODULES := $(filter-out $(UPDATABLE_BOOT_MODULES), $(PRODUCT_BOOT_JARS))
NON_UPDATABLE_BOOT_JARS := $(foreach m,$(NON_UPDATABLE_BOOT_MODULES),/system/framework/$(m).jar)
ALL_BOOT_JARS := $(NON_UPDATABLE_BOOT_JARS) $(UPDATABLE_BOOT_JARS)
ALL_BOOT_MODULES := $(NON_UPDATABLE_BOOT_MODULES) $(UPDATABLE_BOOT_MODULES)
PRODUCT_SYSTEM_SERVER_CLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),/system/framework/$(m).jar))
PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(ALL_BOOT_JARS))
DEXPREOPT_BOOT_JARS_MODULES := $(NON_UPDATABLE_BOOT_MODULES)
DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS := $(NON_UPDATABLE_BOOT_JARS)
DEXPREOPT_BOOTCLASSPATH_DEX_FILES := $(foreach jar,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS),$(PRODUCT_OUT)$(jar))
# Create paths for boot image.
DEXPREOPT_BUILD_DIR := $(OUT_DIR)
DEXPREOPT_PRODUCT_DIR_FULL_PATH := $(PRODUCT_OUT)/dex_bootjars
DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXPREOPT_PRODUCT_DIR_FULL_PATH))
DEXPREOPT_BOOT_JAR_DIR := system/framework
DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS := $(foreach m,$(PRODUCT_BOOTCLASSPATH_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(m).jar)
DEXPREOPT_BOOTCLASSPATH_DEX_FILES := $(foreach jar,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS),$(PRODUCT_OUT)$(jar))
DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art
DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(DEX2OAT_TARGET_ARCH)/boot.art
@ -24,6 +27,8 @@ ifdef TARGET_2ND_ARCH
$(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/boot.art
endif
PRODUCT_SYSTEM_SERVER_CLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),/system/framework/$(m).jar))
# The default value for LOCAL_DEX_PREOPT
DEX_PREOPT_DEFAULT ?= true

View File

@ -7,8 +7,8 @@
# The full system boot classpath
LIBART_TARGET_BOOT_JARS := $(DEXPREOPT_BOOT_JARS_MODULES)
LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
LIBART_TARGET_BOOT_DEX_LOCATIONS := $(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS)
LIBART_TARGET_BOOT_DEX_FILES := $(foreach mod,$(NON_UPDATABLE_BOOT_MODULES),$(call intermediates-dir-for,JAVA_LIBRARIES,$(mod),,COMMON)/javalib.jar)
# dex preopt on the bootclasspath produces multiple files. The first dex file
# is converted into to boot.art (to match the legacy assumption that boot.art

View File

@ -72,17 +72,23 @@ $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
endif
endif # TURBINE_ENABLED != false
ifdef LOCAL_SOONG_DEX_JAR
# Hidden API for boot jars
ifndef LOCAL_IS_HOST_MODULE
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
# Derive greylist from classes.jar.
# We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
# have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
# java.mk.
$(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
$(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
endif
endif
ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
ifndef LOCAL_IS_HOST_MODULE
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
# Derive greylist from classes.jar.
# We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
# have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
# java.mk.
$(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
$(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
ifeq (true,$(WITH_DEXPREOPT))
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
# We use this installed_odex trick to get boot.art installed.