Add a flag to allow unbundled builds to build SDKs from source

Mainline modules are tightly coupled to the platform, and should
build against the current SDK from source and not prebuilts. Add
a flag UNBUNDLED_BUILD_SDKS_FROM_SOURCE to specify that a
TARGET_BUILD_APPS build should build the current SDK instead of
using the prebuilts.

Bug: 121194841
Bug: 121231426
Test: no change to out/build-aosp_sailfish.ninja
Test: forrest unbundled build
Test: forrest master apps build
Test: forrest mainline modules build
Change-Id: I9ebc08745409a817d831817cb282aba1de6d81bb
This commit is contained in:
Colin Cross 2018-12-18 22:43:16 -08:00
parent 54a71e229b
commit 8e0ff1c370
6 changed files with 15 additions and 7 deletions

View file

@ -569,6 +569,13 @@ ALLOW_MISSING_DEPENDENCIES := true
endif
.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES
TARGET_BUILD_APPS_USE_PREBUILT_SDK :=
ifdef TARGET_BUILD_APPS
ifndef UNBUNDLED_BUILD_SDKS_FROM_SOURCE
TARGET_BUILD_APPS_USE_PREBUILT_SDK := true
endif
endif
prebuilt_sdk_tools := prebuilts/sdk/tools
prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin

View file

@ -109,7 +109,7 @@ ifneq ($(strip $(aidl_sources)),)
aidl_preprocess_import :=
ifdef LOCAL_SDK_VERSION
ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)),)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
else

View file

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

View file

@ -496,7 +496,7 @@ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
# resources.
ifeq ($(LOCAL_SDK_RES_VERSION),core_current)
# 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),$(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_APPS_USE_PREBUILT_SDK),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
# for released sdk versions, the platform resources were built into android.jar.
framework_res_package_export := \
$(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION))

View file

@ -36,6 +36,7 @@ $(call add_json_csv, Platform_version_future_codenames, $(PLATFORM_VERSION_FUTU
$(call add_json_bool, Allow_missing_dependencies, $(ALLOW_MISSING_DEPENDENCIES))
$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_APPS))
$(call add_json_bool, Unbundled_build_sdks_from_source, $(UNBUNDLED_BUILD_SDKS_FROM_SOURCE))
$(call add_json_bool, Pdk, $(filter true,$(TARGET_BUILD_PDK)))
$(call add_json_bool, Debuggable, $(filter userdebug eng,$(TARGET_BUILD_VARIANT)))

View file

@ -110,7 +110,7 @@ endif
framework_res_package_export :=
# Please refer to package.mk
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_APPS_USE_PREBUILT_SDK),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
framework_res_package_export := \
$(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION))
else