xref: /aosp_15_r20/system/apex/tests/testdata/vendorapex/Android.bp (revision 33f3758387333dbd2962d7edbd98681940d895da)
1// Copyright (C) 2022 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
19apex_key {
20    name: "com.android.apex.vendor.foo.key",
21    public_key: "com.android.apex.vendor.foo.avbpubkey",
22    private_key: "com.android.apex.vendor.foo.pem",
23}
24
25android_app_certificate {
26    name: "com.android.apex.vendor.foo.certificate",
27    certificate: "com.android.apex.vendor.foo",
28}
29
30apex_defaults {
31    name: "com.android.apex.vendor.foo.defaults",
32    manifest: "manifest_v1.json",
33    file_contexts: "file_contexts",
34    key: "com.android.apex.vendor.foo.key",
35    certificate: ":com.android.apex.vendor.foo.certificate",
36    vendor: true,
37    updatable: false,
38    installable: false,
39}
40
41apex_test {
42    name: "com.android.apex.vendor.foo",
43    defaults: [
44        "com.android.apex.vendor.foo.defaults",
45    ],
46}
47
48apex_test {
49    name: "com.android.apex.vendor.bar",
50    defaults: [
51        "com.android.apex.vendor.foo.defaults",
52    ],
53    manifest: "manifest_bar_v1.json",
54}
55
56apex_test {
57    name: "com.android.apex.vendor.foo.v2",
58    defaults: [
59        "com.android.apex.vendor.foo.defaults",
60    ],
61    manifest: "manifest_v2.json",
62}
63
64apex_test {
65    name: "com.android.apex.vendor.foo.v2_with_requireNativeLibs",
66    defaults: [
67        "com.android.apex.vendor.foo.defaults",
68    ],
69    manifest: "manifest_v2.json",
70    binaries: [
71        "apex_vendor_foo_test_binary",
72    ],
73    skip_validations: {
74        apex_sepolicy_tests: true, // we don't have a valid label for the test binary
75    },
76}
77
78cc_binary {
79    name: "apex_vendor_foo_test_binary",
80    shared_libs: [
81        "libbinder_ndk", // will add "requireNativeLibs"
82    ],
83    srcs: [
84        "apex_vendor_foo_test_binary.cpp",
85    ],
86    vendor: true,
87    installable: false,
88}
89
90apex_test {
91    name: "com.android.apex.vendor.foo.apex.all.ready",
92    defaults: [
93        "com.android.apex.vendor.foo.defaults",
94    ],
95    prebuilts: [
96        "foo.apex.all.ready.rc",
97    ],
98}
99
100prebuilt_etc {
101    name: "foo.apex.all.ready.rc",
102    src: "foo.apex.all.ready.rc",
103}
104
105// Runs forever like /bin/yes
106cc_binary {
107    name: "apex_vendor_foo",
108    srcs: [
109        "apex_vendor_foo.cpp",
110    ],
111    vendor: true,
112    installable: false,
113}
114
115prebuilt_etc {
116    name: "apex_vendor_foo_v1.rc",
117    src: "apex_vendor_foo_v1.rc",
118}
119
120prebuilt_etc {
121    name: "apex_vendor_foo_v2.rc",
122    src: "apex_vendor_foo_v2.rc",
123}
124
125prebuilt_etc {
126    name: "apex_vendor_foo_v2.xml",
127    src: "apex_vendor_foo_v2.xml",
128    sub_dir: "vintf",
129    installable: false,
130}
131
132apex_test {
133    name: "com.android.apex.vendor.foo.v1_with_service",
134    defaults: [
135        "com.android.apex.vendor.foo.defaults",
136    ],
137    manifest: "manifest_v1.json",
138    binaries: [
139        "apex_vendor_foo",
140    ],
141    prebuilts: [
142        "apex_vendor_foo_v1.rc",
143    ],
144}
145
146apex_test {
147    name: "com.android.apex.vendor.foo.v2_with_service",
148    defaults: [
149        "com.android.apex.vendor.foo.defaults",
150    ],
151    manifest: "manifest_v2.json",
152    binaries: [
153        "apex_vendor_foo",
154    ],
155    prebuilts: [
156        "apex_vendor_foo_v2.rc",
157    ],
158}
159
160apex_test {
161    name: "com.android.apex.vendor.foo.v2_with_wrong_vndk_version",
162    defaults: [
163        "com.android.apex.vendor.foo.defaults",
164    ],
165    manifest: ":manifest_v2_with_wrong_vndk_version.json",
166}
167
168genrule {
169    name: "manifest_v2_with_wrong_vndk_version.json",
170    out: ["manifest_v2_with_wrong_vndk_version.json"],
171    srcs: ["manifest_v2.json"],
172    tools: ["jsonmodify"],
173    cmd: "$(location jsonmodify) -v vndkVersion WrongVndkVersion $(in) -o $(out)",
174}
175
176apex_test {
177    name: "com.android.apex.vendor.foo.with_vintf",
178    defaults: [
179        "com.android.apex.vendor.foo.defaults",
180    ],
181    manifest: "manifest_v2.json",
182    binaries: [
183        "apex_vendor_foo",
184    ],
185    prebuilts: [
186        "apex_vendor_foo_v2.rc",
187        "apex_vendor_foo_v2.xml",
188    ],
189}
190
191// Test apex conflicting with com.android.apex.vendor.foo.v2_with_vintf
192apex_test {
193    name: "com.android.apex.vendor.bar.v2_with_vintf",
194    defaults: [
195        "com.android.apex.vendor.foo.defaults",
196    ],
197    manifest: "manifest_bar_v2.json",
198    prebuilts: [
199        "apex_vendor_foo_v2.xml",
200    ],
201}
202
203// Test apex for updating com.android.hardware.wifi, with an
204//    updatable-via-apex value that doesn't match wifi's interface.
205apex_test {
206    name: "test.bad1.com.android.hardware.wifi",
207    manifest: "wifi_manifest_rebootless.json",
208    key: "com.android.hardware.key",
209    certificate: ":com.android.hardware.certificate",
210    file_contexts: "wifi_file_contexts",
211    updatable: false,
212    soc_specific: true,
213    installable: false,
214    prebuilts: [
215        "vintf_fragment_wifi_bad1.xml",
216        "com.android.hardware.wifi.rc",
217    ],
218}
219
220prebuilt_etc {
221    name: "vintf_fragment_wifi_bad1.xml",
222    src: "vintf_fragment_wifi_bad1.xml",
223    installable: false,
224    sub_dir: "vintf", // Puts fragment into etc/vintf
225}
226
227// Creates wifi test apex where its vintf fragment has invalid XML syntax
228//    (an unclosed tag)
229apex_test {
230    name: "test.bad2.com.android.hardware.wifi",
231    manifest: "wifi_manifest_rebootless.json",
232    key: "com.android.hardware.key",
233    certificate: ":com.android.hardware.certificate",
234    file_contexts: "wifi_file_contexts",
235    updatable: false,
236    soc_specific: true,
237    installable: false,
238    prebuilts: [
239        "vintf_fragment_wifi_bad2.xml",
240        "com.android.hardware.wifi.rc",
241    ],
242}
243
244prebuilt_etc {
245    name: "vintf_fragment_wifi_bad2.xml",
246    src: "vintf_fragment_wifi_bad2.xml",
247    installable: false,
248    sub_dir: "vintf",
249}
250
251// Test apex for updating com.android.hardware.wifi, with a
252//    good apex
253apex_test {
254    name: "test.good1.com.android.hardware.wifi",
255    manifest: "wifi_manifest_rebootless.json",
256    key: "com.android.hardware.key",
257    certificate: ":com.android.hardware.certificate",
258    file_contexts: "wifi_file_contexts",
259    updatable: false,
260    soc_specific: true,
261    installable: false,
262    prebuilts: [
263        "vintf_fragment_wifi_good1.xml",
264        "com.android.hardware.wifi.rc",
265    ],
266}
267
268prebuilt_etc {
269    name: "vintf_fragment_wifi_good1.xml",
270    src: "vintf_fragment_wifi_service.xml",
271    installable: false,
272    sub_dir: "vintf", // Puts fragment into etc/vintf
273}
274
275prebuilt_etc {
276    name: "apex_vendor_foo_bootstrap.rc",
277    src: "apex_vendor_foo_bootstrap.rc",
278    vendor: true,
279    installable: false,
280}
281
282apex_test {
283    name: "com.android.apex.vendor.foo.bootstrap",
284    defaults: [
285        "com.android.apex.vendor.foo.defaults",
286    ],
287    binaries: [
288        "apex_vendor_foo",
289    ],
290    prebuilts: [
291        "apex_vendor_foo_bootstrap.rc",
292    ],
293    manifest: "manifest_bootstrap.json",
294}
295