Introduce droidcore-unbundled target

The droidcore-unbundled target replaces the droidcore
target when TARGET_BUILD_UNBUNDLED_IMAGE=true. This
target is similar to droidcore in terms of dependencies,
but it has a smaller set of dist files. The intention is
to use TARGET_BUILD_UNBUNDLED_IMAGE=true with a
VSDK-using vendor build to supply Java dependencies from
prebuilts to avoid building (or needing) Java framework
sources.

Test: build with and without TARGET_BUILD_UNBUNDLED_IMAGE=true
Test: m nothing dist (before patch)
Test: m nothing dist (after patch)
Test: m nothing dist TARGET_BUILD_UNBUNDLED_IMAGE=true (after patch)
Test: examine ninja build graph for previous 3 tests
Bug: 188176942
Bug: 187064252
Change-Id: Ia7f8200c1bb1aaaa57c177d1698a114efe26bec7
This commit is contained in:
Bill Peckham 2021-06-15 19:35:06 -07:00
parent 76d415562f
commit 0a30cc41bc
5 changed files with 83 additions and 40 deletions

View file

@ -83,7 +83,7 @@ $(pcf_ignored_file): PRIVATE_IGNORED := $(sort $(product_copy_files_ignored))
$(pcf_ignored_file):
echo "$(PRIVATE_IGNORED)" | tr " " "\n" >$@
$(call dist-for-goals,droidcore,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file)))
$(call dist-for-goals,droidcore-unbundled,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file)))
pcf_ignored_file :=
product_copy_files_ignored :=
@ -586,7 +586,7 @@ $(BUILD_SYSTEM_STATS):
@rm -f $@
@$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
@$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
$(call dist-for-goals,droidcore-unbundled,$(BUILD_SYSTEM_STATS))
# -----------------------------------------------------------------
# build /product/etc/security/avb/system_other.avbpubkey if needed
@ -611,7 +611,7 @@ SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
@rm -f $@
$(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
$(call dist-for-goals,droidcore-unbundled,$(SOONG_TO_CONVERT))
MK2BP_CATALOG_SCRIPT := build/make/tools/mk2bp_catalog.py
MK2BP_REMAINING_HTML := $(PRODUCT_OUT)/mk2bp_remaining.html
@ -625,7 +625,7 @@ $(MK2BP_REMAINING_HTML): $(SOONG_CONV_DATA) $(MK2BP_CATALOG_SCRIPT)
--out_dir="$(OUT_DIR)" \
--mode=html \
> $@
$(call dist-for-goals,droidcore,$(MK2BP_REMAINING_HTML))
$(call dist-for-goals,droidcore-unbundled,$(MK2BP_REMAINING_HTML))
MK2BP_REMAINING_CSV := $(PRODUCT_OUT)/mk2bp_remaining.csv
$(MK2BP_REMAINING_CSV): $(SOONG_CONV_DATA) $(MK2BP_CATALOG_SCRIPT)
@ -635,7 +635,7 @@ $(MK2BP_REMAINING_CSV): $(SOONG_CONV_DATA) $(MK2BP_CATALOG_SCRIPT)
--out_dir="$(OUT_DIR)" \
--mode=csv \
> $@
$(call dist-for-goals,droidcore,$(MK2BP_REMAINING_CSV))
$(call dist-for-goals,droidcore-unbundled,$(MK2BP_REMAINING_CSV))
# -----------------------------------------------------------------
# Modules use -Wno-error, or added default -Wall -Werror
@ -647,11 +647,11 @@ $(WALL_WERROR):
echo "# Modules added default -Wall" >> $@
for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
$(call dist-for-goals,droidcore,$(WALL_WERROR))
$(call dist-for-goals,droidcore-unbundled,$(WALL_WERROR))
# -----------------------------------------------------------------
# C/C++ flag information for modules
$(call dist-for-goals,droidcore,$(SOONG_MODULES_CFLAG_ARTIFACTS))
$(call dist-for-goals,droidcore-unbundled,$(SOONG_MODULES_CFLAG_ARTIFACTS))
# -----------------------------------------------------------------
# Modules missing profile files
@ -4592,7 +4592,7 @@ endif
.PHONY: misc_info
misc_info: $(INSTALLED_MISC_INFO_TARGET)
droidcore: $(INSTALLED_MISC_INFO_TARGET)
droidcore-unbundled: $(INSTALLED_MISC_INFO_TARGET)
# -----------------------------------------------------------------
# A zip of the directories that map to the target filesystem.
@ -4846,7 +4846,7 @@ endif
ifdef BOARD_PREBUILT_BOOTLOADER
$(BUILT_TARGET_FILES_PACKAGE): $(INSTALLED_BOOTLOADER_MODULE)
droidcore: $(INSTALLED_BOOTLOADER_MODULE)
droidcore-unbundled: $(INSTALLED_BOOTLOADER_MODULE)
endif
# Depending on the various images guarantees that the underlying
@ -5434,7 +5434,7 @@ ifeq (true,$(CLANG_COVERAGE))
$(PROFDATA_ZIP): $(SOONG_ZIP)
$(hide) $(SOONG_ZIP) -d -o $@ -C $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION) -f $(LLVM_PROFDATA) -f $(LIBCXX)
$(call dist-for-goals,droidcore apps_only,$(PROFDATA_ZIP))
$(call dist-for-goals,droidcore-unbundeld apps_only,$(PROFDATA_ZIP))
endif
# -----------------------------------------------------------------
@ -5613,7 +5613,7 @@ $(INSTALLED_SUPERIMAGE_TARGET): $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
$(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
$(call intermediates-dir-for,PACKAGING,superimage_debug)/misc_info.txt)
droidcore: $(INSTALLED_SUPERIMAGE_TARGET)
droidcore-unbundled: $(INSTALLED_SUPERIMAGE_TARGET)
# For devices that uses super image directly, the superimage target points to the file in $(PRODUCT_OUT).
.PHONY: superimage
@ -5699,7 +5699,7 @@ $(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_VBMETAIMAGE_TARGET) $(MK_COMBINE_QEMU
$(MK_COMBINE_QEMU_IMAGE) -i $(INSTALLED_SYSTEM_QEMU_CONFIG) -o $@)
systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_SYSTEMIMAGE)
endif
ifdef INSTALLED_VENDORIMAGE_TARGET
INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
@ -5708,7 +5708,7 @@ $(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_S
(export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET))
vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_VENDORIMAGE)
endif
ifdef INSTALLED_RAMDISK_TARGET
@ -5719,7 +5719,7 @@ $(INSTALLED_QEMU_RAMDISKIMAGE): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_RA
@echo Create ramdisk-qemu.img
(cat $(INSTALLED_RAMDISK_TARGET) $(INTERNAL_VENDOR_RAMDISK_TARGET) > $(INSTALLED_QEMU_RAMDISKIMAGE))
droidcore: $(INSTALLED_QEMU_RAMDISKIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_RAMDISKIMAGE)
endif
endif
endif
@ -5731,7 +5731,7 @@ $(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE
(export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET))
productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_PRODUCTIMAGE)
endif
ifdef INSTALLED_SYSTEM_EXTIMAGE_TARGET
INSTALLED_QEMU_SYSTEM_EXTIMAGE := $(PRODUCT_OUT)/system_ext-qemu.img
@ -5740,7 +5740,7 @@ $(INSTALLED_QEMU_SYSTEM_EXTIMAGE): $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(MK_QEMU
(export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEM_EXTIMAGE_TARGET))
systemextimage: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE)
droidcore: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE)
endif
ifdef INSTALLED_ODMIMAGE_TARGET
INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
@ -5749,7 +5749,7 @@ $(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(S
(export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET))
odmimage: $(INSTALLED_QEMU_ODMIMAGE)
droidcore: $(INSTALLED_QEMU_ODMIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_ODMIMAGE)
endif
ifdef INSTALLED_VENDOR_DLKMIMAGE_TARGET
@ -5759,7 +5759,7 @@ $(INSTALLED_QEMU_VENDOR_DLKMIMAGE): $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) $(MK_QE
(export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDOR_DLKMIMAGE_TARGET))
vendor_dlkmimage: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE)
droidcore: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE)
endif
ifdef INSTALLED_ODM_DLKMIMAGE_TARGET
@ -5769,7 +5769,7 @@ $(INSTALLED_QEMU_ODM_DLKMIMAGE): $(INSTALLED_ODM_DLKMIMAGE_TARGET) $(MK_QEMU_IMA
(export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODM_DLKMIMAGE_TARGET))
odm_dlkmimage: $(INSTALLED_QEMU_ODM_DLKMIMAGE)
droidcore: $(INSTALLED_QEMU_ODM_DLKMIMAGE)
droidcore-unbundled: $(INSTALLED_QEMU_ODM_DLKMIMAGE)
endif
QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
@ -5780,7 +5780,7 @@ $(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEM
$(INSTALLED_SYSTEMIMAGE_TARGET) $(QEMU_VERIFIED_BOOT_PARAMS))
systemimage: $(QEMU_VERIFIED_BOOT_PARAMS)
droidcore: $(QEMU_VERIFIED_BOOT_PARAMS)
droidcore-unbundled: $(QEMU_VERIFIED_BOOT_PARAMS)
endif
# -----------------------------------------------------------------

