Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ebca30d authored by Jiyong Park's avatar Jiyong Park Committed by Sundong Ahn
Browse files

Support LOCAL_SDK_VERSION := core_current

core_current is a pseudo SDK version which is a core Java API subset of
the Android API. It is expected to be mainly used for external Java
projects which are agnostic to Android; such as junit, guava, etc.

A module built with this SDK version can only link to java modules of
the same kind. It can't depend on modules built with LOCAL_SDK_VERSION
:= current or without LOCAL_SDK_VERSION.

Bug: 72206056
Test: m -j
Change-Id: I34a9696393aa6704fd6684a40ea5b05d3fb46b23
parent 4b4c3d91
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -927,8 +927,8 @@ TARGET_AVAILABLE_SDK_VERSIONS := $(addprefix system_,$(call numerically_sort,\
    $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android_system.jar)))) \
    $(TARGET_AVAILABLE_SDK_VERSIONS)

# We don't have prebuilt test_current SDK yet.
TARGET_AVAILABLE_SDK_VERSIONS := test_current $(TARGET_AVAILABLE_SDK_VERSIONS)
# We don't have prebuilt test_current and core_current SDK yet.
TARGET_AVAILABLE_SDK_VERSIONS := test_current core_current $(TARGET_AVAILABLE_SDK_VERSIONS)

TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,27,$(TARGET_AVAILABLE_SDK_VERSIONS))
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ $(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
$(built_dpi_apk): PRIVATE_RESOURCE_LIST := $(all_res_assets)
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
+9 −2
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ ifneq ($(LOCAL_SDK_VERSION),)
  else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
    LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
    $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_test_stubs_current)
  else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),core_current)
    LOCAL_JAVA_LIBRARIES := core.current.stubs $(LOCAL_JAVA_LIBRARIES)
    $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core.current.stubs)
  else
    ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
      ifeq (,$(TARGET_BUILD_APPS))
@@ -81,8 +84,12 @@ ifneq ($(LOCAL_SDK_VERSION),)
        $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
      endif
    else
      LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
      $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
      # core_<ver> is subset of <ver>. Instead of defining a prebuilt lib for core_<ver>,
      # use the stub for <ver> when building for apps.
      _version := $(patsubst core_%,%,$(LOCAL_SDK_VERSION))
      LOCAL_JAVA_LIBRARIES := sdk_v$(_version) $(LOCAL_JAVA_LIBRARIES)
      $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(_version))
      _version :=
    endif
  endif
else
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)

endif # !LOCAL_IS_STATIC_JAVA_LIBRARY

ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
  my_default_app_target_sdk := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
  my_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
+5 −5
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
else
  ifneq (,$(LOCAL_SDK_VERSION))
    # Set target-api for LOCAL_SDK_VERSIONs other than current.
    ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
    ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
      renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
    endif
  endif  # LOCAL_SDK_VERSION is set
@@ -149,7 +149,7 @@ renderscript_flags := -Wall -Werror
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)

# prepend the RenderScript system include path
ifneq ($(filter-out current system_current test_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_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
LOCAL_RENDERSCRIPT_INCLUDES := \
    $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
@@ -265,7 +265,7 @@ ifneq ($(strip $(aidl_sources)),)

aidl_preprocess_import :=
ifdef LOCAL_SDK_VERSION
ifneq ($(filter current system_current test_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
  # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
  aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
else
@@ -609,7 +609,7 @@ proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
my_proguard_sdk_raise :=
ifdef LOCAL_SDK_VERSION
ifdef TARGET_BUILD_APPS
ifeq (,$(filter current system_current test_current, $(LOCAL_SDK_VERSION)))
ifeq (,$(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
  my_proguard_sdk_raise := $(call java-lib-header-files, sdk_vcurrent)
endif
else
@@ -798,7 +798,7 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html)

endif  # full_classes_jar is defined

ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
  my_default_app_target_sdk := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
  my_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
Loading