Make system_server.zip compatible with prebuilt apex builds
This artifact contains the system server jars that were used in the build. At ToT, this was disabled when prebuilts were enabled to prevent version skew between the system server jars built from source, and the system server jars deapexed from the prebuilt apex that was installed into the system image. With this CL, this artifact is now compatible with prebuilts. If a google prebuilt apex is used, system_server.zip will contain the .jar deapexed from that prebuilt. e.g. if art _and_ btservices prebuilts are enabled, then system_server.zip will contain the prebuilt jars for those apexes, and sources for others. This implementation leverages the fact that soong copies the _selected_ system server jars to out/soong/system_server_dexjars for dex2oat. Soong is aware of source/prebuilts, and populates this directory with the correct system server jar. One side effect of this change is that affects the directory structure of the zip. Previously, service-art.jar will be present in the zip file at apex/com.android.art/java/service-art.jar. After this change service-art.jar will be present in the top-level directory of the zip Bug: 308188056 Test: the zip is not bit-identical, but I checked that the file contents are indentical (discussed below) Test: unzip out/target/product/vsoc_x86_64/system_server.zip.before -d system_server.before Test: unzip out/target/product/vsoc_x86_64/system_server.zip.before -d system_server.after Test: find system_server.before/ -type f -printf '%s\t%p\n' | sort -n | cut -f2- | xargs cat | shasum Test: find system_server.after/ -type f -printf '%s\t%p\n' | sort -n | cut -f2- | xargs cat | shasum Test: the shasums are identical Test: in internal, lunch cf_x86_64_phone-next-userdebug (next uses bt prebuilts) Test: m nothing Test: aninja -t path out/target/product/vsoc_x86_64/system_server.zip <vendor_dir_path>/BluetoothGooglePrebuilt/com.google.android.btservices.apks; path exists Change-Id: I213150b7ee2b012fd649b308f3c72bebf5ca7bf8
This commit is contained in:
parent
c6e4a86b03
commit
d22b1390b9
1 changed files with 15 additions and 10 deletions
|
@ -123,22 +123,28 @@ $(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZI
|
|||
|
||||
$(call dist-for-goals, droidcore, $(boot_zip))
|
||||
|
||||
ifneq (,$(filter true,$(ART_MODULE_BUILD_FROM_SOURCE) $(MODULE_BUILD_FROM_SOURCE)))
|
||||
# Build the system_server.zip which contains the Apex system server jars and standalone system server jars
|
||||
system_server_dex2oat_dir := $(SOONG_OUT_DIR)/system_server_dexjars
|
||||
system_server_zip := $(PRODUCT_OUT)/system_server.zip
|
||||
# non_updatable_system_server_jars contains jars in /system and /system_ext that are not part of an apex.
|
||||
non_updatable_system_server_jars := \
|
||||
$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),\
|
||||
$(system_server_dex2oat_dir)/$(call word-colon,2,$(m)).jar)
|
||||
|
||||
apex_system_server_jars := \
|
||||
$(foreach m,$(PRODUCT_APEX_SYSTEM_SERVER_JARS),\
|
||||
$(PRODUCT_OUT)/apex/$(call word-colon,1,$(m))/javalib/$(call word-colon,2,$(m)).jar)
|
||||
$(system_server_dex2oat_dir)/$(call word-colon,2,$(m)).jar)
|
||||
|
||||
apex_standalone_system_server_jars := \
|
||||
$(foreach m,$(PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS),\
|
||||
$(PRODUCT_OUT)/apex/$(call word-colon,1,$(m))/javalib/$(call word-colon,2,$(m)).jar)
|
||||
$(system_server_dex2oat_dir)/$(call word-colon,2,$(m)).jar)
|
||||
|
||||
standalone_system_server_jars := \
|
||||
$(foreach m,$(PRODUCT_STANDALONE_SYSTEM_SERVER_JARS),\
|
||||
$(PRODUCT_OUT)/apex/$(call word-colon,1,$(m))/javalib/$(call word-colon,2,$(m)).jar)
|
||||
$(system_server_dex2oat_dir)/$(call word-colon,2,$(m)).jar)
|
||||
|
||||
$(system_server_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
|
||||
$(system_server_zip): PRIVATE_SYSTEM_SERVER_DEX2OAT_DIR := $(system_server_dex2oat_dir)
|
||||
$(system_server_zip): PRIVATE_SYSTEM_SERVER_JARS := $(non_updatable_system_server_jars)
|
||||
$(system_server_zip): PRIVATE_APEX_SYSTEM_SERVER_JARS := $(apex_system_server_jars)
|
||||
$(system_server_zip): PRIVATE_APEX_STANDALONE_SYSTEM_SERVER_JARS := $(apex_standalone_system_server_jars)
|
||||
$(system_server_zip): PRIVATE_STANDALONE_SYSTEM_SERVER_JARS := $(standalone_system_server_jars)
|
||||
|
@ -146,14 +152,13 @@ $(system_server_zip): $(system_server_jars) $(apex_system_server_jars) $(apex_st
|
|||
@echo "Create system server package: $@"
|
||||
rm -f $@
|
||||
$(SOONG_ZIP) -o $@ \
|
||||
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) \
|
||||
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_APEX_SYSTEM_SERVER_JARS)) \
|
||||
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_APEX_STANDALONE_SYSTEM_SERVER_JARS)) \
|
||||
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_STANDALONE_SYSTEM_SERVER_JARS))
|
||||
-C $(PRIVATE_SYSTEM_SERVER_DEX2OAT_DIR) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) \
|
||||
-C $(PRIVATE_SYSTEM_SERVER_DEX2OAT_DIR) $(addprefix -f ,$(PRIVATE_APEX_SYSTEM_SERVER_JARS)) \
|
||||
-C $(PRIVATE_SYSTEM_SERVER_DEX2OAT_DIR) $(addprefix -f ,$(PRIVATE_APEX_STANDALONE_SYSTEM_SERVER_JARS)) \
|
||||
-C $(PRIVATE_SYSTEM_SERVER_DEX2OAT_DIR) $(addprefix -f ,$(PRIVATE_STANDALONE_SYSTEM_SERVER_JARS))
|
||||
|
||||
$(call dist-for-goals, droidcore, $(system_server_zip))
|
||||
|
||||
endif #ART_MODULE_BUILD_FROM_SOURCE || MODULE_BUILD_FROM_SOURCE
|
||||
endif #PRODUCT_USES_DEFAULT_ART_CONFIG
|
||||
endif #WITH_DEXPREOPT_ART_BOOT_IMG_ONLY
|
||||
endif #WITH_DEXPREOPT
|
||||
|
|
Loading…
Reference in a new issue