diff options
author | Ying Wang <wangying@google.com> | 2014-05-13 13:57:28 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-05-18 22:04:58 -0700 |
commit | b9aa5d43de114cecdf94fabb23d3f61f147b627d (patch) | |
tree | fea4ac45cd534bf3726096381f5b3ac09c1985a8 /core/dex_preopt_libart.mk | |
parent | 3c8089cef8eaf90b11852a5c258eba0ff5e3287e (diff) | |
download | build-b9aa5d43de114cecdf94fabb23d3f61f147b627d.zip build-b9aa5d43de114cecdf94fabb23d3f61f147b627d.tar.gz build-b9aa5d43de114cecdf94fabb23d3f61f147b627d.tar.bz2 |
Multilib support for odex
If the VM is libart and DEXPREOPT is enabled,
- For a Java library and the boot image, we build for both 1st arch and
2nd arch.
- For an app, we build for the multilib arch the module is targeted for.
The odex file will be in <arch_name>/<module_name>.odex inside the same
dir where the jar/apk file gets installed.
Nothing changed if it's built for libdvm.
Bug: 14694978
Change-Id: I45118a83758b41d52d6c9e38f93f0ba2775a6c74
Diffstat (limited to 'core/dex_preopt_libart.mk')
-rw-r--r-- | core/dex_preopt_libart.mk | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 7f3285c..7d8cee0 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -23,20 +23,6 @@ DEX2OATD_DEPENDENCY += $(LIBARTD_COMPILER) PRELOADED_CLASSES := frameworks/base/preloaded-classes -LIBART_BOOT_IMAGE := /$(DEXPREOPT_BOOT_JAR_DIR)/boot-$(DEX2OAT_TARGET_ARCH).art - -DEFAULT_DEX_PREOPT_BUILT_IMAGE := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot-$(DEX2OAT_TARGET_ARCH).art - -DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := -ifneq ($(PRODUCT_DEX_PREOPT_IMAGE_IN_DATA),true) -DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$(LIBART_BOOT_IMAGE) - -# The rule to install boot.art and boot.oat -$(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) | $(ACP) - $(call copy-file-to-target) - $(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@) -endif - # start of image reserved address space LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000 @@ -49,48 +35,50 @@ endif ######################################################################## # The full system boot classpath +# Returns the path to the .odex file +# $(1): the arch name. +# $(2): the full path (including file name) of the corresponding .jar or .apk. +define get-odex-file-path +$(dir $(2))$(1)/$(basename $(notdir $(2))).odex +endef + +# Returns the path to the image file (such as "/system/framework/<arch>/boot.art" +# $(1): the arch name (such as "arm") +# $(2): the image location (such as "/system/framework/boot.art") +define get-image-file-path +$(dir $(2))$(1)/$(notdir $(2)) +endef + # note we use core-libart.jar in place of core.jar for ART. LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(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) -# The .oat with symbols -LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) - -# Use dex2oat debug version for better error reporting -$(DEFAULT_DEX_PREOPT_BUILT_IMAGE): $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OATD_DEPENDENCY) - @echo "target dex2oat: $@ ($?)" - @mkdir -p $(dir $@) - @mkdir -p $(dir $(LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) - $(hide) $(DEX2OATD) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) \ - $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ - $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ - --oat-symbols=$(LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \ - --oat-file=$(patsubst %.art,%.oat,$@) \ - --oat-location=$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) \ - --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ - --instruction-set=$(DEX2OAT_TARGET_ARCH) \ - --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ - --android-root=$(PRODUCT_OUT)/system +my_2nd_arch_prefix := +include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk + +ifdef TARGET_2ND_ARCH +my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) +include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk +my_2nd_arch_prefix := +endif ######################################################################## # For a single jar or APK -# $(1): the boot image to use -# $(2): the input .jar or .apk file -# $(3): the input .jar or .apk target location -# $(4): the output .odex file +# $(1): the input .jar or .apk file +# $(2): the output .odex file define dex2oat-one-file -$(hide) rm -f $(4) -$(hide) mkdir -p $(dir $(4)) +$(hide) rm -f $(2) +$(hide) mkdir -p $(dir $(2)) $(hide) $(DEX2OATD) \ --runtime-arg -Xms64m --runtime-arg -Xmx64m \ - --boot-image=$(1) \ - --dex-file=$(2) \ - --dex-location=$(3) \ - --oat-file=$(4) \ + --boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \ + --dex-file=$(1) \ + --dex-location=$(PRIVATE_DEX_LOCATION) \ + --oat-file=$(2) \ --android-root=$(PRODUCT_OUT)/system \ - --instruction-set=$(DEX2OAT_TARGET_ARCH) \ - --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) + --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ + --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) endef |