diff --git a/core/config.mk b/core/config.mk index 9d77fe52ba..59b8de00bc 100644 --- a/core/config.mk +++ b/core/config.mk @@ -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 diff --git a/core/java.mk b/core/java.mk index 932a4212a5..e564db2516 100644 --- a/core/java.mk +++ b/core/java.mk @@ -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 diff --git a/core/java_common.mk b/core/java_common.mk index f4c47c81af..ac26e5e44e 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -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) diff --git a/core/package_internal.mk b/core/package_internal.mk index 451fce7d90..a46d76a097 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -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)) diff --git a/core/soong_config.mk b/core/soong_config.mk index 3dc6d9ae81..85be1e7a8b 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -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))) diff --git a/core/static_java_library.mk b/core/static_java_library.mk index 2a87705031..cee7c9edff 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -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