Introduce TARGET_BUILD_UNBUNDLED_IMAGE

- TARGET_BUILD_UNBUNDLED_IMAGE is similar to TARGET_BUILD_APPS, but
its targets are the unbundled partitions instead of apps.
- Rename TARGET_BUILD_APPS_USE_PREBUILT_SDK to TARGET_BUILD_USE_PREBUILT_SDKS
because it is used even without TARGET_BUILD_APPS.
-Instead of TARGET_BUILD_APPS, use TARGET_BUILD_USE_PREBUILT_SDKS
to build java modules with prebuilt sdks, and propagate to Soong.

Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage
Change-Id: Ie096212ccbcca0018baae55e106af693b002c9e5
This commit is contained in:
Jeongik Cha 2020-07-08 18:10:38 +09:00
parent bf0c1b7b77
commit d05b57a362
10 changed files with 38 additions and 24 deletions

View File

@ -45,7 +45,7 @@ my_target_sdk_version := $(call module-target-sdk-version)
my_min_sdk_version := $(call module-min-sdk-version) my_min_sdk_version := $(call module-min-sdk-version)
ifdef TARGET_BUILD_APPS ifdef TARGET_BUILD_APPS
ifndef TARGET_BUILD_APPS_USE_PREBUILT_SDK ifndef TARGET_BUILD_USE_PREBUILT_SDKS
ifeq ($(my_target_sdk_version),$(PLATFORM_VERSION_CODENAME)) ifeq ($(my_target_sdk_version),$(PLATFORM_VERSION_CODENAME))
ifdef UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT ifdef UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT
my_target_sdk_version := $(my_target_sdk_version).$$(cat $(API_FINGERPRINT)) my_target_sdk_version := $(my_target_sdk_version).$$(cat $(API_FINGERPRINT))

View File

@ -517,18 +517,23 @@ endif
ifeq ($(TARGET_BUILD_PDK),true) ifeq ($(TARGET_BUILD_PDK),true)
ALLOW_MISSING_DEPENDENCIES := true ALLOW_MISSING_DEPENDENCIES := true
endif endif
ifeq ($(TARGET_BUILD_UNBUNDLED_IMAGE),true)
ALLOW_MISSING_DEPENDENCIES := true
endif
ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),) ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),)
ALLOW_MISSING_DEPENDENCIES := true ALLOW_MISSING_DEPENDENCIES := true
endif endif
.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES .KATI_READONLY := ALLOW_MISSING_DEPENDENCIES
TARGET_BUILD_APPS_USE_PREBUILT_SDK := TARGET_BUILD_USE_PREBUILT_SDKS :=
ifdef TARGET_BUILD_APPS ifneq (,$(TARGET_BUILD_APPS)$(TARGET_BUILD_UNBUNDLED_IMAGE))
ifndef UNBUNDLED_BUILD_SDKS_FROM_SOURCE ifndef UNBUNDLED_BUILD_SDKS_FROM_SOURCE
TARGET_BUILD_APPS_USE_PREBUILT_SDK := true TARGET_BUILD_USE_PREBUILT_SDKS := true
endif endif
endif endif
.KATI_READONLY := TARGET_BUILD_USE_PREBUILT_SDKS
prebuilt_sdk_tools := prebuilts/sdk/tools prebuilt_sdk_tools := prebuilts/sdk/tools
prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
@ -550,18 +555,18 @@ USE_D8 := true
.KATI_READONLY := USE_D8 .KATI_READONLY := USE_D8
# #
# Tools that are prebuilts for TARGET_BUILD_APPS # Tools that are prebuilts for TARGET_BUILD_USE_PREBUILT_SDKS
# #
ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) ifeq (,$(TARGET_BUILD_USE_PREBUILT_SDKS)$(filter true,$(TARGET_BUILD_PDK)))
AAPT := $(HOST_OUT_EXECUTABLES)/aapt AAPT := $(HOST_OUT_EXECUTABLES)/aapt
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
else # TARGET_BUILD_APPS || TARGET_BUILD_PDK else # TARGET_BUILD_USE_PREBUILT_SDKS || TARGET_BUILD_PDK
AAPT := $(prebuilt_sdk_tools_bin)/aapt AAPT := $(prebuilt_sdk_tools_bin)/aapt
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK endif # TARGET_BUILD_USE_PREBUILT_SDKS || TARGET_BUILD_PDK
ifeq (,$(TARGET_BUILD_APPS)) ifeq (,$(TARGET_BUILD_USE_PREBUILT_SDKS))
# Use RenderScript prebuilts for unbundled builds but not PDK builds # Use RenderScript prebuilts for unbundled builds but not PDK builds
LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc
BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat
@ -1109,7 +1114,7 @@ HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk
HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk
# The path where app can reference the support library resources. # The path where app can reference the support library resources.
ifdef TARGET_BUILD_APPS ifdef TARGET_BUILD_USE_PREBUILT_SDKS
SUPPORT_LIBRARY_ROOT := $(HISTORICAL_SDK_VERSIONS_ROOT)/current/support SUPPORT_LIBRARY_ROOT := $(HISTORICAL_SDK_VERSIONS_ROOT)/current/support
else else
SUPPORT_LIBRARY_ROOT := frameworks/support SUPPORT_LIBRARY_ROOT := frameworks/support

