blob: 79d3c26e31fe6d113457e1a8b6f2c4c5b2237083 [file] [log] [blame]
Paul Duffina80fdec2019-12-03 15:25:00 +00001// Copyright (C) 2019 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 sdk
16
17import (
18 "testing"
19)
20
Paul Duffind835daa2019-11-30 17:49:09 +000021func testSdkWithJava(t *testing.T, bp string) *testSdkResult {
22 t.Helper()
23
24 fs := map[string][]byte{
25 "Test.java": nil,
26 "aidl/foo/bar/Test.aidl": nil,
27 }
28 return testSdkWithFs(t, bp, fs)
29}
30
Paul Duffina80fdec2019-12-03 15:25:00 +000031// Contains tests for SDK members provided by the java package.
32
33func TestBasicSdkWithJavaLibrary(t *testing.T) {
Paul Duffind835daa2019-11-30 17:49:09 +000034 result := testSdkWithJava(t, `
Paul Duffina80fdec2019-12-03 15:25:00 +000035 sdk {
36 name: "mysdk",
Jiyong Park0f80c182020-01-31 02:49:53 +090037 java_header_libs: ["sdkmember"],
Paul Duffina80fdec2019-12-03 15:25:00 +000038 }
39
40 sdk_snapshot {
41 name: "mysdk@1",
Paul Duffina0dbf432019-12-05 11:25:53 +000042 java_header_libs: ["sdkmember_mysdk_1"],
Paul Duffina80fdec2019-12-03 15:25:00 +000043 }
44
45 sdk_snapshot {
46 name: "mysdk@2",
Paul Duffina0dbf432019-12-05 11:25:53 +000047 java_header_libs: ["sdkmember_mysdk_2"],
Paul Duffina80fdec2019-12-03 15:25:00 +000048 }
49
Jiyong Park0f80c182020-01-31 02:49:53 +090050 java_library {
Paul Duffina80fdec2019-12-03 15:25:00 +000051 name: "sdkmember",
Jiyong Park0f80c182020-01-31 02:49:53 +090052 srcs: ["Test.java"],
53 system_modules: "none",
54 sdk_version: "none",
Paul Duffina80fdec2019-12-03 15:25:00 +000055 host_supported: true,
Jiyong Park0f80c182020-01-31 02:49:53 +090056 apex_available: [
57 "//apex_available:platform",
58 "//apex_available:anyapex",
59 ],
Paul Duffina80fdec2019-12-03 15:25:00 +000060 }
61
62 java_import {
63 name: "sdkmember_mysdk_1",
64 sdk_member_name: "sdkmember",
65 host_supported: true,
Jiyong Park0f80c182020-01-31 02:49:53 +090066 apex_available: [
67 "//apex_available:platform",
68 "//apex_available:anyapex",
69 ],
Paul Duffina80fdec2019-12-03 15:25:00 +000070 }
71
72 java_import {
73 name: "sdkmember_mysdk_2",
74 sdk_member_name: "sdkmember",
75 host_supported: true,
Jiyong Park0f80c182020-01-31 02:49:53 +090076 apex_available: [
77 "//apex_available:platform",
78 "//apex_available:anyapex",
79 ],
Paul Duffina80fdec2019-12-03 15:25:00 +000080 }
81
82 java_library {
83 name: "myjavalib",
84 srcs: ["Test.java"],
85 libs: ["sdkmember"],
86 system_modules: "none",
87 sdk_version: "none",
88 compile_dex: true,
89 host_supported: true,
Anton Hanssoneec79eb2020-01-10 15:12:39 +000090 apex_available: [
91 "myapex",
92 "myapex2",
93 ],
Paul Duffina80fdec2019-12-03 15:25:00 +000094 }
95
96 apex {
97 name: "myapex",
98 java_libs: ["myjavalib"],
99 uses_sdks: ["mysdk@1"],
100 key: "myapex.key",
101 certificate: ":myapex.cert",
102 }
103
104 apex {
105 name: "myapex2",
106 java_libs: ["myjavalib"],
107 uses_sdks: ["mysdk@2"],
108 key: "myapex.key",
109 certificate: ":myapex.cert",
110 }
111 `)
112
113 sdkMemberV1 := result.ctx.ModuleForTests("sdkmember_mysdk_1", "android_common_myapex").Rule("combineJar").Output
114 sdkMemberV2 := result.ctx.ModuleForTests("sdkmember_mysdk_2", "android_common_myapex2").Rule("combineJar").Output
115
116 javalibForMyApex := result.ctx.ModuleForTests("myjavalib", "android_common_myapex")
117 javalibForMyApex2 := result.ctx.ModuleForTests("myjavalib", "android_common_myapex2")
118
119 // Depending on the uses_sdks value, different libs are linked
120 ensureListContains(t, pathsToStrings(javalibForMyApex.Rule("javac").Implicits), sdkMemberV1.String())
121 ensureListContains(t, pathsToStrings(javalibForMyApex2.Rule("javac").Implicits), sdkMemberV2.String())
122}
123
Paul Duffina0dbf432019-12-05 11:25:53 +0000124func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
125 result := testSdkWithJava(t, `
126 sdk {
127 name: "mysdk",
128 java_header_libs: ["myjavalib"],
129 }
130
131 java_library {
132 name: "myjavalib",
133 srcs: ["Test.java"],
134 aidl: {
135 export_include_dirs: ["aidl"],
136 },
137 system_modules: "none",
138 sdk_version: "none",
139 compile_dex: true,
140 host_supported: true,
141 }
142 `)
143
Paul Duffin593b3c92019-12-05 14:31:48 +0000144 result.CheckSnapshot("mysdk", "android_common", "",
Paul Duffina0dbf432019-12-05 11:25:53 +0000145 checkAndroidBpContents(`
146// This is auto-generated. DO NOT EDIT.
147
148java_import {
149 name: "mysdk_myjavalib@current",
150 sdk_member_name: "myjavalib",
151 jars: ["java/myjavalib.jar"],
152}
153
154java_import {
155 name: "myjavalib",
156 prefer: false,
157 jars: ["java/myjavalib.jar"],
158}
159
160sdk_snapshot {
161 name: "mysdk@current",
162 java_header_libs: ["mysdk_myjavalib@current"],
163}
164
165`),
166 checkAllCopyRules(`
167.intermediates/myjavalib/android_common/turbine-combined/myjavalib.jar -> java/myjavalib.jar
168aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
169`),
170 )
171}
172
173func TestHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
174 // b/145598135 - Generating host snapshots for anything other than linux is not supported.
175 SkipIfNotLinux(t)
176
177 result := testSdkWithJava(t, `
178 sdk {
179 name: "mysdk",
180 device_supported: false,
181 host_supported: true,
182 java_header_libs: ["myjavalib"],
183 }
184
185 java_library {
186 name: "myjavalib",
187 device_supported: false,
188 host_supported: true,
189 srcs: ["Test.java"],
190 aidl: {
191 export_include_dirs: ["aidl"],
192 },
193 system_modules: "none",
194 sdk_version: "none",
195 compile_dex: true,
196 }
197 `)
198
Paul Duffin593b3c92019-12-05 14:31:48 +0000199 result.CheckSnapshot("mysdk", "linux_glibc_common", "",
Paul Duffina0dbf432019-12-05 11:25:53 +0000200 checkAndroidBpContents(`
201// This is auto-generated. DO NOT EDIT.
202
203java_import {
204 name: "mysdk_myjavalib@current",
205 sdk_member_name: "myjavalib",
206 device_supported: false,
207 host_supported: true,
208 jars: ["java/myjavalib.jar"],
209}
210
211java_import {
212 name: "myjavalib",
213 prefer: false,
214 device_supported: false,
215 host_supported: true,
216 jars: ["java/myjavalib.jar"],
217}
218
219sdk_snapshot {
220 name: "mysdk@current",
221 device_supported: false,
222 host_supported: true,
223 java_header_libs: ["mysdk_myjavalib@current"],
224}
225`),
226 checkAllCopyRules(`
227.intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/myjavalib.jar
228aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
229`),
230 )
231}
232
233func TestSnapshotWithJavaImplLibrary(t *testing.T) {
Paul Duffind835daa2019-11-30 17:49:09 +0000234 result := testSdkWithJava(t, `
Paul Duffine6029182019-12-16 17:43:48 +0000235 module_exports {
236 name: "myexports",
Paul Duffina80fdec2019-12-03 15:25:00 +0000237 java_libs: ["myjavalib"],
238 }
239
240 java_library {
241 name: "myjavalib",
242 srcs: ["Test.java"],
243 aidl: {
244 export_include_dirs: ["aidl"],
245 },
246 system_modules: "none",
247 sdk_version: "none",
248 compile_dex: true,
249 host_supported: true,
250 }
251 `)
252
Paul Duffine6029182019-12-16 17:43:48 +0000253 result.CheckSnapshot("myexports", "android_common", "",
Paul Duffina80fdec2019-12-03 15:25:00 +0000254 checkAndroidBpContents(`
255// This is auto-generated. DO NOT EDIT.
256
257java_import {
Paul Duffine6029182019-12-16 17:43:48 +0000258 name: "myexports_myjavalib@current",
Paul Duffina80fdec2019-12-03 15:25:00 +0000259 sdk_member_name: "myjavalib",
260 jars: ["java/myjavalib.jar"],
261}
262
263java_import {
264 name: "myjavalib",
265 prefer: false,
266 jars: ["java/myjavalib.jar"],
267}
268
Paul Duffine6029182019-12-16 17:43:48 +0000269module_exports_snapshot {
270 name: "myexports@current",
271 java_libs: ["myexports_myjavalib@current"],
Paul Duffina80fdec2019-12-03 15:25:00 +0000272}
273
274`),
275 checkAllCopyRules(`
Paul Duffina0dbf432019-12-05 11:25:53 +0000276.intermediates/myjavalib/android_common/javac/myjavalib.jar -> java/myjavalib.jar
Paul Duffina80fdec2019-12-03 15:25:00 +0000277aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
278`),
279 )
280}
281
Paul Duffina0dbf432019-12-05 11:25:53 +0000282func TestHostSnapshotWithJavaImplLibrary(t *testing.T) {
Paul Duffina80fdec2019-12-03 15:25:00 +0000283 // b/145598135 - Generating host snapshots for anything other than linux is not supported.
284 SkipIfNotLinux(t)
285
Paul Duffind835daa2019-11-30 17:49:09 +0000286 result := testSdkWithJava(t, `
Paul Duffine6029182019-12-16 17:43:48 +0000287 module_exports {
288 name: "myexports",
Paul Duffina80fdec2019-12-03 15:25:00 +0000289 device_supported: false,
290 host_supported: true,
291 java_libs: ["myjavalib"],
292 }
293
294 java_library {
295 name: "myjavalib",
296 device_supported: false,
297 host_supported: true,
298 srcs: ["Test.java"],
299 aidl: {
300 export_include_dirs: ["aidl"],
301 },
302 system_modules: "none",
303 sdk_version: "none",
304 compile_dex: true,
305 }
306 `)
307
Paul Duffine6029182019-12-16 17:43:48 +0000308 result.CheckSnapshot("myexports", "linux_glibc_common", "",
Paul Duffina80fdec2019-12-03 15:25:00 +0000309 checkAndroidBpContents(`
310// This is auto-generated. DO NOT EDIT.
311
312java_import {
Paul Duffine6029182019-12-16 17:43:48 +0000313 name: "myexports_myjavalib@current",
Paul Duffina80fdec2019-12-03 15:25:00 +0000314 sdk_member_name: "myjavalib",
315 device_supported: false,
316 host_supported: true,
317 jars: ["java/myjavalib.jar"],
318}
319
320java_import {
321 name: "myjavalib",
322 prefer: false,
323 device_supported: false,
324 host_supported: true,
325 jars: ["java/myjavalib.jar"],
326}
327
Paul Duffine6029182019-12-16 17:43:48 +0000328module_exports_snapshot {
329 name: "myexports@current",
Paul Duffina80fdec2019-12-03 15:25:00 +0000330 device_supported: false,
331 host_supported: true,
Paul Duffine6029182019-12-16 17:43:48 +0000332 java_libs: ["myexports_myjavalib@current"],
Paul Duffina80fdec2019-12-03 15:25:00 +0000333}
334`),
335 checkAllCopyRules(`
336.intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/myjavalib.jar
337aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
338`),
339 )
340}
341
Paul Duffin1b82e6a2019-12-03 18:06:47 +0000342func TestSnapshotWithJavaTest(t *testing.T) {
343 result := testSdkWithJava(t, `
344 module_exports {
345 name: "myexports",
346 java_tests: ["myjavatests"],
347 }
348
349 java_test {
350 name: "myjavatests",
351 srcs: ["Test.java"],
352 system_modules: "none",
353 sdk_version: "none",
354 compile_dex: true,
355 host_supported: true,
356 }
357 `)
358
359 result.CheckSnapshot("myexports", "android_common", "",
360 checkAndroidBpContents(`
361// This is auto-generated. DO NOT EDIT.
362
363java_test_import {
364 name: "myexports_myjavatests@current",
365 sdk_member_name: "myjavatests",
366 jars: ["java/myjavatests.jar"],
367 test_config: "java/myjavatests-AndroidTest.xml",
368}
369
370java_test_import {
371 name: "myjavatests",
372 prefer: false,
373 jars: ["java/myjavatests.jar"],
374 test_config: "java/myjavatests-AndroidTest.xml",
375}
376
377module_exports_snapshot {
378 name: "myexports@current",
379 java_tests: ["myexports_myjavatests@current"],
380}
381`),
382 checkAllCopyRules(`
383.intermediates/myjavatests/android_common/javac/myjavatests.jar -> java/myjavatests.jar
384.intermediates/myjavatests/android_common/myjavatests.config -> java/myjavatests-AndroidTest.xml
385`),
386 )
387}
388
389func TestHostSnapshotWithJavaTest(t *testing.T) {
390 // b/145598135 - Generating host snapshots for anything other than linux is not supported.
391 SkipIfNotLinux(t)
392
393 result := testSdkWithJava(t, `
394 module_exports {
395 name: "myexports",
396 device_supported: false,
397 host_supported: true,
398 java_tests: ["myjavatests"],
399 }
400
401 java_test {
402 name: "myjavatests",
403 device_supported: false,
404 host_supported: true,
405 srcs: ["Test.java"],
406 system_modules: "none",
407 sdk_version: "none",
408 compile_dex: true,
409 }
410 `)
411
412 result.CheckSnapshot("myexports", "linux_glibc_common", "",
413 checkAndroidBpContents(`
414// This is auto-generated. DO NOT EDIT.
415
416java_test_import {
417 name: "myexports_myjavatests@current",
418 sdk_member_name: "myjavatests",
419 device_supported: false,
420 host_supported: true,
421 jars: ["java/myjavatests.jar"],
422 test_config: "java/myjavatests-AndroidTest.xml",
423}
424
425java_test_import {
426 name: "myjavatests",
427 prefer: false,
428 device_supported: false,
429 host_supported: true,
430 jars: ["java/myjavatests.jar"],
431 test_config: "java/myjavatests-AndroidTest.xml",
432}
433
434module_exports_snapshot {
435 name: "myexports@current",
436 device_supported: false,
437 host_supported: true,
438 java_tests: ["myexports_myjavatests@current"],
439}
440`),
441 checkAllCopyRules(`
442.intermediates/myjavatests/linux_glibc_common/javac/myjavatests.jar -> java/myjavatests.jar
443.intermediates/myjavatests/linux_glibc_common/myjavatests.config -> java/myjavatests-AndroidTest.xml
444`),
445 )
446}
447
Paul Duffind835daa2019-11-30 17:49:09 +0000448func testSdkWithDroidstubs(t *testing.T, bp string) *testSdkResult {
449 t.Helper()
450
451 fs := map[string][]byte{
452 "foo/bar/Foo.java": nil,
453 "stubs-sources/foo/bar/Foo.java": nil,
454 }
455 return testSdkWithFs(t, bp, fs)
456}
457
Paul Duffina80fdec2019-12-03 15:25:00 +0000458// Note: This test does not verify that a droidstubs can be referenced, either
459// directly or indirectly from an APEX as droidstubs can never be a part of an
460// apex.
461func TestBasicSdkWithDroidstubs(t *testing.T) {
Paul Duffind835daa2019-11-30 17:49:09 +0000462 testSdkWithDroidstubs(t, `
Paul Duffina80fdec2019-12-03 15:25:00 +0000463 sdk {
464 name: "mysdk",
465 stubs_sources: ["mystub"],
466 }
467 sdk_snapshot {
468 name: "mysdk@10",
469 stubs_sources: ["mystub_mysdk@10"],
470 }
471 prebuilt_stubs_sources {
472 name: "mystub_mysdk@10",
473 sdk_member_name: "mystub",
474 srcs: ["stubs-sources/foo/bar/Foo.java"],
475 }
476 droidstubs {
477 name: "mystub",
478 srcs: ["foo/bar/Foo.java"],
479 sdk_version: "none",
480 system_modules: "none",
481 }
482 java_library {
483 name: "myjavalib",
484 srcs: [":mystub"],
485 sdk_version: "none",
486 system_modules: "none",
487 }
488 `)
489}
490
491func TestSnapshotWithDroidstubs(t *testing.T) {
Paul Duffind835daa2019-11-30 17:49:09 +0000492 result := testSdkWithDroidstubs(t, `
Paul Duffine6029182019-12-16 17:43:48 +0000493 module_exports {
494 name: "myexports",
Paul Duffina80fdec2019-12-03 15:25:00 +0000495 stubs_sources: ["myjavaapistubs"],
496 }
497
498 droidstubs {
499 name: "myjavaapistubs",
500 srcs: ["foo/bar/Foo.java"],
501 system_modules: "none",
502 sdk_version: "none",
503 }
504 `)
505
Paul Duffine6029182019-12-16 17:43:48 +0000506 result.CheckSnapshot("myexports", "android_common", "",
Paul Duffina80fdec2019-12-03 15:25:00 +0000507 checkAndroidBpContents(`
508// This is auto-generated. DO NOT EDIT.
509
510prebuilt_stubs_sources {
Paul Duffine6029182019-12-16 17:43:48 +0000511 name: "myexports_myjavaapistubs@current",
Paul Duffina80fdec2019-12-03 15:25:00 +0000512 sdk_member_name: "myjavaapistubs",
513 srcs: ["java/myjavaapistubs_stubs_sources"],
514}
515
516prebuilt_stubs_sources {
517 name: "myjavaapistubs",
518 prefer: false,
519 srcs: ["java/myjavaapistubs_stubs_sources"],
520}
521
Paul Duffine6029182019-12-16 17:43:48 +0000522module_exports_snapshot {
523 name: "myexports@current",
524 stubs_sources: ["myexports_myjavaapistubs@current"],
Paul Duffina80fdec2019-12-03 15:25:00 +0000525}
526
527`),
528 checkAllCopyRules(""),
Paul Duffine6029182019-12-16 17:43:48 +0000529 checkMergeZip(".intermediates/myexports/android_common/tmp/java/myjavaapistubs_stubs_sources.zip"),
Paul Duffina80fdec2019-12-03 15:25:00 +0000530 )
531}
532
533func TestHostSnapshotWithDroidstubs(t *testing.T) {
534 // b/145598135 - Generating host snapshots for anything other than linux is not supported.
535 SkipIfNotLinux(t)
536
Paul Duffind835daa2019-11-30 17:49:09 +0000537 result := testSdkWithDroidstubs(t, `
Paul Duffine6029182019-12-16 17:43:48 +0000538 module_exports {
539 name: "myexports",
Paul Duffina80fdec2019-12-03 15:25:00 +0000540 device_supported: false,
541 host_supported: true,
542 stubs_sources: ["myjavaapistubs"],
543 }
544
545 droidstubs {
546 name: "myjavaapistubs",
547 device_supported: false,
548 host_supported: true,
549 srcs: ["foo/bar/Foo.java"],
550 system_modules: "none",
551 sdk_version: "none",
552 }
553 `)
554
Paul Duffine6029182019-12-16 17:43:48 +0000555 result.CheckSnapshot("myexports", "linux_glibc_common", "",
Paul Duffina80fdec2019-12-03 15:25:00 +0000556 checkAndroidBpContents(`
557// This is auto-generated. DO NOT EDIT.
558
559prebuilt_stubs_sources {
Paul Duffine6029182019-12-16 17:43:48 +0000560 name: "myexports_myjavaapistubs@current",
Paul Duffina80fdec2019-12-03 15:25:00 +0000561 sdk_member_name: "myjavaapistubs",
562 device_supported: false,
563 host_supported: true,
564 srcs: ["java/myjavaapistubs_stubs_sources"],
565}
566
567prebuilt_stubs_sources {
568 name: "myjavaapistubs",
569 prefer: false,
570 device_supported: false,
571 host_supported: true,
572 srcs: ["java/myjavaapistubs_stubs_sources"],
573}
574
Paul Duffine6029182019-12-16 17:43:48 +0000575module_exports_snapshot {
576 name: "myexports@current",
Paul Duffina80fdec2019-12-03 15:25:00 +0000577 device_supported: false,
578 host_supported: true,
Paul Duffine6029182019-12-16 17:43:48 +0000579 stubs_sources: ["myexports_myjavaapistubs@current"],
Paul Duffina80fdec2019-12-03 15:25:00 +0000580}
581`),
582 checkAllCopyRules(""),
Paul Duffine6029182019-12-16 17:43:48 +0000583 checkMergeZip(".intermediates/myexports/linux_glibc_common/tmp/java/myjavaapistubs_stubs_sources.zip"),
Paul Duffina80fdec2019-12-03 15:25:00 +0000584 )
585}
Paul Duffin7b81f5e2020-01-13 21:03:22 +0000586
587func TestSnapshotWithJavaSystemModules(t *testing.T) {
588 result := testSdkWithJava(t, `
589 sdk {
590 name: "mysdk",
591 java_system_modules: ["my-system-modules"],
592 }
593
594 java_system_modules {
595 name: "my-system-modules",
596 libs: ["system-module"],
597 }
598
599 java_library {
600 name: "system-module",
601 srcs: ["Test.java"],
602 sdk_version: "none",
603 system_modules: "none",
604 }
605 `)
606
607 result.CheckSnapshot("mysdk", "android_common", "",
608 checkAndroidBpContents(`
609// This is auto-generated. DO NOT EDIT.
610
611java_import {
612 name: "mysdk_system-module@current",
613 sdk_member_name: "system-module",
614 jars: ["java/system-module.jar"],
615}
616
617java_import {
618 name: "system-module",
619 prefer: false,
620 jars: ["java/system-module.jar"],
621}
622
623java_system_modules_import {
624 name: "mysdk_my-system-modules@current",
625 sdk_member_name: "my-system-modules",
626 libs: ["mysdk_system-module@current"],
627}
628
629java_system_modules_import {
630 name: "my-system-modules",
631 prefer: false,
632 libs: ["system-module"],
633}
634
635sdk_snapshot {
636 name: "mysdk@current",
637 java_system_modules: ["mysdk_my-system-modules@current"],
638}
639`),
640 checkAllCopyRules(".intermediates/system-module/android_common/turbine-combined/system-module.jar -> java/system-module.jar"),
641 )
642}
643
644func TestHostSnapshotWithJavaSystemModules(t *testing.T) {
645 // b/145598135 - Generating host snapshots for anything other than linux is not supported.
646 SkipIfNotLinux(t)
647
648 result := testSdkWithJava(t, `
649 sdk {
650 name: "mysdk",
651 device_supported: false,
652 host_supported: true,
653 java_system_modules: ["my-system-modules"],
654 }
655
656 java_system_modules {
657 name: "my-system-modules",
658 device_supported: false,
659 host_supported: true,
660 libs: ["system-module"],
661 }
662
663 java_library {
664 name: "system-module",
665 device_supported: false,
666 host_supported: true,
667 srcs: ["Test.java"],
668 sdk_version: "none",
669 system_modules: "none",
670 }
671 `)
672
673 result.CheckSnapshot("mysdk", "linux_glibc_common", "",
674 checkAndroidBpContents(`
675// This is auto-generated. DO NOT EDIT.
676
677java_import {
678 name: "mysdk_system-module@current",
679 sdk_member_name: "system-module",
680 device_supported: false,
681 host_supported: true,
682 jars: ["java/system-module.jar"],
683}
684
685java_import {
686 name: "system-module",
687 prefer: false,
688 device_supported: false,
689 host_supported: true,
690 jars: ["java/system-module.jar"],
691}
692
693java_system_modules_import {
694 name: "mysdk_my-system-modules@current",
695 sdk_member_name: "my-system-modules",
696 device_supported: false,
697 host_supported: true,
698 libs: ["mysdk_system-module@current"],
699}
700
701java_system_modules_import {
702 name: "my-system-modules",
703 prefer: false,
704 device_supported: false,
705 host_supported: true,
706 libs: ["system-module"],
707}
708
709sdk_snapshot {
710 name: "mysdk@current",
711 device_supported: false,
712 host_supported: true,
713 java_system_modules: ["mysdk_my-system-modules@current"],
714}
715`),
716 checkAllCopyRules(".intermediates/system-module/linux_glibc_common/javac/system-module.jar -> java/system-module.jar"),
717 )
718}