1# Copyright (C) 2015 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_tradefed: the name of this test suite's tradefed wrapper
20#   test_suite_dynamic_config: the path to this test suite's dynamic configuration file
21#   test_suite_readme: the path to a README file for this test suite
22#   test_suite_prebuilt_tools: the set of prebuilt tools to be included directly
23#                         in the 'tools' subdirectory of the test suite.
24#   test_suite_tools: the set of tools for this test suite
25#
26# Output variables:
27#   compatibility_zip: the path to the output zip file.
28
29out_dir := $(HOST_OUT)/$(test_suite_name)/android-$(test_suite_name)
30test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
31test_tools := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar \
32  $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \
33  $(HOST_OUT_JAVA_LIBRARIES)/tradefed-no-fwk.jar \
34  $(HOST_OUT_JAVA_LIBRARIES)/tradefed-test-framework.jar \
35  $(HOST_OUT_JAVA_LIBRARIES)/loganalysis.jar \
36  $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
37  $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util-tests.jar \
38  $(HOST_OUT_JAVA_LIBRARIES)/compatibility-common-util-tests.jar \
39  $(HOST_OUT_JAVA_LIBRARIES)/compatibility-tradefed-tests.jar \
40  $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed).jar \
41  $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed)-tests.jar \
42  $(HOST_OUT_EXECUTABLES)/$(test_suite_tradefed) \
43  $(test_suite_readme)
44
45test_tools += $(test_suite_tools)
46
47# Include host shared libraries
48host_shared_libs := $(call copy-many-files, $(COMPATIBILITY.$(test_suite_name).HOST_SHARED_LIBRARY.FILES))
49
50compatibility_zip := $(out_dir).zip
51$(compatibility_zip): PRIVATE_NAME := android-$(test_suite_name)
52$(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir)
53$(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools)
54$(compatibility_zip): PRIVATE_SUITE_NAME := $(test_suite_name)
55$(compatibility_zip): PRIVATE_DYNAMIC_CONFIG := $(test_suite_dynamic_config)
56$(compatibility_zip): $(test_artifacts) $(test_tools) $(test_suite_prebuilt_tools) $(test_suite_dynamic_config) $(SOONG_ZIP) $(host_shared_libs) | $(ADB) $(ACP)
57# Make dir structure
58	$(hide) mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases
59	$(hide) echo $(BUILD_NUMBER_FROM_FILE) > $(PRIVATE_OUT_DIR)/tools/version.txt
60# Copy tools
61	$(hide) cp $(PRIVATE_TOOLS) $(PRIVATE_OUT_DIR)/tools
62	$(if $(PRIVATE_DYNAMIC_CONFIG),$(hide) cp $(PRIVATE_DYNAMIC_CONFIG) $(PRIVATE_OUT_DIR)/testcases/$(PRIVATE_SUITE_NAME).dynamic)
63	$(hide) find $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases | sort >$@.list
64	$(hide) $(SOONG_ZIP) -d -o $@ -C $(dir $@) -l $@.list
65
66# Reset all input variables
67test_suite_name :=
68test_suite_tradefed :=
69test_suite_dynamic_config :=
70test_suite_readme :=
71test_suite_prebuilt_tools :=
72test_suite_tools :=
73host_shared_libs :=
74