View file

@ -1576,9 +1576,10 @@ vbmetasystemimage: $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET)
.PHONY: vbmetavendorimage
vbmetavendorimage: $(INSTALLED_VBMETA_VENDORIMAGE_TARGET)
# Build files and then package it into the rom formats
.PHONY: droidcore
droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \
# The droidcore-unbundled target depends on the subset of targets necessary to
# perform a full system build (either unbundled or not).
.PHONY: droidcore-unbundled
droidcore-unbundled: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \
$(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
@ -1636,6 +1637,11 @@ droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
soong_docs
# The droidcore target depends on the droidcore-unbundled subset and any other
# targets for a non-unbundled (full source) full system build.
.PHONY: droidcore
droidcore: droidcore-unbundled
# dist_files only for putting your library into the dist directory with a full build.
.PHONY: dist_files
@ -1711,21 +1717,43 @@ $(eval $(call combine-notice-files, html, \
$(apps_only_installed_files)))
else ifeq (,$(TARGET_BUILD_UNBUNDLED))
else ifeq ($(TARGET_BUILD_UNBUNDLED),$(TARGET_BUILD_UNBUNDLED_IMAGE))
# Truth table for entering this block of code:
# TARGET_BUILD_UNBUNDLED | TARGET_BUILD_UNBUNDLED_IMAGE | Action
# -----------------------|------------------------------|-------------------------
# not set | not set | droidcore path
# not set | true | invalid
# true | not set | skip
# true | true | droidcore-unbundled path
# We dist the following targets only for droidcore full build. These items
# can include java-related targets that would cause building framework java
# sources in a droidcore full build.
$(call dist-for-goals, droidcore, \
$(BUILT_OTATOOLS_PACKAGE) \
$(APPCOMPAT_ZIP) \
$(DEXPREOPT_CONFIG_ZIP) \
$(DEXPREOPT_TOOLS_ZIP) \
)
# We dist the following targets for droidcore-unbundled (and droidcore since
# droidcore depends on droidcore-unbundled). The droidcore-unbundled target
# is a subset of droidcore. It can be used used for an unbundled build to
# avoid disting targets that would cause building framework java sources,
# which we want to avoid in an unbundled build.
$(call dist-for-goals, droidcore-unbundled, \
$(INTERNAL_UPDATE_PACKAGE_TARGET) \
$(INTERNAL_OTA_PACKAGE_TARGET) \
$(INTERNAL_OTA_METADATA) \
$(INTERNAL_OTA_PARTIAL_PACKAGE_TARGET) \
$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) \
$(BUILT_OTATOOLS_PACKAGE) \
$(SYMBOLS_ZIP) \
$(PROGUARD_DICT_ZIP) \
$(PROGUARD_USAGE_ZIP) \
$(COVERAGE_ZIP) \
$(APPCOMPAT_ZIP) \
$(DEXPREOPT_CONFIG_ZIP) \
$(DEXPREOPT_TOOLS_ZIP) \
$(INSTALLED_FILES_FILE) \
$(INSTALLED_FILES_JSON) \
$(INSTALLED_FILES_FILE_VENDOR) \
@ -1754,11 +1782,11 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
$(INSTALLED_MISC_INFO_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
)
)
# Put a copy of the radio/bootloader files in the dist dir.
$(foreach f,$(INSTALLED_RADIOIMAGE_TARGET), \
$(call dist-for-goals, droidcore, $(f)))
$(call dist-for-goals, droidcore-unbundled, $(f)))
ifneq ($(ANDROID_BUILD_EMBEDDED),true)
$(call dist-for-goals, droidcore, \
@ -1767,13 +1795,13 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED))
)
endif
$(call dist-for-goals, droidcore, \
$(call dist-for-goals, droidcore-unbundled, \
$(INSTALLED_FILES_FILE_ROOT) \
$(INSTALLED_FILES_JSON_ROOT) \
)
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
$(call dist-for-goals, droidcore, \
$(call dist-for-goals, droidcore-unbundled, \
$(INSTALLED_FILES_FILE_RAMDISK) \
$(INSTALLED_FILES_JSON_RAMDISK) \
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) \
@ -1793,7 +1821,7 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED))
endif
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
$(call dist-for-goals, droidcore, \
$(call dist-for-goals, droidcore-unbundled, \
$(recovery_ramdisk) \
)
endif
@ -1823,10 +1851,25 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(call dist-for-goals,droidcore,$(f):ndk_apis/$(notdir $(f))))
endif
# Building a full system-- the default is to build droidcore
droid_targets: droidcore dist_files
# For full system build (whether unbundled or not), we configure
# droid_targets to depend on droidcore-unbundled, which will set up the full
# system dependencies and also dist the subset of targets that correspond to
# an unbundled build (exclude building some framework sources).
endif # !TARGET_BUILD_UNBUNDLED
droid_targets: droidcore-unbundled
ifeq (,$(TARGET_BUILD_UNBUNDLED_IMAGE))
# If we're building a full system (including the framework sources excluded
# by droidcore-unbundled), we configure droid_targets also to depend on
# droidcore, which includes all dist for droidcore, and will build the
# necessary framework sources.
droid_targets: droidcore dist_files
endif
endif # TARGET_BUILD_UNBUNDLED == TARGET_BUILD_UNBUNDLED_IMAGE
.PHONY: docs
docs: $(ALL_DOCS)

View file

@ -26,4 +26,4 @@ $(gpl_source_tgz) : $(ALL_GPL_MODULE_LICENSE_FILES)
$(hide) tar cfz $@ --exclude ".git*" $(PRIVATE_PATHS)
# Dist the tgz only if we are doing a full build
$(call dist-for-goals,droidcore,$(gpl_source_tgz))
$(call dist-for-goals,droidcore-unbundled,$(gpl_source_tgz))

View file

@ -53,4 +53,4 @@ $(host_init_verifier_output): $(HOST_INIT_VERIFIER)
--out_product $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT) \
> $@
$(call dist-for-goals,droidcore,$(host_init_verifier_output))
$(call dist-for-goals,droidcore-unbundled,$(host_init_verifier_output))

View file

@ -26,7 +26,7 @@ $(MODULE_INFO_JSON):
$(hide) echo '}' >> $@
droidcore: $(MODULE_INFO_JSON)
droidcore-unbundled: $(MODULE_INFO_JSON)
$(call dist-for-goals, general-tests, $(MODULE_INFO_JSON))
$(call dist-for-goals, droidcore, $(MODULE_INFO_JSON))
$(call dist-for-goals, droidcore-unbundled, $(MODULE_INFO_JSON))