1# Copyright (C) 2018 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# Package up a compatibility test suite in a zip file.
16#
17# Input variables:
18#   test_suite_name: the name of this test suite eg. cts
19#   test_suite_readme: the path to a README file for this test suite
20#   test_suite_prebuilt_tools: the set of prebuilt tools to be included directly
21#                         in the 'tools' subdirectory of the test suite.
22#   test_suite_tools: the set of tools for this test suite
23#
24# Output variables:
25#   compatibility_zip: the path to the output zip file.
26
27out_dir := $(HOST_OUT)/$(test_suite_name)/android-$(test_suite_name)
28test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
29test_tools := $(test_suite_readme)
30test_tools += $(test_suite_tools)
31
32compatibility_zip := $(out_dir).zip
33$(compatibility_zip): PRIVATE_NAME := android-$(test_suite_name)
34$(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir)
35$(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools)
36$(compatibility_zip): PRIVATE_SUITE_NAME := $(test_suite_name)
37$(compatibility_zip): $(test_artifacts) $(test_tools) $(test_suite_prebuilt_tools) $(SOONG_ZIP) | $(ADB) $(ACP)
38# Make dir structure
39	$(hide) mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases
40# Copy tools
41	$(hide) $(ACP) -fp $(PRIVATE_TOOLS) $(PRIVATE_OUT_DIR)/tools
42	$(hide) find $(dir $@)/$(PRIVATE_NAME) | sort >$@.list
43	$(hide) $(SOONG_ZIP) -d -o $@ -C $(dir $@) -l $@.list
44
45# Reset all input variables
46test_suite_name :=
47test_suite_dynamic_config :=
48test_suite_readme :=
49test_suite_prebuilt_tools :=
50test_suite_tools :=
51