View File

@ -93,6 +93,7 @@ TARGET_BUILD_VARIANT := eng
endif endif
TARGET_BUILD_APPS ?= TARGET_BUILD_APPS ?=
TARGET_BUILD_UNBUNDLED_IMAGE ?=
# Set to true for an unbundled build, i.e. a build without # Set to true for an unbundled build, i.e. a build without
# support for platform targets like the system image. This also # support for platform targets like the system image. This also
@ -107,11 +108,19 @@ ifneq ($(TARGET_BUILD_APPS),)
TARGET_BUILD_UNBUNDLED := true TARGET_BUILD_UNBUNDLED := true
endif endif
# TARGET_BUILD_UNBUNDLED_IMAGE also implies unbundled build.
# (i.e. it targets to only unbundled image, such as the vendor image,
# ,or the product image).
ifneq ($(TARGET_BUILD_UNBUNDLED_IMAGE),)
TARGET_BUILD_UNBUNDLED := true
endif
.KATI_READONLY := \ .KATI_READONLY := \
TARGET_PRODUCT \ TARGET_PRODUCT \
TARGET_BUILD_VARIANT \ TARGET_BUILD_VARIANT \
TARGET_BUILD_APPS \ TARGET_BUILD_APPS \
TARGET_BUILD_UNBUNDLED \ TARGET_BUILD_UNBUNDLED \
TARGET_BUILD_UNBUNDLED_IMAGE \
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Set up configuration for host machine. We don't do cross- # Set up configuration for host machine. We don't do cross-

View File

@ -106,8 +106,8 @@ ifneq ($(strip $(aidl_sources)),)
aidl_preprocess_import := aidl_preprocess_import :=
ifdef LOCAL_SDK_VERSION ifdef LOCAL_SDK_VERSION
ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)),) ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_USE_PREBUILT_SDKS)),)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS # LOCAL_SDK_VERSION is current and no TARGET_BUILD_USE_PREBUILT_SDKS
aidl_preprocess_import := $(FRAMEWORK_AIDL) aidl_preprocess_import := $(FRAMEWORK_AIDL)
else else
aidl_preprocess_import := $(call resolve-prebuilt-sdk-aidl-path,$(LOCAL_SDK_VERSION)) aidl_preprocess_import := $(call resolve-prebuilt-sdk-aidl-path,$(LOCAL_SDK_VERSION))

View File

@ -25,7 +25,7 @@ ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION))
LOCAL_JAVA_LANGUAGE_VERSION := 1.7 LOCAL_JAVA_LANGUAGE_VERSION := 1.7
else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT))) else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT)))
LOCAL_JAVA_LANGUAGE_VERSION := 1.8 LOCAL_JAVA_LANGUAGE_VERSION := 1.8
else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)) else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_USE_PREBUILT_SDKS))
# TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules # TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules
LOCAL_JAVA_LANGUAGE_VERSION := 1.8 LOCAL_JAVA_LANGUAGE_VERSION := 1.8
else else
@ -268,7 +268,7 @@ ifndef LOCAL_IS_HOST_MODULE
my_system_modules := $(LEGACY_CORE_PLATFORM_SYSTEM_MODULES) my_system_modules := $(LEGACY_CORE_PLATFORM_SYSTEM_MODULES)
endif # LOCAL_NO_STANDARD_LIBRARIES endif # LOCAL_NO_STANDARD_LIBRARIES
ifneq (,$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)) ifneq (,$(TARGET_BUILD_USE_PREBUILT_SDKS))
sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,system_current,$(lib_name))) sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,system_current,$(lib_name)))
else else
# When SDK libraries are referenced from modules built without SDK, provide the all APIs to them # When SDK libraries are referenced from modules built without SDK, provide the all APIs to them
@ -283,8 +283,8 @@ ifndef LOCAL_IS_HOST_MODULE
Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS)) Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
endif endif
ifneq (,$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)$(filter-out %current,$(LOCAL_SDK_VERSION))) ifneq (,$(TARGET_BUILD_USE_PREBUILT_SDKS)$(filter-out %current,$(LOCAL_SDK_VERSION)))
# TARGET_BUILD_APPS mode or numbered SDK. Use prebuilt modules. # TARGET_BUILD_USE_PREBUILT_SDKS mode or numbered SDK. Use prebuilt modules.
sdk_module := $(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION)) sdk_module := $(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION))
sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION),$(lib_name))) sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION),$(lib_name)))
else else
@ -325,7 +325,7 @@ ifndef LOCAL_IS_HOST_MODULE
# related classes to be present. This change adds stubs needed for # related classes to be present. This change adds stubs needed for
# javac to compile lambdas. # javac to compile lambdas.
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
ifdef TARGET_BUILD_APPS_USE_PREBUILT_SDK ifdef TARGET_BUILD_USE_PREBUILT_SDKS
full_java_bootclasspath_libs += $(call java-lib-header-files,sdk-core-lambda-stubs) full_java_bootclasspath_libs += $(call java-lib-header-files,sdk-core-lambda-stubs)
else else
full_java_bootclasspath_libs += $(call java-lib-header-files,core-lambda-stubs) full_java_bootclasspath_libs += $(call java-lib-header-files,core-lambda-stubs)

