• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Copyright (C) 2022 The Android Open Source Project
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15"""
16
17def apex_compression_test(name, apex, compressed, **kwargs):
18    """This verifies APEX or compressed APEX file:
19        1) has the correct file extension name
20        2) contains the required files specified by the APEX file format
21    """
22
23    native.sh_library(
24        name = name + "_wrapper_sh_lib",
25        data = [apex],
26    )
27
28    args = ["$(location " + apex + ")"]
29    if compressed:
30        args.append("compressed")
31
32    native.sh_test(
33        name = name,
34        srcs = ["apex_test.sh"],
35        deps = ["@bazel_tools//tools/bash/runfiles"],
36        data = [
37            ":" + name + "_wrapper_sh_lib",
38            "@bazel_tools//tools/zip:zipper",
39            apex,
40        ],
41        args = args,
42    )
43