blob: c09fc7caec5f419d39b0536bbea3df365d79808f [file] [log] [blame]
Anton Hansson7ff32d22018-02-21 15:29:44 +00001
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.
Anton Hanssonf5f29aa2018-02-28 17:01:51 +00005# 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
9whitelisted_modules := framework-res__auto_generated_rro
Anton Hansson7ff32d22018-02-21 15:29:44 +000010
Anton Hansson18cf2172018-03-07 11:30:16 +000011
12ifeq (,$(JAVA_SDK_ENFORCEMENT_ERROR))
13 JAVA_SDK_ENFORCEMENT_ERROR := APPS
14endif
15
Anton Hansson7ff32d22018-02-21 15:29:44 +000016ifeq ($(LOCAL_SDK_VERSION)$(LOCAL_PRIVATE_PLATFORM_APIS),)
Anton Hanssonf5f29aa2018-02-28 17:01:51 +000017 ifeq (,$(filter $(LOCAL_MODULE),$(whitelisted_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
Anton Hansson7ff32d22018-02-21 15:29:44 +000029else ifneq ($(LOCAL_SDK_VERSION),)
Anton Hanssonf5f29aa2018-02-28 17:01:51 +000030 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
Anton Hansson7ff32d22018-02-21 15:29:44 +000037endif