1// Copyright (C) 2024 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
16// Zip all the files in this directory together for merging into cts-verifier.zip.
17// build/envsetup.sh is used as a known file to get the location of the top of the
18// directory.
19package {
20    default_applicable_licenses: ["Android-Apache-2.0"],
21}
22
23filegroup {
24    name: "multidevice_apps_to_include",
25    srcs: [
26        ":NfcReaderTestApp",
27        ":NfcEmulatorTestApp",
28    ],
29}
30
31filegroup {
32    name: "multidevice_tests_to_include",
33    srcs: [
34        "nfc/*.py",
35    ],
36}
37
38genrule {
39    name: "multidevice-test-apps",
40    srcs: [
41        ":multidevice_apps_to_include",
42    ],
43    tools: ["soong_zip"],
44    out: ["multidevice-test-apps.zip"],
45    cmd: "echo $(locations :multidevice_apps_to_include) >$(genDir)/list && " +
46        "$(location soong_zip) -o $(out) -j -P android-cts-verifier/MultiDevice -l $(genDir)/list",
47}
48
49genrule {
50    name: "multidevice-test-list",
51    srcs: [
52        ":multidevice_tests_to_include",
53        // Placeholder file outside the glob used to find the top of the directory.
54        "build/envsetup.sh",
55    ],
56    tools: ["soong_zip"],
57    out: ["multidevice-test-list.zip"],
58    cmd: "echo $(locations :multidevice_tests_to_include) >$(genDir)/test_list && " +
59        "$(location soong_zip) -o $(out) -P android-cts-verifier/MultiDevice/tests -C $$(dirname $$(dirname $(location build/envsetup.sh))) -l $(genDir)/test_list",
60}
61
62genrule {
63    name: "multidevice-test",
64    srcs: [
65        "tools/*.py",
66        "utils/*.py",
67        "config.yml",
68        // Placeholder file outside the glob used to find the top of the directory.
69        "build/envsetup.sh",
70        ":multidevice-test-list",
71        ":multidevice-test-apps",
72    ],
73    tools: [
74        "soong_zip",
75        "merge_zips",
76    ],
77    out: ["multidevice-test.zip"],
78    cmd: "echo $(locations tools/*.py) $(locations utils/*.py) $(locations build/envsetup.sh) $(locations config.yml) >$(genDir)/list && " +
79        "$(location soong_zip) -o $(genDir)/multidevice-temp.zip -P android-cts-verifier/MultiDevice -C $$(dirname $$(dirname $(location build/envsetup.sh))) -l $(genDir)/list && " +
80        "$(location merge_zips) $(out) $(genDir)/multidevice-temp.zip $(location :multidevice-test-list) $(location :multidevice-test-apps)",
81}
82