blob: 6dab34654556fc9aea0dd9ff9063d895e5902cff [file] [log] [blame]
Jiyong Park641b6cc2018-01-15 14:48:40 +09001#
2# Copyright (C) 2018 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17ifdef BOARD_SYSTEMSDK_VERSIONS
18 # Apps and jars in vendor or odm partition are forced to build against System SDK.
19 _is_vendor_app :=
20 ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
21 # Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
22 # set correctly before this is included.
23 _is_vendor_app := true
24 endif
25 ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
26 ifndef LOCAL_SDK_VERSION
27 ifeq ($(_is_vendor_app),true)
28 LOCAL_SDK_VERSION := system_current
29 endif
30 endif
31 endif
32endif
33
34# Ensure that the selected System SDK version is one of the supported versions.
35# The range of support versions becomes narrower when BOARD_SYSTEMSDK_VERSIONS
36# is set, which is a subset of PLATFORM_SYSTEMSDK_VERSIONS.
37ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
38 ifneq ($(_is_vendor_app),true)
39 # apps bundled in system partition can use all system sdk versions provided by the platform
40 _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS)
41 else ifdef BOARD_SYSTEMSDK_VERSIONS
42 # When BOARD_SYSTEMSDK_VERSIONS is set, vendors apps are restricted to use those versions
43 # which is equal to or smaller than PLATFORM_SYSTEMSDK_VERSIONS
44 _supported_systemsdk_versions := $(BOARD_SYSTEMSDK_VERSIONS)
45 else
46 # If not, vendor apks are treated equally to system apps
47 _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS)
48 endif
49 _system_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
50 ifneq ($(_system_sdk_version),$(filter $(_system_sdk_version),$(_supported_systemsdk_versions)))
51 $(call pretty-error,Incompatible LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)'. \
52 System SDK version '$(_system_sdk_version)' is not supported. Supported versions are: $(_supported_systemsdk_versions))
53 endif
54 _system_sdk_version :=
55 _supported_systemsdk_versions :=
56endif