Always default to 1.9 for host java modules in Android.mk files

Host modules shouldn't use the logic for device modules to determine
the java language version to use, always default to 1.9.

Bug: 202761304
Test: m checkbuild
Change-Id: I268dd34d887db4646e188858c7f2aedc30966856
This commit is contained in:
Colin Cross 2021-11-15 10:58:31 -08:00
parent 866d824328
commit 362f55af96

View file

@ -21,15 +21,20 @@ endif
# Modules can override this logic by specifying
# LOCAL_JAVA_LANGUAGE_VERSION explicitly.
ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION))
ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT)))
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_USE_PREBUILT_SDKS))
# TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules
LOCAL_JAVA_LANGUAGE_VERSION := 1.8
else
ifdef LOCAL_IS_HOST_MODULE
# Host modules always default to 1.9
LOCAL_JAVA_LANGUAGE_VERSION := 1.9
else
ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT)))
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_USE_PREBUILT_SDKS))
# TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules
LOCAL_JAVA_LANGUAGE_VERSION := 1.8
else
LOCAL_JAVA_LANGUAGE_VERSION := 1.9
endif
endif
endif
LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION)