Use two-column format for PRODUCT_BOOT_JARS components.

The first component is the apex name, or a special name "platform"
if the boot jar is a platform jar rather than a part of some apex.
This is a prerequisite change for moving core-icu4j to a separate
com.android.i18n apex.

Old one-column format is still supported, but all unqualified
components of PRODUCT_BOOT_JARS get "platform:" prepended to them
after reading the product makefiles.

Test: aosp_walleye-userdebug boots
Bug: 138994281
Change-Id: I0f79c7d10477880ca65354251a5d1ca0b7ce79ab
This commit is contained in:
Ulya Trafimovich 2020-04-30 10:59:48 +01:00
parent a9800b4db5
commit 4c69c2ff72
6 changed files with 39 additions and 24 deletions

View File

@ -258,7 +258,13 @@ endef
# java code with dalvikvm/art.
# Jars present in the ART apex. These should match exactly the list of
# Java libraries in the ART apex build rule.
ART_APEX_JARS := core-oj core-libart core-icu4j okhttp bouncycastle apache-xml
ART_APEX_JARS := \
com.android.art:core-oj \
com.android.art:core-libart \
com.android.art:core-icu4j \
com.android.art:okhttp \
com.android.art:bouncycastle \
com.android.art:apache-xml
#################################################################
# Read the product specs so we can get TARGET_DEVICE and other

View File

@ -501,9 +501,9 @@ else # !LOCAL_PROGUARD_ENABLED
$(transform-classes.jar-to-dex)
endif
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),)
$(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)
endif
$(foreach pair,$(PRODUCT_BOOT_JARS), \
$(if $(filter $(LOCAL_MODULE),$(call word-colon,2,$(pair))), \
$(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)))
$(built_dex): $(built_dex_intermediate)
@echo Copying: $@

View File

@ -35,9 +35,9 @@ ifeq ($(prebuilt_module_is_dex_javalib),true)
my_dex_jar := $(my_prebuilt_src_file)
# This is a target shared library, i.e. a jar with classes.dex.
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),)
$(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)
endif
$(foreach pair,$(PRODUCT_BOOT_JARS), \
$(if $(filter $(LOCAL_MODULE),$(call word-colon,2,$(pair))), \
$(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)))
ALL_MODULES.$(my_register_name).CLASSES_JAR := $(common_classes_jar)

View File

@ -231,6 +231,10 @@ PRODUCT_AAPT_CONFIG := $(subst $(space),$(comma),$(PRODUCT_AAPT_CONFIG))
# Extra boot jars must be appended at the end after common boot jars.
PRODUCT_BOOT_JARS += $(PRODUCT_BOOT_JARS_EXTRA)
# Add 'platform:' prefix to unqualified boot jars
PRODUCT_BOOT_JARS := $(foreach pair,$(PRODUCT_BOOT_JARS), \
$(if $(findstring :,$(pair)),,platform:)$(pair))
# The extra system server jars must be appended at the end after common system server jars.
PRODUCT_SYSTEM_SERVER_JARS += $(PRODUCT_SYSTEM_SERVER_JARS_EXTRA)
@ -271,11 +275,9 @@ ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
endif
$(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS), \
$(if $(findstring $(call word-colon,2,$(pair)),$(PRODUCT_BOOT_JARS)), \
$(error A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, \
but $(call word-colon,2,$(pair)) is) \
) \
)
$(eval jar := $(call word-colon,2,$(pair))) \
$(if $(findstring $(jar), $(PRODUCT_BOOT_JARS)), \
$(error A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but $(jar) is)))
ENFORCE_SYSTEM_CERTIFICATE := $(PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT)
ENFORCE_SYSTEM_CERTIFICATE_WHITELIST := $(PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST)

View File

@ -91,7 +91,8 @@ endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
ifdef LOCAL_SOONG_DEX_JAR
ifndef LOCAL_IS_HOST_MODULE
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS), $(call word-colon,2,$(pair)))
ifneq ($(filter $(LOCAL_MODULE),$(boot_jars)),) # is_boot_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.

View File

@ -23,19 +23,25 @@ ifdef PRODUCT_BOOT_JARS
intermediates := $(call intermediates-dir-for, PACKAGING, boot-jars-package-check,,COMMON)
stamp := $(intermediates)/stamp
# The actual names for the updatable jars are <jar_name>.<apex_name> e.g., updatable-media.com.android.media
updatable_boot_jars := $(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS),\
$(eval apex := $(call word-colon,1,$(pair)))\
$(eval jar := $(call word-colon,2,$(pair)))\
$(jar).$(apex)\
)
#TODO(jiyong) merge art_boot_jars into updatable_boot_jars
art_boot_jars := $(addsuffix .com.android.art.release,$(filter $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS)))
# Convert the colon-separated components <apex>:<jar> to <jar>.<apex> names
# (e.g. com.android.media:updatable-media -> updatable-media.com.android.media).
# Special cases:
# - for the "platform" apex drop the .<apex> suffix
# - for the ART apex select release variant
boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS) $(PRODUCT_UPDATABLE_BOOT_JARS), \
$(eval apex := $(call word-colon,1,$(pair))) \
$(eval jar := $(call word-colon,2,$(pair))) \
$(eval q := :) \
$(eval sfx := $(q).$(apex)$(q)) \
$(eval sfx := $(subst $(q).platform$(q),$(q)$(q),$(sfx))) \
$(eval sfx := $(subst $(q).com.android.art$(q),$(q).com.android.art.release$(q),$(sfx))) \
$(eval sfx := $(patsubst $(q)%$(q),%,$(sfx))) \
$(jar)$(sfx))
platform_boot_jars := $(filter-out $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS))
built_boot_jars := $(foreach j, $(updatable_boot_jars) $(art_boot_jars) $(platform_boot_jars), \
# Convert boot jar names to build paths.
built_boot_jars := $(foreach j, $(boot_jars), \
$(call intermediates-dir-for, JAVA_LIBRARIES, $(j),,COMMON)/classes.jar)
script := build/make/core/tasks/check_boot_jars/check_boot_jars.py
whitelist_file := build/make/core/tasks/check_boot_jars/package_whitelist.txt