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
(cherry picked from commit 0a30cc41bc8acd25058d9751a75184cb9504b93b)
diff --git a/core/main.mk b/core/main.mk
index 8e18138..df56445 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1562,9 +1562,10 @@
.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) \
@@ -1622,6 +1623,11 @@
$(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
@@ -1697,21 +1703,43 @@
$(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) \
@@ -1740,11 +1768,11 @@
$(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, \
@@ -1753,13 +1781,13 @@
)
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) \
@@ -1779,7 +1807,7 @@
endif
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
- $(call dist-for-goals, droidcore, \
+ $(call dist-for-goals, droidcore-unbundled, \
$(recovery_ramdisk) \
)
endif
@@ -1809,10 +1837,25 @@
$(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)