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
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19filegroup {
20    name: "sts-sdk-samples-srcs",
21    srcs: [
22        "package/**/*",
23    ],
24    exclude_srcs: [
25        "package/**/.*",
26    ],
27}
28
29genrule {
30    name: "sts-sdk-samples.zip-gen",
31    srcs: [
32        ":sts-sdk-samples-srcs",
33    ],
34    out: ["sts-sdk-samples.zip"],
35    tools: [
36        "soong_zip",
37    ],
38    product_variables: {
39        platform_sdk_version: {
40            cmd: "mkdir -p $(genDir)/tmp/ " +
41                "&& cp -rf platform_testing/libraries/sts-common-util/sts-sdk/package/* $(genDir)/tmp/" +
42                "&& mv $(genDir)/tmp/dotidea $(genDir)/tmp/.idea && " +
43                "for tmplfile in $$(find $(genDir)/tmp/ -type f -iname *.template); do " +
44                "  echo $${tmplfile}; " +
45                "  sed -i 's~{{PLATFORM_SDK_VERSION}}~%d~g' $${tmplfile}; " +
46                "  mv $${tmplfile} $${tmplfile/.template/}; " +
47                "done && " +
48                "$(location soong_zip) -o $(out) -C $(genDir)/tmp -D $(genDir)/tmp -D $(genDir)/tmp/.idea",
49        },
50    },
51}
52
53prebuilt_etc {
54    name: "sts-sdk-samples.zip",
55    src: ":sts-sdk-samples.zip-gen",
56}
57