diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index 62c3ba3795..af5ff9d686 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -80,15 +80,40 @@ system_server_jars += \ $(foreach m,$(other_system_server_jars),\ $(PRODUCT_OUT)/$(call word-colon,1,$(m))/framework/$(call word-colon,2,$(m)).jar) +# Infix can be 'art' (ART image for testing), 'boot' (primary), or 'mainline' (mainline extension). +# Soong creates a set of variables for Make, one or each boot image. The only reason why the ART +# image is exposed to Make is testing (art gtests) and benchmarking (art golem benchmarks). Install +# rules that use those variables are in dex_preopt_libart.mk. Here for dexpreopt purposes the infix +# is always 'boot' or 'mainline'. +DEXPREOPT_INFIX := $(if $(filter true,$(DEX_PREOPT_WITH_UPDATABLE_BCP)),mainline,boot) + +# The input variables are written by build/soong/java/dexpreopt_bootjars.go. Examples can be found +# at the bottom of build/soong/java/dexpreopt_config_testing.go. +dexpreopt_root_dir := $(dir $(patsubst %/,%,$(dir $(firstword $(bootclasspath_jars))))) +booclasspath_arg := $(subst $(space),:,$(patsubst $(dexpreopt_root_dir)%,%,$(DEXPREOPT_BOOTCLASSPATH_DEX_FILES))) +booclasspath_locations_arg := $(subst $(space),:,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS)) +boot_images := $(subst :,$(space),$(DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICE$(DEXPREOPT_INFIX))) +boot_image_arg := $(subst $(space),:,$(patsubst /%,%,$(boot_images))) + +boot_zip_metadata_txt := $(boot_zip).METADATA.txt +$(boot_zip_metadata_txt): + rm -f $@ + echo "booclasspath = $(booclasspath_arg)" >> $@ + echo "booclasspath-locations = $(booclasspath_locations_arg)" >> $@ + echo "boot-image = $(boot_image_arg)" >> $@ + +$(call dist-for-goals, droidcore, $(boot_zip_metadata_txt)) + $(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars) $(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars) -$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) +$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) $(DEXPREOPT_IMAGE_ZIP_mainline) $(boot_zip_metadata_txt) @echo "Create boot package: $@" rm -f $@ $(SOONG_ZIP) -o $@.tmp \ -C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \ - -C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) - $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) + -C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) \ + -e METADATA.txt -f $(boot_zip_metadata_txt) + $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) $(DEXPREOPT_IMAGE_ZIP_mainline) rm -f $@.tmp $(call dist-for-goals, droidcore, $(boot_zip)) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index d4988750dc..8ebf34e016 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -272,13 +272,7 @@ my_dexpreopt_images := my_dexpreopt_images_deps := my_dexpreopt_image_locations_on_host := my_dexpreopt_image_locations_on_device := -# Infix can be 'art', 'boot', or 'mainline'. Soong creates a set of variables -# for Make, one or each boot image (primary, the framework extension, and the -# mainline extension). The only reason why the primary image is exposed to Make -# is testing (art gtests) and benchmarking (art golem benchmarks). Install rules -# that use those variables are in dex_preopt_libart.mk. Here for dexpreopt -# purposes the infix is always 'boot' or 'mainline'. -my_dexpreopt_infix := $(if $(filter true,$(DEX_PREOPT_WITH_UPDATABLE_BCP)),mainline,boot) +my_dexpreopt_infix := $(DEXPREOPT_INFIX) my_create_dexpreopt_config := ifdef LOCAL_DEX_PREOPT