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
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 6e75a18..7dd19cf 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -258,7 +258,13 @@
# 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
diff --git a/core/java.mk b/core/java.mk
index 6798efa..61a3ad3 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -501,9 +501,9 @@
$(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: $@
diff --git a/core/java_prebuilt_internal.mk b/core/java_prebuilt_internal.mk
index 8a2091e..95ae2f8 100644
--- a/core/java_prebuilt_internal.mk
+++ b/core/java_prebuilt_internal.mk
@@ -35,9 +35,9 @@
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)
diff --git a/core/product_config.mk b/core/product_config.mk
index 699d62a..82967bc 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -231,6 +231,10 @@
# 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 @@
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)
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 1496d56..509e3f6 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -91,7 +91,8 @@
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.
diff --git a/core/tasks/boot_jars_package_check.mk b/core/tasks/boot_jars_package_check.mk
index 05243e5..cbaa682 100644
--- a/core/tasks/boot_jars_package_check.mk
+++ b/core/tasks/boot_jars_package_check.mk
@@ -23,19 +23,25 @@
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