From 96a522037ff7079cbf48625c3cfb5ec49b7e6db6 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Tue, 18 Nov 2014 11:45:10 -0800 Subject: [PATCH] Build: Support for compiled-classes file Allow a compiled-classes file for pre-opting. Bug: 18410571 (cherry picked from commit 4fec0bb265ac8cdbe883b8868abfcb56713db170) Change-Id: I8c69dd0fb8c04aaae0c4f062049cc9cce7d755c7 --- core/dex_preopt_libart.mk | 4 ++++ core/dex_preopt_libart_boot.mk | 8 +++++++- target/product/base.mk | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index ae2c5867b9..62ad170604 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -20,6 +20,10 @@ DEX2OATD_DEPENDENCY += $(DEX2OATD) PRELOADED_CLASSES := $(call word-colon,1,$(firstword \ $(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES)))) +# Use the first compiled-classes file in PRODUCT_COPY_FILES. +COMPILED_CLASSES := $(call word-colon,1,$(firstword \ + $(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES)))) + # Default to debug version to help find bugs. # Set USE_DEX2OAT_DEBUG to false for only building non-debug versions. ifneq ($(USE_DEX2OAT_DEBUG), false) diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk index aa4a1de927..826075fd58 100644 --- a/core/dex_preopt_libart_boot.mk +++ b/core/dex_preopt_libart_boot.mk @@ -37,6 +37,12 @@ ifeq (true,$(WITH_DEXPREOPT_PIC)) PRODUCT_DEX_PREOPT_BOOT_FLAGS += --compile-pic endif +# If we have a compiled-classes file, create a parameter. +COMPILED_CLASSES_FLAGS := +ifneq ($(COMPILED_CLASSES),) + COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES) +endif + # The rule to install boot.art and boot.oat $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) $(call copy-file-to-target) @@ -60,4 +66,4 @@ $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGE --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \ --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \ - $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) + $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(COMPILED_CLASSES_FLAGS) diff --git a/target/product/base.mk b/target/product/base.mk index 6387fdaed9..0d052b52f1 100644 --- a/target/product/base.mk +++ b/target/product/base.mk @@ -118,5 +118,10 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES := $(call add-to-product-copy-files-if-exists,\ frameworks/base/preloaded-classes:system/etc/preloaded-classes) +# Note: it is acceptable to not have a compiled-classes file. In that case, all boot classpath +# classes will be compiled. +PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ + frameworks/base/compiled-classes:system/etc/compiled-classes) + $(call inherit-product, $(SRC_TARGET_DIR)/product/embedded.mk)