Add support for LOCAL_PRIVATE_PLATFORM_APIS.

The only enforcement right now is that modules don't specify both
LOCAL_SDK_VERSION and LOCAL_PRIVATE_PLATFORM_APIS, but a warning
can be turned on by setting the JAVA_SDK_ENFORCEMENT_WARNING variable.

Bug: 73535841
Test: make w/ and wo/ flag.
Change-Id: I3cc720bf060e2bc789e10884ff888d527b91cb50
This commit is contained in:
Anton Hansson 2018-02-21 15:29:44 +00:00
parent 5fdae96b06
commit 7ff32d2734
4 changed files with 19 additions and 0 deletions

View file

@ -196,6 +196,7 @@ LOCAL_PREBUILT_MODULE_FILE:=
LOCAL_PREBUILT_OBJ_FILES:=
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
LOCAL_PREBUILT_STRIP_COMMENTS:=
LOCAL_PRIVATE_PLATFORM_APIS:=
LOCAL_PRIVILEGED_MODULE:=
# '',full,custom,disabled,obfuscation,optimization
LOCAL_PRODUCT_MODULE:=

View file

@ -67,6 +67,8 @@ all_java_sources := $(java_sources)
include $(BUILD_SYSTEM)/java_common.mk
include $(BUILD_SYSTEM)/sdk_check.mk
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
# List of dependencies for anything that needs all java sources in place

View file

@ -357,6 +357,8 @@ endif # TURBINE_ENABLED != false
include $(BUILD_SYSTEM)/java_common.mk
include $(BUILD_SYSTEM)/sdk_check.mk
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES := $(if $(renderscript_sources),true)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RS_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/renderscript

14
core/sdk_check.mk Normal file
View file

@ -0,0 +1,14 @@
# Enforcement checks that LOCAL_SDK_VERSION and LOCAL_PRIVATE_PLATFORM_APIS are
# set correctly.
# Should be included by java targets that allow specifying LOCAL_SDK_VERSION.
ifeq ($(LOCAL_SDK_VERSION)$(LOCAL_PRIVATE_PLATFORM_APIS),)
ifneq ($(JAVA_SDK_ENFORCEMENT_WARNING),)
$(warning Java modules must specify LOCAL_SDK_VERSION or LOCAL_PRIVATE_PLATFORM_APIS, but $(LOCAL_MODULE) specifies neither.)
endif
else ifneq ($(LOCAL_SDK_VERSION),)
ifneq ($(LOCAL_PRIVATE_PLATFORM_APIS),)
$(error $(LOCAL_MODULE) specifies both LOCAL_SDK_VERSION ($(LOCAL_SDK_VERSION)) and LOCAL_PRIVATE_PLATFORM_APIS ($(LOCAL_PRIVATE_PLATFORM_APIS)), but should specify only one.)
endif
endif