diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index 55eeec663..20b40518d 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -18,9 +18,35 @@ endif ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED),$(PRODUCT_OUT)) # Install boot images. Note that there can be multiple. +my_boot_image_arch := TARGET_ARCH +my_boot_image_out := $(PRODUCT_OUT) +my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED) +my_boot_image_root := DEFAULT_DEX_PREOPT_INSTALLED_IMAGE DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := -$(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +ifdef TARGET_2ND_ARCH + my_boot_image_arch := TARGET_2ND_ARCH + my_boot_image_root := 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE + 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := + $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +endif +# Install boot images for testing on host. We exclude framework image as it is not part of art manifest. +my_boot_image_arch := HOST_ARCH +my_boot_image_out := $(HOST_OUT) +my_boot_image_syms := $(HOST_OUT)/symbols +my_boot_image_root := HOST_BOOT_IMAGE +HOST_BOOT_IMAGE := +$(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +ifdef HOST_2ND_ARCH + my_boot_image_arch := HOST_2ND_ARCH + my_boot_image_root := 2ND_HOST_BOOT_IMAGE + 2ND_HOST_BOOT_IMAGE := + $(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) +endif +my_boot_image_arch := +my_boot_image_out := +my_boot_image_syms := +my_boot_image_root := # Build the boot.zip which contains the boot jars and their compilation output # We can do this only if preopt is enabled and if the product uses libart config (which sets the diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 79d5f8cd8..12b29f4ad 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -1,45 +1,42 @@ #################################### # ART boot image installation -# Input variable: +# Input variables: # my_boot_image_name: the boot image to install +# my_boot_image_arch: the architecture to install (e.g. TARGET_ARCH, not expanded) +# my_boot_image_out: the install directory (e.g. $(PRODUCT_OUT)) +# my_boot_image_syms: the symbols director (e.g. $(TARGET_OUT_UNSTRIPPED)) +# my_boot_image_root: make variable used to store installed image path # #################################### -# Install primary arch vdex files into a shared location, and then symlink them to both the primary -# and secondary arch directories. -my_vdex_copy_pairs := $(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_ARCH)) -my_installed := $(foreach v,$(my_vdex_copy_pairs),$(PRODUCT_OUT)$(call word-colon,2,$(v))) +# Install $(1) to $(2) so that it is shared between architectures. +define copy-vdex-file +my_vdex_shared := $$(dir $$(patsubst %/,%,$$(dir $(2))))$$(notdir $(2)) # Remove the arch dir. +ifneq ($(my_boot_image_arch),$(filter $(my_boot_image_arch), TARGET_2ND_ARCH HOST_2ND_ARCH)) +$$(my_vdex_shared): $(1) # Copy $(1) to directory one level up (i.e. with the arch dir removed). + @echo "Install: $$@" + $$(copy-file-to-target) +endif +$(2): $$(my_vdex_shared) # Create symlink at $(2) which points to the actual physical copy. + @echo "Symlink: $$@" + mkdir -p $$(dir $$@) + ln -sfn ../$$(notdir $$@) $$@ +my_vdex_shared := +endef + +# Same as 'copy-many-files' but it uses the vdex-specific helper above. +define copy-vdex-files +$(foreach v,$(1),$(eval $(call copy-vdex-file, $(call word-colon,1,$(v)), $(2)$(call word-colon,2,$(v))))) +$(foreach v,$(1),$(2)$(call word-colon,2,$(v))) +endef + +# Install the boot images compiled by Soong. +# The first file is saved in $(my_boot_image_root) and the rest are added as it's dependencies. +my_suffix := BUILT_INSTALLED_$(my_boot_image_name)_$($(my_boot_image_arch)) +my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_$(my_suffix)),$(my_boot_image_out)) +my_installed += $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_$(my_suffix)),$(my_boot_image_syms)) +my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_$(my_suffix)),$(my_boot_image_out)) +$(my_boot_image_root) += $(firstword $(my_installed)) $(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) - -my_built_vdex_dir := $(dir $(call word-colon,1,$(firstword $(my_vdex_copy_pairs)))) -my_installed_vdex_dir := $(PRODUCT_OUT)$(dir $(call word-colon,2,$(firstword $(my_vdex_copy_pairs)))) - -$(my_installed): $(my_installed_vdex_dir)% : $(my_built_vdex_dir)% - @echo "Install: $@" - @rm -f $@ - $(copy-file-to-target) - mkdir -p $(dir $@)/$(TARGET_ARCH) - ln -sfn ../$(notdir $@) $(dir $@)/$(TARGET_ARCH) -ifdef TARGET_2ND_ARCH - mkdir -p $(dir $@)/$(TARGET_2ND_ARCH) - ln -sfn ../$(notdir $@) $(dir $@)/$(TARGET_2ND_ARCH) -endif - -my_dexpreopt_image_extra_deps := $(firstword $(my_installed)) - -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 -endif - -my_2nd_arch_prefix := - - -my_vdex_copy_pairs := my_installed := -my_built_vdex_dir := -my_installed_vdex_dir := -my_dexpreopt_image_extra_deps := +my_suffix := diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk deleted file mode 100644 index 34b852658..000000000 --- a/core/dex_preopt_libart_boot.mk +++ /dev/null @@ -1,25 +0,0 @@ -# Rules to install a boot image built by dexpreopt_bootjars.go -# Input variables: -# my_boot_image_name: the boot image to install -# my_2nd_arch_prefix: indicates if this is to build for the 2nd arch. -# my_dexpreopt_image_extra_deps: extra dependencies to add on the installed boot.art - -# Install the boot images compiled by Soong -# The first file (generally boot.art) is saved as DEFAULT_DEX_PREOPT_INSTALLED_IMAGE, -# and the rest are added as dependencies of the first. - -my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(PRODUCT_OUT)) -$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) -$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE += $(firstword $(my_installed)) - -# Install the unstripped boot images compiled by Soong into the symbols directory -# The first file (generally boot.art) made a dependency of DEFAULT_DEX_PREOPT_INSTALLED_IMAGE, -# and the rest are added as dependencies of the first. -my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(my_boot_image_name)_$(TARGET_$(my_2nd_arch_prefix)ARCH)),$(TARGET_OUT_UNSTRIPPED)) -$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed)) -$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(firstword $(my_installed)) - -$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(my_dexpreopt_image_extra_deps) - -my_installed := -my_built_installed :=