1//
2// Copyright (C) 2015 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    default_applicable_licenses: ["system_tools_aidl_license"],
19}
20
21// Added automatically by a large-scale-change
22// See: http://go/android-license-faq
23license {
24    name: "system_tools_aidl_license",
25    visibility: [":__subpackages__"],
26    license_kinds: [
27        "SPDX-license-identifier-Apache-2.0",
28    ],
29    license_text: [
30        "NOTICE",
31    ],
32}
33
34cc_defaults {
35    name: "aidl_defaults",
36    cflags: [
37        "-Wall",
38        "-Werror",
39        "-Wextra",
40    ],
41    tidy: true,
42    tidy_checks: [
43        "-bugprone-argument-comment",
44        "-bugprone-branch-clone",
45        "-bugprone-macro-parentheses",
46        "-bugprone-misplaced-widening-cast",
47        "-bugprone-signed-char-misuse",
48        "-bugprone-sizeof-expression",
49        "-cert-err34-c",
50        "-cert-err52-cpp",
51        "-cert-str34-c",
52        "-clang-analyzer-optin.performance.Padding",
53        "-misc-unused-using-decls",
54        "-performance-for-range-copy",
55        "-performance-inefficient-string-concatenation",
56        "-performance-inefficient-vector-operation",
57        "-performance-no-automatic-move",
58        "-performance-unnecessary-copy-initialization",
59        "-performance-unnecessary-value-param",
60    ],
61    header_libs: ["libgtest_prod_headers"],
62    static_libs: [
63        "libbase",
64        "libgtest",
65    ],
66    // TODO(b/174366536): basic_stringbuf::overflow causes "ubsan: implicit-conversion"
67    // sanitize: {
68    //     integer_overflow: true,
69    //     misc_undefined: ["integer"],
70    // },
71    target: {
72        windows: {
73            enabled: true,
74        },
75        host: {
76            cflags: [
77                "-O0",
78                "-g",
79            ],
80        },
81    },
82    product_variables: {
83        platform_sdk_version: {
84            cflags: ["-DPLATFORM_SDK_VERSION=%d"],
85        },
86    },
87    defaults_visibility: [":__subpackages__"],
88}
89
90// Logic shared between aidl and its unittests
91cc_library_static {
92    name: "libaidl-common",
93    defaults: ["aidl_defaults"],
94    host_supported: true,
95
96    srcs: [
97        "aidl_checkapi.cpp",
98        "aidl_const_expressions.cpp",
99        "aidl_dumpapi.cpp",
100        "aidl_language_l.ll",
101        "aidl_language_y.yy",
102        "aidl_language.cpp",
103        "aidl_to_common.cpp",
104        "aidl_to_cpp_common.cpp",
105        "aidl_to_cpp.cpp",
106        "aidl_to_java.cpp",
107        "aidl_to_ndk.cpp",
108        "aidl_to_rust.cpp",
109        "aidl_typenames.cpp",
110        "aidl.cpp",
111        "ast_java.cpp",
112        "check_valid.cpp",
113        "code_writer.cpp",
114        "comments.cpp",
115        "diagnostics.cpp",
116        "generate_aidl_mappings.cpp",
117        "generate_cpp.cpp",
118        "generate_cpp_analyzer.cpp",
119        "generate_java_binder.cpp",
120        "generate_java.cpp",
121        "generate_ndk.cpp",
122        "generate_rust.cpp",
123        "import_resolver.cpp",
124        "io_delegate.cpp",
125        "location.cpp",
126        "logging.cpp",
127        "options.cpp",
128        "parser.cpp",
129        "permission.cpp",
130        "preprocess.cpp",
131    ],
132    yacc: {
133        gen_location_hh: true,
134        gen_position_hh: true,
135    },
136    visibility: [":__subpackages__"],
137}
138
139// aidl executable
140cc_binary_host {
141    name: "aidl",
142    defaults: ["aidl_defaults"],
143    srcs: ["main.cpp"],
144    static_libs: [
145        "libaidl-common",
146        "libbase",
147        "liblog",
148    ],
149}
150
151// aidl-cpp legacy executable, please use 'aidl' instead
152cc_binary_host {
153    name: "aidl-cpp",
154    defaults: ["aidl_defaults"],
155    srcs: ["main.cpp"],
156    cflags: ["-DAIDL_CPP_BUILD"],
157    static_libs: [
158        "libaidl-common",
159        "libbase",
160        "liblog",
161    ],
162}
163
164// Unit tests
165cc_test {
166    name: "aidl_unittests",
167    host_supported: true,
168
169    test_suites: ["general-tests"],
170
171    cflags: [
172        "-Wall",
173        "-Wextra",
174        "-Werror",
175        "-g",
176    ],
177
178    tidy_timeout_srcs: [
179        "aidl_unittest.cpp",
180        "options_unittest.cpp",
181    ],
182
183    srcs: [
184        "aidl_unittest.cpp",
185        "ast_java_unittest.cpp",
186        "code_writer_unittest.cpp",
187        "diagnostics_unittest.cpp",
188        "generate_cpp_unittest.cpp",
189        "io_delegate_unittest.cpp",
190        "options_unittest.cpp",
191        "tests/fake_io_delegate.cpp",
192        "tests/main.cpp",
193        "tests/test_util.cpp",
194    ],
195
196    static_libs: [
197        "libaidl-common",
198        "libbase",
199        "libcutils",
200        "libgmock",
201        "liblog",
202    ],
203
204    target: {
205        host: {
206            sanitize: {
207                address: true,
208            },
209        },
210    },
211
212    data: [
213        ":aidl-golden-test-build-hook-gen",
214    ],
215}
216
217cc_fuzz {
218    name: "aidl_parser_fuzzer",
219    host_supported: true,
220    dictionary: "tests/aidl_parser_fuzzer.dict",
221    corpus: [
222        "tests/corpus/*",
223    ],
224
225    fuzz_config: {
226        cc: [
227            "[email protected]",
228        ],
229        triage_assignee: "[email protected]",
230        use_for_presubmit: true,
231    },
232
233    srcs: [
234        "tests/aidl_parser_fuzzer.cpp",
235        "tests/fake_io_delegate.cpp",
236        "tests/test_util.cpp",
237    ],
238    static_libs: [
239        "libaidl-common",
240        "libbase",
241        "libcutils",
242        "libgtest",
243        "liblog",
244    ],
245    // Enable this to show additional information about what is being parsed during fuzzing.
246    // cflags: ["-DFUZZ_LOG"],
247}
248
249//
250// Integration testing of generated AIDL code.
251//
252
253python_test_host {
254    name: "aidl_integration_test",
255    main: "tests/aidl_integration_test.py",
256    srcs: ["tests/aidl_integration_test.py"],
257    test_config: "tests/aidl_integration_test.xml",
258    device_common_data: [
259        ":aidl_test_java_client",
260        ":aidl_test_java_service",
261        ":aidl_test_java_client_sdk1",
262        ":aidl_test_java_service_sdk1",
263        ":aidl_test_java_client_sdk29",
264        ":aidl_test_java_service_sdk29",
265        ":aidl_test_java_client_permission",
266        ":aidl_test_java_service_permission",
267    ],
268    data_device_bins_both: [
269        "aidl_test_client",
270        "aidl_test_v1_client",
271        "aidl_test_service",
272        "aidl_test_client_ndk",
273        "aidl_test_service_ndk",
274        "aidl_test_rust_client",
275        "aidl_test_rust_service",
276        "aidl_test_rust_service_async",
277    ],
278    test_suites: ["general-tests"],
279    test_options: {
280        unit_test: false,
281    },
282}
283
284cc_defaults {
285    name: "aidl_test_defaults",
286    cflags: [
287        "-Wall",
288        "-Wextra",
289        "-Werror",
290    ],
291    shared_libs: [
292        "libbase",
293        "libbinder",
294        "liblog",
295        "libutils",
296    ],
297    compile_multilib: "both",
298    multilib: {
299        lib32: {
300            suffix: "32",
301        },
302        lib64: {
303            suffix: "64",
304        },
305    },
306    test_suites: ["general-tests"],
307}
308
309// Header-only library used for atrace in platform NDK builds
310cc_library_headers {
311    name: "libandroid_aidltrace",
312    host_supported: true,
313    vendor_available: true,
314    product_available: true,
315    export_include_dirs: ["trace"],
316    apex_available: [
317        "//apex_available:platform",
318        "//apex_available:anyapex",
319    ],
320}
321
322cc_library {
323    name: "libsimpleparcelable",
324    export_include_dirs: [
325        ".",
326    ],
327    srcs: [
328        "tests/bad_parcelable.cpp",
329        "tests/simple_parcelable.cpp",
330    ],
331    shared_libs: [
332        "libbase",
333        "libbinder",
334        "libutils",
335    ],
336}
337
338java_library {
339    name: "libsimpleparcelable_java",
340    srcs: [
341        "tests/java/src/android/aidl/tests/BadParcelable.java",
342        "tests/java/src/android/aidl/tests/SimpleParcelable.java",
343        "tests/java/src/android/aidl/tests/generic/Pair.java",
344    ],
345}
346
347cc_library {
348    name: "libsimpleparcelable_ndk",
349    export_include_dirs: [
350        ".",
351    ],
352    srcs: [
353        "tests/simple_parcelable_ndk.cpp",
354    ],
355    shared_libs: [
356        "libbase",
357        "libbinder_ndk",
358    ],
359}
360
361rust_library {
362    name: "libsimple_parcelable_rust",
363    crate_name: "simple_parcelable",
364    srcs: [
365        "tests/rust/simple_parcelable.rs",
366    ],
367    rustlibs: [
368        "libbinder_rs",
369    ],
370}
371
372aidl_interface {
373    name: "aidl-test-interface",
374    unstable: true,
375    flags: ["-Werror"],
376    srcs: [
377        "tests/android/aidl/tests/ArrayOfInterfaces.aidl",
378        "tests/android/aidl/tests/BackendType.aidl",
379        "tests/android/aidl/tests/ByteEnum.aidl",
380        "tests/android/aidl/tests/CircularParcelable.aidl",
381        "tests/android/aidl/tests/ConstantExpressionEnum.aidl",
382        "tests/android/aidl/tests/DeprecatedEnum.aidl",
383        "tests/android/aidl/tests/DeprecatedParcelable.aidl",
384        "tests/android/aidl/tests/GenericStructuredParcelable.aidl",
385        "tests/android/aidl/tests/FixedSize.aidl",
386        "tests/android/aidl/tests/ICircular.aidl",
387        "tests/android/aidl/tests/IDeprecated.aidl",
388        "tests/android/aidl/tests/INamedCallback.aidl",
389        "tests/android/aidl/tests/INewName.aidl",
390        "tests/android/aidl/tests/IOldName.aidl",
391        "tests/android/aidl/tests/ITestService.aidl",
392        "tests/android/aidl/tests/IntEnum.aidl",
393        "tests/android/aidl/tests/ListOfInterfaces.aidl",
394        "tests/android/aidl/tests/LongEnum.aidl",
395        "tests/android/aidl/tests/OtherParcelableForToString.aidl",
396        "tests/android/aidl/tests/ParcelableForToString.aidl",
397        "tests/android/aidl/tests/RecursiveList.aidl",
398        "tests/android/aidl/tests/StructuredParcelable.aidl",
399        "tests/android/aidl/tests/Union.aidl",
400        "tests/android/aidl/tests/UnionWithFd.aidl",
401        "tests/android/aidl/tests/extension/*.aidl",
402        "tests/android/aidl/tests/nested/*.aidl",
403        "tests/android/aidl/tests/unions/*.aidl",
404    ],
405    local_include_dir: "tests",
406    backend: {
407        cpp: {
408            additional_shared_libraries: [
409                "libsimpleparcelable",
410            ],
411        },
412        java: {
413            additional_libs: [
414                "libsimpleparcelable_java",
415            ],
416            platform_apis: true,
417        },
418        rust: {
419            enabled: true,
420            additional_rustlibs: [
421                "libsimple_parcelable_rust",
422            ],
423        },
424        ndk: {
425            apps_enabled: false,
426            additional_shared_libraries: [
427                "libsimpleparcelable_ndk",
428            ],
429        },
430    },
431}
432
433aidl_interface {
434    name: "aidl-cpp-java-test-interface",
435    unstable: true,
436    srcs: [
437        "tests/android/aidl/tests/BadParcelable.aidl",
438        "tests/android/aidl/tests/ICppJavaTests.aidl",
439    ],
440    local_include_dir: "tests",
441    include_dirs: [
442        "frameworks/native/aidl/binder",
443    ],
444    imports: ["aidl-test-interface"],
445    backend: {
446        cpp: {
447            additional_shared_libraries: ["libsimpleparcelable"],
448            enabled: true,
449        },
450        java: {
451            additional_libs: [
452                "libsimpleparcelable_java",
453            ],
454            platform_apis: true,
455            enabled: true,
456        },
457        rust: {
458            enabled: false,
459        },
460        ndk: {
461            enabled: false,
462        },
463    },
464}
465
466aidl_interface {
467    name: "aidl-test-interface-permission",
468    srcs: [
469        "tests/android/aidl/tests/permission/**/*.aidl",
470    ],
471    unstable: true,
472    flags: ["-Werror"],
473    include_dirs: [
474        "frameworks/base/core/java",
475    ],
476    local_include_dir: "tests",
477    backend: {
478        cpp: {
479            enabled: false,
480        },
481        java: {
482            platform_apis: true,
483        },
484        rust: {
485            enabled: false,
486        },
487        ndk: {
488            enabled: false,
489        },
490    },
491}
492
493aidl_interface {
494    name: "aidl-test-versioned-interface",
495    local_include_dir: "tests/versioned",
496    flags: ["-Werror"],
497    srcs: [
498        "tests/versioned/**/*.aidl",
499    ],
500
501    backend: {
502        java: {
503            gen_rpc: true,
504        },
505        rust: {
506            enabled: true,
507        },
508    },
509    versions_with_info: [
510        {
511            version: "1",
512            imports: [],
513        },
514        {
515            version: "2",
516            imports: [],
517        },
518        {
519            version: "3",
520            imports: [],
521        },
522
523    ],
524    frozen: true,
525
526}
527
528cc_test {
529    name: "aidl_test_service",
530    gtest: false,
531    defaults: ["aidl_test_defaults"],
532    static_libs: [
533        "aidl-test-interface-cpp",
534        "aidl-cpp-java-test-interface-cpp",
535        "libsimpleparcelable",
536        "libcutils",
537        // service uses the old version
538        "aidl-test-versioned-interface-V1-cpp",
539        "aidl_test_loggable_interface-cpp",
540        "aidl-test-fixedsizearray-cpp",
541        "android.aidl.test.trunk-V2-cpp",
542        "aidl_test_vintf_parcelable-V1-cpp",
543    ],
544    srcs: ["tests/aidl_test_service.cpp"],
545}
546
547cc_test {
548    name: "aidl_test_service_ndk",
549    gtest: false,
550    defaults: ["aidl_test_defaults"],
551    shared_libs: [
552        "libbinder_ndk",
553        "libcutils",
554    ],
555    static_libs: [
556        // service uses the old version
557        "aidl-test-versioned-interface-V1-ndk",
558        "aidl-test-interface-ndk",
559        "aidl_test_loggable_interface-ndk",
560        "aidl-test-fixedsizearray-ndk",
561        "android.aidl.test.trunk-V2-ndk",
562        "libsimpleparcelable_ndk",
563        "aidl_test_vintf_parcelable-V1-ndk",
564    ],
565    srcs: ["tests/aidl_test_service_ndk.cpp"],
566}
567
568cc_test {
569    name: "aidl_test_client",
570    defaults: ["aidl_test_defaults"],
571    static_libs: [
572        "aidl-test-interface-cpp",
573        "aidl-cpp-java-test-interface-cpp",
574        "libsimpleparcelable",
575        "libcutils",
576        "libgmock",
577        //  client uses the latest version
578        "aidl-test-versioned-interface-V2-cpp",
579        "aidl_test_loggable_interface-cpp",
580        "aidl-test-fixedsizearray-cpp",
581        "aidl_test_vintf_parcelable-V1-cpp",
582        "android.aidl.test.trunk-V2-cpp",
583    ],
584    product_variables: {
585        release_aidl_use_unfrozen: {
586            cflags: ["-DAIDL_USE_UNFROZEN"],
587        },
588    },
589    tidy_timeout_srcs: [
590        "tests/aidl_test_client_parcelables.cpp",
591        "tests/aidl_test_client_primitives.cpp",
592    ],
593    srcs: [
594        "tests/aidl_test_client.cpp",
595        "tests/aidl_test_client_builtin_transactions.cpp",
596        "tests/aidl_test_client_file_descriptors.cpp",
597        "tests/aidl_test_client_parcelables.cpp",
598        "tests/aidl_test_client_nullables.cpp",
599        "tests/aidl_test_client_primitives.cpp",
600        "tests/aidl_test_client_utf8_strings.cpp",
601        "tests/aidl_test_client_service_exceptions.cpp",
602        "tests/aidl_test_client_defaultimpl.cpp",
603        "tests/aidl_test_client_delegate.cpp",
604        "tests/aidl_test_client_versioned_interface.cpp",
605        "tests/aidl_test_client_renamed_interface.cpp",
606        "tests/aidl_test_client_loggable_interface.cpp",
607        "tests/aidl_test_client_nested.cpp",
608        "tests/aidl_test_client_trunk_stable.cpp",
609    ],
610    cflags: ["-DAIDL_USE_V2_INTERFACE"],
611}
612
613cc_test {
614    name: "aidl_test_v1_client",
615    defaults: ["aidl_test_defaults"],
616    static_libs: [
617        "aidl-test-interface-cpp",
618        "aidl-cpp-java-test-interface-cpp",
619        "libsimpleparcelable",
620        "libcutils",
621        "libgmock",
622        "android.aidl.test.trunk-V1-cpp",
623    ],
624    product_variables: {
625        release_aidl_use_unfrozen: {
626            cflags: ["-DAIDL_USE_UNFROZEN"],
627        },
628    },
629    srcs: [
630        "tests/aidl_test_client_trunk_stable.cpp",
631        "tests/aidl_test_client.cpp",
632    ],
633}
634
635cc_test {
636    name: "aidl_test_client_ndk",
637    defaults: ["aidl_test_defaults"],
638    static_libs: [
639        "libcutils",
640        "libgmock",
641        //  client uses the latest version
642        "aidl-test-versioned-interface-V2-ndk",
643        "aidl-test-interface-ndk",
644        "aidl_test_loggable_interface-ndk",
645        "aidl-test-fixedsizearray-ndk",
646        "aidl_test_vintf_parcelable-V1-ndk",
647        "android.aidl.test.trunk-V2-ndk",
648        "libsimpleparcelable_ndk",
649    ],
650    shared_libs: [
651        "libbinder_ndk",
652    ],
653    product_variables: {
654        release_aidl_use_unfrozen: {
655            cflags: ["-DAIDL_USE_UNFROZEN"],
656        },
657    },
658    srcs: [
659        "tests/aidl_test_client_ndk_delegate.cpp",
660        "tests/aidl_test_client_ndk_loggable_interface.cpp",
661        "tests/aidl_test_client_ndk_nested.cpp",
662        "tests/aidl_test_client_ndk_nullables.cpp",
663        "tests/aidl_test_client_ndk_parcelables.cpp",
664        "tests/aidl_test_client_ndk_primitives_test.cpp",
665        "tests/aidl_test_client_ndk_strings_test.cpp",
666        "tests/aidl_test_client_ndk_versioned_interface.cpp",
667        "tests/aidl_test_client_ndk_trunk_stable.cpp",
668    ],
669}
670
671aidl_interface {
672    name: "aidl-test-fixedsizearray",
673    srcs: ["tests/android/aidl/fixedsizearray/FixedSizeArrayExample.aidl"],
674    local_include_dir: "tests",
675    unstable: true,
676    backend: {
677        cpp: {
678            enabled: true,
679        },
680        java: {
681            enabled: true,
682        },
683        ndk: {
684            enabled: true,
685        },
686        rust: {
687            enabled: true,
688        },
689    },
690}
691
692java_defaults {
693    name: "aidl_test_java_integration_defaults",
694    platform_apis: true,
695    // Turn off Java optimization tools to speed up our test iterations.
696    optimize: {
697        enabled: false,
698    },
699    dex_preopt: {
700        enabled: false,
701    },
702    static_libs: [
703        "androidx.test.core",
704        "androidx.test.runner",
705    ],
706    aidl: {
707        include_dirs: [
708            "frameworks/native/aidl/binder",
709        ],
710    },
711    test_suites: ["general-tests"],
712}
713
714java_defaults {
715    name: "aidl_test_java_defaults",
716    defaults: ["aidl_test_java_integration_defaults"],
717    static_libs: [
718        "aidl_test_nonvintf_parcelable-V1-java",
719        "aidl_test_unstable_parcelable-java",
720        "aidl_test_vintf_parcelable-V1-java",
721        "aidl-test-fixedsizearray-java",
722        "aidl-cpp-java-test-interface-java",
723        // TODO: remove once Android migrates to JUnit 4.12,
724        // which provides assertThrows
725        "testng",
726    ],
727}
728
729java_test {
730    name: "aidl_test_java_client",
731    defaults: ["aidl_test_java_defaults"],
732    static_libs: [
733        "aidl-test-extras-java",
734        // client uses the new version
735        "aidl-test-versioned-interface-V3-java",
736        "android.aidl.test.trunk-V2-java",
737    ],
738    // tests are included in defaults
739    srcs: [
740        "tests/java/src/android/aidl/tests/MapTests.java",
741        "tests/java/src/android/aidl/tests/TestServiceClient.java",
742        "tests/java/src/android/aidl/tests/JavaOnlyImmutableAnnotationTests.java",
743        "tests/java/src/android/aidl/tests/AidlJavaTests.java",
744        "tests/java/src/android/aidl/tests/BuiltInTests.java",
745        "tests/java/src/android/aidl/tests/DelegatorTests.java",
746        "tests/java/src/android/aidl/tests/GenericTests.java",
747        "tests/java/src/android/aidl/tests/NestedTypesTests.java",
748        "tests/java/src/android/aidl/tests/TestVersionedInterface.java",
749        "tests/java/src/android/aidl/tests/TrunkStableTests.java",
750        "tests/java/src/android/aidl/tests/UnionTests.java",
751        "tests/java/src/android/aidl/tests/ExtensionTests.java",
752        "tests/java/src/android/aidl/tests/NullableTests.java",
753        "tests/java/src/android/aidl/tests/VintfTests.java",
754        "tests/java/src/android/aidl/tests/ServiceManagerNativeTests.java",
755    ],
756    data: [
757        ":cts-dalvik-device-test-runner",
758    ],
759}
760
761java_test {
762    name: "aidl_test_java_service",
763    defaults: ["aidl_test_java_defaults"],
764    static_libs: [
765        // service uses the old version
766        "aidl-test-versioned-interface-V1-java",
767        "android.aidl.test.trunk-V2-java",
768    ],
769    srcs: [
770        "tests/java/src/android/aidl/service/**/*.java",
771    ],
772    data: [
773        ":cts-dalvik-device-test-runner",
774    ],
775}
776
777filegroup {
778    name: "aidl-for-sdkversion-tests",
779    srcs: [
780        "tests/java/src/android/aidl/sdkversion/ITestService.aidl",
781    ],
782    path: "tests/java/src",
783}
784
785java_defaults {
786    name: "aidl_test_java_sdkversion_defaults",
787    defaults: ["aidl_test_java_integration_defaults"],
788    srcs: [
789        ":aidl-for-sdkversion-tests",
790    ],
791}
792
793java_test {
794    name: "aidl_test_java_client_sdk29",
795    defaults: ["aidl_test_java_sdkversion_defaults"],
796    min_sdk_version: "29",
797    data: [
798        ":cts-dalvik-device-test-runner",
799    ],
800    srcs: [
801        "tests/java/src/android/aidl/sdkversion/tests/*.java",
802    ],
803}
804
805java_test {
806    name: "aidl_test_java_service_sdk29",
807    defaults: ["aidl_test_java_sdkversion_defaults"],
808    min_sdk_version: "29",
809    srcs: [
810        "tests/java/src/android/aidl/sdkversion/service/*.java",
811    ],
812    data: [
813        ":cts-dalvik-device-test-runner",
814    ],
815}
816
817java_test {
818    name: "aidl_test_java_client_sdk1",
819    defaults: ["aidl_test_java_sdkversion_defaults"],
820    min_sdk_version: "1",
821    srcs: [
822        "tests/java/src/android/aidl/sdkversion/tests/*.java",
823    ],
824    data: [
825        ":cts-dalvik-device-test-runner",
826    ],
827}
828
829java_test {
830    name: "aidl_test_java_service_sdk1",
831    defaults: ["aidl_test_java_sdkversion_defaults"],
832    min_sdk_version: "1",
833    data: [
834        ":cts-dalvik-device-test-runner",
835    ],
836    srcs: [
837        "tests/java/src/android/aidl/sdkversion/service/*.java",
838    ],
839}
840
841java_test {
842    name: "aidl_test_java_client_permission",
843    defaults: ["aidl_test_java_integration_defaults"],
844    static_libs: [
845        "aidl-test-interface-permission-java",
846        "frameworks-base-testutils",
847    ],
848    srcs: [
849        "tests/java/src/android/aidl/permission/tests/*.java",
850        "tests/java/src/android/aidl/permission/service/*.java",
851    ],
852    data: [
853        ":cts-dalvik-device-test-runner",
854    ],
855}
856
857java_test {
858    name: "aidl_test_java_service_permission",
859    defaults: ["aidl_test_java_integration_defaults"],
860    static_libs: [
861        "aidl-test-interface-permission-java",
862        "frameworks-base-testutils",
863    ],
864    data: [
865        ":cts-dalvik-device-test-runner",
866    ],
867    srcs: [
868        "tests/java/src/android/aidl/permission/service/*.java",
869    ],
870}
871
872//
873// "Golden" test of compiler output
874//
875
876sh_binary_host {
877    name: "aidl-golden-test",
878    src: "tests/golden_test.sh",
879}
880
881genrule {
882    name: "aidl-golden-test-build-hook-gen",
883    tools: ["aidl-golden-test"],
884
885    // We don't have access to TARGET_RELEASE in the script when it's called from this
886    // hook, so we pass it explicitly. All the script needs to know is whether or not
887    // $TARGET_RELEASE is "next"
888    product_variables: {
889        release_aidl_use_unfrozen: {
890            cmd: "TARGET_RELEASE=trunk_staging $(location aidl-golden-test) check $(in) && " +
891                "touch $(out)",
892        },
893    },
894
895    cmd: "TARGET_RELEASE=next $(location aidl-golden-test) check $(in) && touch $(out)",
896    srcs: [
897        // warning: keep this list up to date with tests/golden_test.sh
898        ":aidl-test-interface-cpp-source",
899        ":aidl-test-interface-java-source",
900        ":aidl-test-interface-ndk-source",
901        ":aidl-test-interface-rust-source",
902        ":aidl-test-extras-java-source",
903        ":aidl-cpp-java-test-interface-cpp-source",
904        ":aidl-cpp-java-test-interface-java-source",
905        ":aidl-test-versioned-interface-V1-cpp-source",
906        ":aidl-test-versioned-interface-V1-java-source",
907        ":aidl-test-versioned-interface-V1-ndk-source",
908        ":aidl-test-versioned-interface-V1-rust-source",
909        ":aidl-test-versioned-interface-V2-cpp-source",
910        ":aidl-test-versioned-interface-V2-java-source",
911        ":aidl-test-versioned-interface-V2-ndk-source",
912        ":aidl-test-versioned-interface-V2-rust-source",
913        ":aidl-test-versioned-interface-V3-cpp-source",
914        ":aidl-test-versioned-interface-V3-java-source",
915        ":aidl-test-versioned-interface-V3-ndk-source",
916        ":aidl-test-versioned-interface-V3-rust-source",
917        ":aidl_test_loggable_interface-cpp-source",
918        ":aidl_test_loggable_interface-java-source",
919        ":aidl_test_loggable_interface-ndk-source",
920        ":aidl-test-interface-permission-java-source",
921        ":aidl-test-fixedsizearray-cpp-source",
922        ":aidl-test-fixedsizearray-java-source",
923        ":aidl-test-fixedsizearray-ndk-source",
924        ":aidl-test-fixedsizearray-rust-source",
925        ":aidl-test-interface-cpp-analyzer-source",
926        ":android.aidl.test.trunk-V1-cpp-source",
927        ":android.aidl.test.trunk-V2-cpp-source",
928        ":android.aidl.test.trunk-V1-ndk-source",
929        ":android.aidl.test.trunk-V2-ndk-source",
930        ":android.aidl.test.trunk-V1-java-source",
931        ":android.aidl.test.trunk-V2-java-source",
932        ":android.aidl.test.trunk-V1-rust-source",
933        ":android.aidl.test.trunk-V2-rust-source",
934        "tests/golden_output/**/*",
935    ],
936    out: ["aidl_golden_test_stamp.txt"],
937}
938
939//
940// Testing generation of logs
941//
942
943aidl_interface {
944    name: "aidl_test_loggable_interface",
945    unstable: true,
946    local_include_dir: "tests",
947    flags: ["-Werror"],
948    srcs: [
949        "tests/android/aidl/loggable/ILoggableInterface.aidl",
950        "tests/android/aidl/loggable/Data.aidl",
951        "tests/android/aidl/loggable/Enum.aidl",
952        "tests/android/aidl/loggable/Union.aidl",
953    ],
954    gen_trace: true,
955    backend: {
956        cpp: {
957            gen_log: true,
958        },
959        ndk: {
960            gen_log: true,
961        },
962        java: {
963            platform_apis: true,
964        },
965    },
966}
967
968aidl_interface {
969    name: "aidl-test-extras",
970    unstable: true,
971    flags: ["-Werror"],
972    srcs: [
973        "tests/android/aidl/tests/generic/*.aidl",
974        "tests/android/aidl/tests/immutable/*.aidl",
975        "tests/android/aidl/tests/map/*.aidl",
976    ],
977    local_include_dir: "tests",
978    // Map is only valid for Java for now
979    backend: {
980        cpp: {
981            enabled: false,
982        },
983        java: {
984            additional_libs: [
985                "libsimpleparcelable_java",
986            ],
987            platform_apis: true,
988        },
989        rust: {
990            enabled: false,
991        },
992        ndk: {
993            enabled: false,
994        },
995    },
996}
997
998//
999// Rust tests
1000//
1001
1002rust_test {
1003    name: "aidl_test_rust_client",
1004    srcs: [
1005        "tests/rust/test_client.rs",
1006    ],
1007    rustlibs: [
1008        "aidl-test-interface-rust",
1009        "aidl-test-versioned-interface-V2-rust",
1010        "aidl_test_nonvintf_parcelable-V1-rust",
1011        "aidl_test_unstable_parcelable-rust",
1012        "aidl_test_vintf_parcelable-V1-rust",
1013        "aidl-test-fixedsizearray-rust",
1014        "android.aidl.test.trunk-V2-rust",
1015        "liblibc",
1016        // We need to import binder_rs directly
1017        // for a few internal types like Parcel
1018        // and traits like Parcelable
1019        "libbinder_rs",
1020        "libsimple_parcelable_rust",
1021    ],
1022    prefer_rlib: true,
1023    compile_multilib: "both",
1024    multilib: {
1025        lib32: {
1026            suffix: "32",
1027        },
1028        lib64: {
1029            suffix: "64",
1030        },
1031    },
1032    test_suites: ["general-tests"],
1033}
1034
1035rust_test {
1036    name: "aidl_test_rust_service",
1037    test_harness: false,
1038    srcs: [
1039        "tests/rust/test_service.rs",
1040    ],
1041    rustlibs: [
1042        "aidl-test-interface-rust",
1043        "aidl-test-versioned-interface-V1-rust",
1044        "aidl-test-fixedsizearray-rust",
1045        "aidl_test_vintf_parcelable-V1-rust",
1046        "android.aidl.test.trunk-V2-rust",
1047        "liblibc",
1048        "libsimple_parcelable_rust",
1049    ],
1050    prefer_rlib: true,
1051    compile_multilib: "both",
1052    multilib: {
1053        lib32: {
1054            suffix: "32",
1055        },
1056        lib64: {
1057            suffix: "64",
1058        },
1059    },
1060    test_suites: ["general-tests"],
1061}
1062
1063rust_test {
1064    name: "aidl_test_rust_service_async",
1065    test_harness: false,
1066    srcs: [
1067        "tests/rust/test_service_async.rs",
1068    ],
1069    rustlibs: [
1070        "aidl-test-interface-rust",
1071        "aidl-test-versioned-interface-V1-rust",
1072        "aidl-test-fixedsizearray-rust",
1073        "aidl_test_vintf_parcelable-V1-rust",
1074        "android.aidl.test.trunk-V2-rust",
1075        "liblibc",
1076        "libbinder_tokio_rs",
1077        "libsimple_parcelable_rust",
1078        "libtokio",
1079    ],
1080    proc_macros: ["libasync_trait"],
1081    prefer_rlib: true,
1082    compile_multilib: "both",
1083    multilib: {
1084        lib32: {
1085            suffix: "32",
1086        },
1087        lib64: {
1088            suffix: "64",
1089        },
1090    },
1091    test_suites: ["general-tests"],
1092}
1093
1094cc_library_static {
1095    name: "aidl-analyzer-main",
1096    host_supported: true,
1097    vendor_available: true,
1098    shared_libs: [
1099        "libbase",
1100        "libbinder",
1101    ],
1102    srcs: [
1103        "analyzer/analyzerMain.cpp",
1104        "analyzer/Analyzer.cpp",
1105    ],
1106    export_include_dirs: ["analyzer/include"],
1107}
1108
1109cc_binary {
1110    name: "record_binder",
1111    whole_static_libs: ["aidl-analyzer-main"],
1112    shared_libs: [
1113        "libbase",
1114        "libbinder",
1115        "libutils",
1116    ],
1117}
1118
1119dirgroup {
1120    name: "trusty_dirgroup_system_tools_aidl",
1121    dirs: ["."],
1122    visibility: ["//trusty/vendor/google/aosp/scripts"],
1123}
1124