View File

@ -173,7 +173,7 @@ endif
framework_res_package_export := framework_res_package_export :=
# Please refer to package.mk # Please refer to package.mk
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),) ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_USE_PREBUILT_SDKS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
framework_res_package_export := \ framework_res_package_export := \
$(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION)) $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION))
else else

View File

@ -50,8 +50,8 @@ renderscript_flags := -Wall -Werror
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS) renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
# prepend the RenderScript system include path # prepend the RenderScript system include path
ifneq ($(filter-out current system_current test_current core_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),) ifneq ($(filter-out current system_current test_current core_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_USE_PREBUILT_SDKS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS # if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_USE_PREBUILT_SDKS
LOCAL_RENDERSCRIPT_INCLUDES := \ LOCAL_RENDERSCRIPT_INCLUDES := \
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \ $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \ $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
@ -110,7 +110,7 @@ renderscript_intermediate := $(intermediates)/renderscript
rs_jni_lib := $(call intermediates-dir-for,SHARED_LIBRARIES,librsjni.so)/librsjni.so rs_jni_lib := $(call intermediates-dir-for,SHARED_LIBRARIES,librsjni.so)/librsjni.so
LOCAL_JNI_SHARED_LIBRARIES += librsjni LOCAL_JNI_SHARED_LIBRARIES += librsjni
ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT)) ifneq (,$(TARGET_BUILD_USE_PREBUILT_SDKS)$(FORCE_BUILD_RS_COMPAT))
rs_compatibility_jni_libs := $(addprefix \ rs_compatibility_jni_libs := $(addprefix \
$(renderscript_intermediate)/librs., \ $(renderscript_intermediate)/librs., \

View File

@ -401,7 +401,7 @@ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
# resources. # resources.
ifeq ($(LOCAL_SDK_RES_VERSION),core_current) ifeq ($(LOCAL_SDK_RES_VERSION),core_current)
# core_current doesn't contain any framework resources. # core_current doesn't contain any framework resources.
else ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS_USE_PREBUILT_SDK),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),) else ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_USE_PREBUILT_SDKS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
# for released sdk versions, the platform resources were built into android.jar. # for released sdk versions, the platform resources were built into android.jar.
framework_res_package_export := \ framework_res_package_export := \
$(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION)) $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION))

View File

@ -41,7 +41,7 @@ $(call add_json_str, Platform_min_supported_target_sdk_version, $(PLATFORM_MIN_
$(call add_json_bool, Allow_missing_dependencies, $(ALLOW_MISSING_DEPENDENCIES)) $(call add_json_bool, Allow_missing_dependencies, $(ALLOW_MISSING_DEPENDENCIES))
$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_UNBUNDLED)) $(call add_json_bool, Unbundled_build, $(TARGET_BUILD_UNBUNDLED))
$(call add_json_bool, Unbundled_build_apps, $(TARGET_BUILD_APPS)) $(call add_json_bool, Unbundled_build_apps, $(TARGET_BUILD_APPS))
$(call add_json_bool, Unbundled_build_sdks_from_source, $(UNBUNDLED_BUILD_SDKS_FROM_SOURCE)) $(call add_json_bool, Always_use_prebuilt_sdks, $(TARGET_BUILD_USE_PREBUILT_SDKS))
$(call add_json_bool, Pdk, $(filter true,$(TARGET_BUILD_PDK))) $(call add_json_bool, Pdk, $(filter true,$(TARGET_BUILD_PDK)))
$(call add_json_bool, Debuggable, $(filter userdebug eng,$(TARGET_BUILD_VARIANT))) $(call add_json_bool, Debuggable, $(filter userdebug eng,$(TARGET_BUILD_VARIANT)))

View File

@ -111,7 +111,7 @@ endif
framework_res_package_export := framework_res_package_export :=
# Please refer to package.mk # Please refer to package.mk
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS_USE_PREBUILT_SDK),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),) ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_USE_PREBUILT_SDKS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
framework_res_package_export := \ framework_res_package_export := \
$(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION)) $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION))
else else