1
2# Enforcement checks that LOCAL_SDK_VERSION and LOCAL_PRIVATE_PLATFORM_APIS are
3# set correctly.
4# Should be included by java targets that allow specifying LOCAL_SDK_VERSION.
5# The JAVA_SDK_ENFORCEMENT_WARNING and JAVA_SDK_ENFORCEMENT_ERROR variables may
6# be set to a particular module class to enable warnings and errors for that
7# subtype.
8
9allowed_modules := framework-res__auto_generated_rro
10
11
12ifeq (,$(JAVA_SDK_ENFORCEMENT_ERROR))
13  JAVA_SDK_ENFORCEMENT_ERROR := APPS
14endif
15
16ifeq ($(LOCAL_SDK_VERSION)$(LOCAL_PRIVATE_PLATFORM_APIS),)
17  ifeq (,$(filter $(LOCAL_MODULE),$(allowed_modules)))
18    ifneq ($(JAVA_SDK_ENFORCEMENT_WARNING)$(JAVA_SDK_ENFORCEMENT_ERROR),)
19      my_message := Must specify LOCAL_SDK_VERSION or LOCAL_PRIVATE_PLATFORM_APIS,
20      ifeq ($(LOCAL_MODULE_CLASS),$(JAVA_SDK_ENFORCEMENT_ERROR))
21        $(call pretty-error,$(my_message))
22      endif
23      ifeq ($(LOCAL_MODULE_CLASS),$(JAVA_SDK_ENFORCEMENT_WARNING))
24        $(call pretty-warning,$(my_message))
25      endif
26      my_message :=
27    endif
28  endif
29else ifneq ($(LOCAL_SDK_VERSION),)
30  ifneq ($(LOCAL_PRIVATE_PLATFORM_APIS),)
31    my_message := Specifies both LOCAL_SDK_VERSION ($(LOCAL_SDK_VERSION)) and
32    my_message += LOCAL_PRIVATE_PLATFORM_APIS ($(LOCAL_PRIVATE_PLATFORM_APIS))
33    my_message += but should specify only one
34    $(call pretty-error,$(my_message))
35    my_message :=
36  endif
37endif
38