1# Copyright (C) 2008 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# platform version check (b/32056228)
16# ============================================================
17include $(CLEAR_VARS)
18
19LOCAL_MODULE := cts-platform-version-check
20LOCAL_MODULE_CLASS := ETC
21LOCAL_MODULE_TAGS := optional
22LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
23# Tag this module as a cts test artifact
24LOCAL_COMPATIBILITY_SUITE := cts vts10 general-tests
25
26cts_platform_version_path := cts/tests/tests/os/assets/platform_versions.txt
27cts_platform_version_string := $(shell cat $(cts_platform_version_path))
28
29include $(BUILD_SYSTEM)/base_rules.mk
30
31$(LOCAL_BUILT_MODULE) : $(cts_platform_version_path) build/core/version_defaults.mk
32	$(hide) if [ -z "$(findstring $(PLATFORM_VERSION),$(cts_platform_version_string))" ]; then \
33		echo "============================================================" 1>&2; \
34		echo "Could not find version \"$(PLATFORM_VERSION)\" in CTS platform version file:" 1>&2; \
35		echo "" 1>&2; \
36		echo "	$(cts_platform_version_path)" 1>&2; \
37		echo "" 1>&2; \
38		echo "Most likely PLATFORM_VERSION in build/core/version_defaults.mk" 1>&2; \
39		echo "has changed and a new version must be added to this CTS file." 1>&2; \
40		echo "============================================================" 1>&2; \
41		exit 1; \
42	fi
43	@mkdir -p $(dir $@)
44	echo $(cts_platform_version_string) > $@
45