1// Copyright (C) 2020 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.
14package {
15    default_applicable_licenses: ["Android-Apache-2.0"],
16}
17
18apex_key {
19    name: "com.android.apex.test.bar.key",
20    public_key: "com.android.apex.test.bar.avbpubkey",
21    private_key: "com.android.apex.test.bar.pem",
22}
23
24android_app_certificate {
25    name: "com.android.apex.test.bar.certificate",
26    certificate: "com.android.apex.test.bar",
27}
28
29apex {
30    name: "com.android.apex.test.bar",
31    manifest: "manifest.json",
32    file_contexts: ":apex.test-file_contexts",
33    key: "com.android.apex.test.bar.key",
34    installable: false,
35    binaries: [ "bar_test" ],
36    dist: {
37        targets: ["sharedlibs_test"],
38    },
39    updatable: false,
40    compile_multilib: "both",
41    multilib: {
42        both: {
43            binaries: [
44                "bar_test",
45            ],
46        },
47    },
48}
49
50cc_binary {
51    name: "bar_test",
52    srcs: ["bar_test.cc"],
53    shared_libs: [
54      "libsharedlibtest",
55    ],
56    multilib: {
57        lib32: {
58            suffix: "32",
59        },
60        lib64: {
61            suffix: "64",
62        },
63    },
64
65    compile_multilib: "both",
66
67    apex_available: [ "com.android.apex.test.bar" ],
68}
69
70genrule {
71    name: "com.android.apex.test.bar_stripped",
72    out: ["com.android.apex.test.bar_stripped.apex"],
73    defaults: ["apexer_test_host_tools_list"],
74    dist: {
75        targets: ["sharedlibs_test"],
76    },
77    srcs: [
78        ":com.android.apex.test.bar",
79        "com.android.apex.test.bar.avbpubkey",
80        "com.android.apex.test.bar.pem",
81        "com.android.apex.test.bar.pk8",
82        "com.android.apex.test.bar.x509.pem",
83    ],
84    tools: [
85        "shared_libs_repack",
86    ],
87    cmd: "$(location shared_libs_repack) " +
88         " --mode strip" +
89         " --key $(location com.android.apex.test.bar.pem)" +
90         " --input $(location :com.android.apex.test.bar)" +
91         " --output $(genDir)/com.android.apex.test.bar_stripped.apex" +
92         " --pk8key $(location com.android.apex.test.bar.pk8)" +
93         " --pubkey $(location com.android.apex.test.bar.avbpubkey)" +
94         " --x509key $(location com.android.apex.test.bar.x509.pem)" +
95         " --tmpdir $(genDir)",
96}
97