blob: 3ed21dba0c23b7a044f4f5cc70c2b05b7e971552 [file] [log] [blame]
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -04001// Copyright 2021 Google Inc. All rights reserved.
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 bp2build
16
17import (
18 "android/soong/android"
19 "android/soong/apex"
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040020 "android/soong/cc"
21 "android/soong/java"
Jingwen Chenb07c9012021-12-08 10:05:45 +000022 "android/soong/sh"
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040023
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -040024 "testing"
25)
26
27func runApexTestCase(t *testing.T, tc bp2buildTestCase) {
28 t.Helper()
29 runBp2BuildTestCase(t, registerApexModuleTypes, tc)
30}
31
32func registerApexModuleTypes(ctx android.RegistrationContext) {
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040033 // CC module types needed as they can be APEX dependencies
34 cc.RegisterCCBuildComponents(ctx)
35
Jingwen Chenb07c9012021-12-08 10:05:45 +000036 ctx.RegisterModuleType("sh_binary", sh.ShBinaryFactory)
37 ctx.RegisterModuleType("cc_binary", cc.BinaryFactory)
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040038 ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
39 ctx.RegisterModuleType("apex_key", apex.ApexKeyFactory)
40 ctx.RegisterModuleType("android_app_certificate", java.AndroidAppCertificateFactory)
41 ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -040042}
43
Wei Li1c66fc72022-05-09 23:59:14 -070044func runOverrideApexTestCase(t *testing.T, tc bp2buildTestCase) {
45 t.Helper()
46 runBp2BuildTestCase(t, registerOverrideApexModuleTypes, tc)
47}
48
49func registerOverrideApexModuleTypes(ctx android.RegistrationContext) {
50 // CC module types needed as they can be APEX dependencies
51 cc.RegisterCCBuildComponents(ctx)
52
53 ctx.RegisterModuleType("sh_binary", sh.ShBinaryFactory)
54 ctx.RegisterModuleType("cc_binary", cc.BinaryFactory)
55 ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
56 ctx.RegisterModuleType("apex_key", apex.ApexKeyFactory)
57 ctx.RegisterModuleType("android_app_certificate", java.AndroidAppCertificateFactory)
58 ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
59 ctx.RegisterModuleType("apex", apex.BundleFactory)
60}
61
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -040062func TestApexBundleSimple(t *testing.T) {
63 runApexTestCase(t, bp2buildTestCase{
Wei Li1c66fc72022-05-09 23:59:14 -070064 description: "apex - example with all props, file_context is a module in same Android.bp",
Liz Kammerbe46fcc2021-11-01 15:32:43 -040065 moduleTypeUnderTest: "apex",
66 moduleTypeUnderTestFactory: apex.BundleFactory,
67 filesystem: map[string]string{},
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -040068 blueprint: `
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040069apex_key {
Jingwen Chenb07c9012021-12-08 10:05:45 +000070 name: "com.android.apogee.key",
71 public_key: "com.android.apogee.avbpubkey",
72 private_key: "com.android.apogee.pem",
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040073 bazel_module: { bp2build_available: false },
74}
75
76android_app_certificate {
Jingwen Chenb07c9012021-12-08 10:05:45 +000077 name: "com.android.apogee.certificate",
78 certificate: "com.android.apogee",
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040079 bazel_module: { bp2build_available: false },
80}
81
82cc_library {
Jingwen Chenb07c9012021-12-08 10:05:45 +000083 name: "native_shared_lib_1",
84 bazel_module: { bp2build_available: false },
85}
86
87cc_library {
88 name: "native_shared_lib_2",
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -040089 bazel_module: { bp2build_available: false },
90}
91
Rupert Shuttleworth9447e1e2021-07-28 05:53:42 -040092cc_library {
Jingwen Chenb07c9012021-12-08 10:05:45 +000093 name: "pretend_prebuilt_1",
94 bazel_module: { bp2build_available: false },
Rupert Shuttleworth9447e1e2021-07-28 05:53:42 -040095}
96
Rupert Shuttleworth9447e1e2021-07-28 05:53:42 -040097cc_library {
Jingwen Chenb07c9012021-12-08 10:05:45 +000098 name: "pretend_prebuilt_2",
99 bazel_module: { bp2build_available: false },
Rupert Shuttleworth9447e1e2021-07-28 05:53:42 -0400100}
101
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400102filegroup {
103 name: "com.android.apogee-file_contexts",
Jingwen Chenb07c9012021-12-08 10:05:45 +0000104 srcs: [
Wei Li1c66fc72022-05-09 23:59:14 -0700105 "com.android.apogee-file_contexts",
Jingwen Chenb07c9012021-12-08 10:05:45 +0000106 ],
107 bazel_module: { bp2build_available: false },
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400108}
109
Jingwen Chenb07c9012021-12-08 10:05:45 +0000110cc_binary { name: "cc_binary_1", bazel_module: { bp2build_available: false } }
111sh_binary { name: "sh_binary_2", bazel_module: { bp2build_available: false } }
112
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -0400113apex {
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400114 name: "com.android.apogee",
115 manifest: "apogee_manifest.json",
116 androidManifest: "ApogeeAndroidManifest.xml",
Wei Li1c66fc72022-05-09 23:59:14 -0700117 file_contexts: ":com.android.apogee-file_contexts",
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400118 min_sdk_version: "29",
119 key: "com.android.apogee.key",
120 certificate: "com.android.apogee.certificate",
121 updatable: false,
122 installable: false,
Wei Lif034cb42022-01-19 15:54:31 -0800123 compressible: false,
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400124 native_shared_libs: [
125 "native_shared_lib_1",
126 "native_shared_lib_2",
127 ],
128 binaries: [
Jingwen Chenb07c9012021-12-08 10:05:45 +0000129 "cc_binary_1",
130 "sh_binary_2",
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400131 ],
Rupert Shuttleworth9447e1e2021-07-28 05:53:42 -0400132 prebuilts: [
133 "pretend_prebuilt_1",
134 "pretend_prebuilt_2",
135 ],
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -0400136}
137`,
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500138 expectedBazelTargets: []string{
139 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
140 "android_manifest": `"ApogeeAndroidManifest.xml"`,
141 "binaries": `[
Jingwen Chenb07c9012021-12-08 10:05:45 +0000142 ":cc_binary_1",
143 ":sh_binary_2",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500144 ]`,
145 "certificate": `":com.android.apogee.certificate"`,
146 "file_contexts": `":com.android.apogee-file_contexts"`,
147 "installable": "False",
148 "key": `":com.android.apogee.key"`,
149 "manifest": `"apogee_manifest.json"`,
150 "min_sdk_version": `"29"`,
Yu Liu4ae55d12022-01-05 17:17:23 -0800151 "native_shared_libs_32": `[
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400152 ":native_shared_lib_1",
153 ":native_shared_lib_2",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500154 ]`,
Yu Liu4ae55d12022-01-05 17:17:23 -0800155 "native_shared_libs_64": `select({
156 "//build/bazel/platforms/arch:arm64": [
157 ":native_shared_lib_1",
158 ":native_shared_lib_2",
159 ],
160 "//build/bazel/platforms/arch:x86_64": [
161 ":native_shared_lib_1",
162 ":native_shared_lib_2",
163 ],
164 "//conditions:default": [],
165 })`,
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500166 "prebuilts": `[
Rupert Shuttleworth9447e1e2021-07-28 05:53:42 -0400167 ":pretend_prebuilt_1",
168 ":pretend_prebuilt_2",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500169 ]`,
Wei Lif034cb42022-01-19 15:54:31 -0800170 "updatable": "False",
171 "compressible": "False",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500172 }),
173 }})
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400174}
175
Wei Li1c66fc72022-05-09 23:59:14 -0700176func TestApexBundleSimple_fileContextsInAnotherAndroidBp(t *testing.T) {
177 runApexTestCase(t, bp2buildTestCase{
178 description: "apex - file contexts is a module in another Android.bp",
179 moduleTypeUnderTest: "apex",
180 moduleTypeUnderTestFactory: apex.BundleFactory,
181 filesystem: map[string]string{
182 "a/b/Android.bp": `
183filegroup {
184 name: "com.android.apogee-file_contexts",
185 srcs: [
186 "com.android.apogee-file_contexts",
187 ],
188 bazel_module: { bp2build_available: false },
189}
190`,
191 },
192 blueprint: `
193apex {
194 name: "com.android.apogee",
195 file_contexts: ":com.android.apogee-file_contexts",
196}
197`,
198 expectedBazelTargets: []string{
199 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
200 "file_contexts": `"//a/b:com.android.apogee-file_contexts"`,
201 }),
202 }})
203}
204
205func TestApexBundleSimple_fileContextsIsFile(t *testing.T) {
206 runApexTestCase(t, bp2buildTestCase{
207 description: "apex - file contexts is a file",
208 moduleTypeUnderTest: "apex",
209 moduleTypeUnderTestFactory: apex.BundleFactory,
210 filesystem: map[string]string{},
211 blueprint: `
212apex {
213 name: "com.android.apogee",
214 file_contexts: "file_contexts_file",
215}
216`,
217 expectedBazelTargets: []string{
218 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
219 "file_contexts": `"file_contexts_file"`,
220 }),
221 }})
222}
223
224func TestApexBundleSimple_fileContextsIsNotSpecified(t *testing.T) {
225 runApexTestCase(t, bp2buildTestCase{
226 description: "apex - file contexts is not specified",
227 moduleTypeUnderTest: "apex",
228 moduleTypeUnderTestFactory: apex.BundleFactory,
229 filesystem: map[string]string{
230 "system/sepolicy/apex/Android.bp": `
231filegroup {
232 name: "com.android.apogee-file_contexts",
233 srcs: [
234 "com.android.apogee-file_contexts",
235 ],
236 bazel_module: { bp2build_available: false },
237}
238`,
239 },
240 blueprint: `
241apex {
242 name: "com.android.apogee",
243}
244`,
245 expectedBazelTargets: []string{
246 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
247 "file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
248 }),
249 }})
250}
251
Yu Liu4ae55d12022-01-05 17:17:23 -0800252func TestApexBundleCompileMultilibBoth(t *testing.T) {
253 runApexTestCase(t, bp2buildTestCase{
254 description: "apex - example with compile_multilib=both",
255 moduleTypeUnderTest: "apex",
256 moduleTypeUnderTestFactory: apex.BundleFactory,
Wei Li1c66fc72022-05-09 23:59:14 -0700257 filesystem: map[string]string{
258 "system/sepolicy/apex/Android.bp": `
259filegroup {
260 name: "com.android.apogee-file_contexts",
261 srcs: [ "apogee-file_contexts", ],
262 bazel_module: { bp2build_available: false },
263}
264`,
265 },
266 blueprint: createMultilibBlueprint("both"),
Yu Liu4ae55d12022-01-05 17:17:23 -0800267 expectedBazelTargets: []string{
268 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
269 "native_shared_libs_32": `[
270 ":native_shared_lib_1",
271 ":native_shared_lib_3",
272 ] + select({
273 "//build/bazel/platforms/arch:arm": [":native_shared_lib_2"],
274 "//build/bazel/platforms/arch:x86": [":native_shared_lib_2"],
275 "//conditions:default": [],
276 })`,
277 "native_shared_libs_64": `select({
278 "//build/bazel/platforms/arch:arm64": [
279 ":native_shared_lib_1",
280 ":native_shared_lib_4",
281 ":native_shared_lib_2",
282 ],
283 "//build/bazel/platforms/arch:x86_64": [
284 ":native_shared_lib_1",
285 ":native_shared_lib_4",
286 ":native_shared_lib_2",
287 ],
288 "//conditions:default": [],
289 })`,
Wei Li1c66fc72022-05-09 23:59:14 -0700290 "file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
Yu Liu4ae55d12022-01-05 17:17:23 -0800291 }),
292 }})
293}
294
295func TestApexBundleCompileMultilibFirst(t *testing.T) {
296 runApexTestCase(t, bp2buildTestCase{
297 description: "apex - example with compile_multilib=first",
298 moduleTypeUnderTest: "apex",
299 moduleTypeUnderTestFactory: apex.BundleFactory,
Wei Li1c66fc72022-05-09 23:59:14 -0700300 filesystem: map[string]string{
301 "system/sepolicy/apex/Android.bp": `
302filegroup {
303 name: "com.android.apogee-file_contexts",
304 srcs: [ "apogee-file_contexts", ],
305 bazel_module: { bp2build_available: false },
306}
307`,
308 },
309 blueprint: createMultilibBlueprint("first"),
Yu Liu4ae55d12022-01-05 17:17:23 -0800310 expectedBazelTargets: []string{
311 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
312 "native_shared_libs_32": `select({
313 "//build/bazel/platforms/arch:arm": [
314 ":native_shared_lib_1",
315 ":native_shared_lib_3",
316 ":native_shared_lib_2",
317 ],
318 "//build/bazel/platforms/arch:x86": [
319 ":native_shared_lib_1",
320 ":native_shared_lib_3",
321 ":native_shared_lib_2",
322 ],
323 "//conditions:default": [],
324 })`,
325 "native_shared_libs_64": `select({
326 "//build/bazel/platforms/arch:arm64": [
327 ":native_shared_lib_1",
328 ":native_shared_lib_4",
329 ":native_shared_lib_2",
330 ],
331 "//build/bazel/platforms/arch:x86_64": [
332 ":native_shared_lib_1",
333 ":native_shared_lib_4",
334 ":native_shared_lib_2",
335 ],
336 "//conditions:default": [],
337 })`,
Wei Li1c66fc72022-05-09 23:59:14 -0700338 "file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
Yu Liu4ae55d12022-01-05 17:17:23 -0800339 }),
340 }})
341}
342
343func TestApexBundleCompileMultilib32(t *testing.T) {
344 runApexTestCase(t, bp2buildTestCase{
345 description: "apex - example with compile_multilib=32",
346 moduleTypeUnderTest: "apex",
347 moduleTypeUnderTestFactory: apex.BundleFactory,
Wei Li1c66fc72022-05-09 23:59:14 -0700348 filesystem: map[string]string{
349 "system/sepolicy/apex/Android.bp": `
350filegroup {
351 name: "com.android.apogee-file_contexts",
352 srcs: [ "apogee-file_contexts", ],
353 bazel_module: { bp2build_available: false },
354}
355`,
356 },
357 blueprint: createMultilibBlueprint("32"),
Yu Liu4ae55d12022-01-05 17:17:23 -0800358 expectedBazelTargets: []string{
359 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
360 "native_shared_libs_32": `[
361 ":native_shared_lib_1",
362 ":native_shared_lib_3",
363 ] + select({
364 "//build/bazel/platforms/arch:arm": [":native_shared_lib_2"],
365 "//build/bazel/platforms/arch:x86": [":native_shared_lib_2"],
366 "//conditions:default": [],
367 })`,
Wei Li1c66fc72022-05-09 23:59:14 -0700368 "file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
Yu Liu4ae55d12022-01-05 17:17:23 -0800369 }),
370 }})
371}
372
373func TestApexBundleCompileMultilib64(t *testing.T) {
374 runApexTestCase(t, bp2buildTestCase{
375 description: "apex - example with compile_multilib=64",
376 moduleTypeUnderTest: "apex",
377 moduleTypeUnderTestFactory: apex.BundleFactory,
Wei Li1c66fc72022-05-09 23:59:14 -0700378 filesystem: map[string]string{
379 "system/sepolicy/apex/Android.bp": `
380filegroup {
381 name: "com.android.apogee-file_contexts",
382 srcs: [ "apogee-file_contexts", ],
383 bazel_module: { bp2build_available: false },
384}
385`,
386 },
387 blueprint: createMultilibBlueprint("64"),
Yu Liu4ae55d12022-01-05 17:17:23 -0800388 expectedBazelTargets: []string{
389 makeBazelTarget("apex", "com.android.apogee", attrNameToString{
390 "native_shared_libs_64": `select({
391 "//build/bazel/platforms/arch:arm64": [
392 ":native_shared_lib_1",
393 ":native_shared_lib_4",
394 ":native_shared_lib_2",
395 ],
396 "//build/bazel/platforms/arch:x86_64": [
397 ":native_shared_lib_1",
398 ":native_shared_lib_4",
399 ":native_shared_lib_2",
400 ],
401 "//conditions:default": [],
402 })`,
Wei Li1c66fc72022-05-09 23:59:14 -0700403 "file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
Yu Liu4ae55d12022-01-05 17:17:23 -0800404 }),
405 }})
406}
407
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400408func TestApexBundleDefaultPropertyValues(t *testing.T) {
409 runApexTestCase(t, bp2buildTestCase{
Liz Kammerbe46fcc2021-11-01 15:32:43 -0400410 description: "apex - default property values",
411 moduleTypeUnderTest: "apex",
412 moduleTypeUnderTestFactory: apex.BundleFactory,
Wei Li1c66fc72022-05-09 23:59:14 -0700413 filesystem: map[string]string{
414 "system/sepolicy/apex/Android.bp": `
415filegroup {
416 name: "com.android.apogee-file_contexts",
417 srcs: [ "apogee-file_contexts", ],
418 bazel_module: { bp2build_available: false },
419}
420`,
421 },
Rupert Shuttleworth6e4950a2021-07-27 01:34:59 -0400422 blueprint: `
423apex {
424 name: "com.android.apogee",
425 manifest: "apogee_manifest.json",
426}
427`,
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500428 expectedBazelTargets: []string{makeBazelTarget("apex", "com.android.apogee", attrNameToString{
Wei Li1c66fc72022-05-09 23:59:14 -0700429 "manifest": `"apogee_manifest.json"`,
430 "file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500431 }),
432 }})
Rupert Shuttlewortha9d76dd2021-07-02 07:17:16 -0400433}
Jingwen Chenf59a8e12021-07-16 09:28:53 +0000434
435func TestApexBundleHasBazelModuleProps(t *testing.T) {
436 runApexTestCase(t, bp2buildTestCase{
Liz Kammerbe46fcc2021-11-01 15:32:43 -0400437 description: "apex - has bazel module props",
438 moduleTypeUnderTest: "apex",
439 moduleTypeUnderTestFactory: apex.BundleFactory,
Wei Li1c66fc72022-05-09 23:59:14 -0700440 filesystem: map[string]string{
441 "system/sepolicy/apex/Android.bp": `
442filegroup {
443 name: "apogee-file_contexts",
444 srcs: [ "apogee-file_contexts", ],
445 bazel_module: { bp2build_available: false },
446}
447`,
448 },
Jingwen Chenf59a8e12021-07-16 09:28:53 +0000449 blueprint: `
450apex {
451 name: "apogee",
452 manifest: "manifest.json",
453 bazel_module: { bp2build_available: true },
454}
455`,
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500456 expectedBazelTargets: []string{makeBazelTarget("apex", "apogee", attrNameToString{
Wei Li1c66fc72022-05-09 23:59:14 -0700457 "manifest": `"manifest.json"`,
458 "file_contexts": `"//system/sepolicy/apex:apogee-file_contexts"`,
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500459 }),
460 }})
Jingwen Chenf59a8e12021-07-16 09:28:53 +0000461}
Yu Liu4ae55d12022-01-05 17:17:23 -0800462
463func createMultilibBlueprint(compile_multilib string) string {
464 return `
465cc_library {
466 name: "native_shared_lib_1",
467 bazel_module: { bp2build_available: false },
468}
469
470cc_library {
471 name: "native_shared_lib_2",
472 bazel_module: { bp2build_available: false },
473}
474
475cc_library {
476 name: "native_shared_lib_3",
477 bazel_module: { bp2build_available: false },
478}
479
480cc_library {
481 name: "native_shared_lib_4",
482 bazel_module: { bp2build_available: false },
483}
484
485apex {
486 name: "com.android.apogee",
487 compile_multilib: "` + compile_multilib + `",
488 multilib: {
489 both: {
490 native_shared_libs: [
491 "native_shared_lib_1",
492 ],
493 },
494 first: {
495 native_shared_libs: [
496 "native_shared_lib_2",
497 ],
498 },
499 lib32: {
500 native_shared_libs: [
501 "native_shared_lib_3",
502 ],
503 },
504 lib64: {
505 native_shared_libs: [
506 "native_shared_lib_4",
507 ],
508 },
509 },
510}`
511}
Wei Li1c66fc72022-05-09 23:59:14 -0700512
513func TestBp2BuildOverrideApex(t *testing.T) {
514 runOverrideApexTestCase(t, bp2buildTestCase{
515 description: "override_apex",
516 moduleTypeUnderTest: "override_apex",
517 moduleTypeUnderTestFactory: apex.OverrideApexFactory,
518 filesystem: map[string]string{},
519 blueprint: `
520apex_key {
521 name: "com.android.apogee.key",
522 public_key: "com.android.apogee.avbpubkey",
523 private_key: "com.android.apogee.pem",
524 bazel_module: { bp2build_available: false },
525}
526
527android_app_certificate {
528 name: "com.android.apogee.certificate",
529 certificate: "com.android.apogee",
530 bazel_module: { bp2build_available: false },
531}
532
533cc_library {
534 name: "native_shared_lib_1",
535 bazel_module: { bp2build_available: false },
536}
537
538cc_library {
539 name: "native_shared_lib_2",
540 bazel_module: { bp2build_available: false },
541}
542
543cc_library {
544 name: "pretend_prebuilt_1",
545 bazel_module: { bp2build_available: false },
546}
547
548cc_library {
549 name: "pretend_prebuilt_2",
550 bazel_module: { bp2build_available: false },
551}
552
553filegroup {
554 name: "com.android.apogee-file_contexts",
555 srcs: [
556 "com.android.apogee-file_contexts",
557 ],
558 bazel_module: { bp2build_available: false },
559}
560
561cc_binary { name: "cc_binary_1", bazel_module: { bp2build_available: false } }
562sh_binary { name: "sh_binary_2", bazel_module: { bp2build_available: false } }
563
564apex {
565 name: "com.android.apogee",
566 manifest: "apogee_manifest.json",
567 androidManifest: "ApogeeAndroidManifest.xml",
568 file_contexts: ":com.android.apogee-file_contexts",
569 min_sdk_version: "29",
570 key: "com.android.apogee.key",
571 certificate: "com.android.apogee.certificate",
572 updatable: false,
573 installable: false,
574 compressible: false,
575 native_shared_libs: [
576 "native_shared_lib_1",
577 "native_shared_lib_2",
578 ],
579 binaries: [
580 "cc_binary_1",
581 "sh_binary_2",
582 ],
583 prebuilts: [
584 "pretend_prebuilt_1",
585 "pretend_prebuilt_2",
586 ],
587 bazel_module: { bp2build_available: false },
588}
589
590apex_key {
591 name: "com.google.android.apogee.key",
592 public_key: "com.google.android.apogee.avbpubkey",
593 private_key: "com.google.android.apogee.pem",
594 bazel_module: { bp2build_available: false },
595}
596
597android_app_certificate {
598 name: "com.google.android.apogee.certificate",
599 certificate: "com.google.android.apogee",
600 bazel_module: { bp2build_available: false },
601}
602
603override_apex {
604 name: "com.google.android.apogee",
605 base: ":com.android.apogee",
606 key: "com.google.android.apogee.key",
607 certificate: "com.google.android.apogee.certificate",
608 prebuilts: [],
609 compressible: true,
610}
611`,
612 expectedBazelTargets: []string{
613 makeBazelTarget("apex", "com.google.android.apogee", attrNameToString{
614 "android_manifest": `"ApogeeAndroidManifest.xml"`,
615 "binaries": `[
616 ":cc_binary_1",
617 ":sh_binary_2",
618 ]`,
619 "certificate": `":com.google.android.apogee.certificate"`,
620 "file_contexts": `":com.android.apogee-file_contexts"`,
621 "installable": "False",
622 "key": `":com.google.android.apogee.key"`,
623 "manifest": `"apogee_manifest.json"`,
624 "min_sdk_version": `"29"`,
625 "native_shared_libs_32": `[
626 ":native_shared_lib_1",
627 ":native_shared_lib_2",
628 ]`,
629 "native_shared_libs_64": `select({
630 "//build/bazel/platforms/arch:arm64": [
631 ":native_shared_lib_1",
632 ":native_shared_lib_2",
633 ],
634 "//build/bazel/platforms/arch:x86_64": [
635 ":native_shared_lib_1",
636 ":native_shared_lib_2",
637 ],
638 "//conditions:default": [],
639 })`,
640 "prebuilts": `[]`,
641 "updatable": "False",
642 "compressible": "True",
643 }),
644 }})
645}