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 "aidl-bugs@google.com", 228 ], 229 triage_assignee: "smoreland@google.com", 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 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 export_include_dirs: ["trace"], 315 apex_available: [ 316 "//apex_available:platform", 317 "//apex_available:anyapex", 318 ], 319} 320 321cc_library { 322 name: "libsimpleparcelable", 323 export_include_dirs: [ 324 ".", 325 ], 326 srcs: [ 327 "tests/bad_parcelable.cpp", 328 "tests/simple_parcelable.cpp", 329 ], 330 shared_libs: [ 331 "libbase", 332 "libbinder", 333 "libutils", 334 ], 335} 336 337java_library { 338 name: "libsimpleparcelable_java", 339 srcs: [ 340 "tests/java/src/android/aidl/tests/BadParcelable.java", 341 "tests/java/src/android/aidl/tests/SimpleParcelable.java", 342 "tests/java/src/android/aidl/tests/generic/Pair.java", 343 ], 344} 345 346cc_library { 347 name: "libsimpleparcelable_ndk", 348 export_include_dirs: [ 349 ".", 350 ], 351 srcs: [ 352 "tests/simple_parcelable_ndk.cpp", 353 ], 354 shared_libs: [ 355 "libbase", 356 "libbinder_ndk", 357 ], 358} 359 360rust_library { 361 name: "libsimple_parcelable_rust", 362 crate_name: "simple_parcelable", 363 srcs: [ 364 "tests/rust/simple_parcelable.rs", 365 ], 366 rustlibs: [ 367 "libbinder_rs", 368 ], 369} 370 371aidl_interface { 372 name: "aidl-test-interface", 373 unstable: true, 374 flags: ["-Werror"], 375 srcs: [ 376 "tests/android/aidl/tests/ArrayOfInterfaces.aidl", 377 "tests/android/aidl/tests/BackendType.aidl", 378 "tests/android/aidl/tests/ByteEnum.aidl", 379 "tests/android/aidl/tests/CircularParcelable.aidl", 380 "tests/android/aidl/tests/ConstantExpressionEnum.aidl", 381 "tests/android/aidl/tests/DeprecatedEnum.aidl", 382 "tests/android/aidl/tests/DeprecatedParcelable.aidl", 383 "tests/android/aidl/tests/GenericStructuredParcelable.aidl", 384 "tests/android/aidl/tests/FixedSize.aidl", 385 "tests/android/aidl/tests/ICircular.aidl", 386 "tests/android/aidl/tests/IDeprecated.aidl", 387 "tests/android/aidl/tests/INamedCallback.aidl", 388 "tests/android/aidl/tests/INewName.aidl", 389 "tests/android/aidl/tests/IOldName.aidl", 390 "tests/android/aidl/tests/ITestService.aidl", 391 "tests/android/aidl/tests/IntEnum.aidl", 392 "tests/android/aidl/tests/ListOfInterfaces.aidl", 393 "tests/android/aidl/tests/LongEnum.aidl", 394 "tests/android/aidl/tests/OtherParcelableForToString.aidl", 395 "tests/android/aidl/tests/ParcelableForToString.aidl", 396 "tests/android/aidl/tests/RecursiveList.aidl", 397 "tests/android/aidl/tests/StructuredParcelable.aidl", 398 "tests/android/aidl/tests/Union.aidl", 399 "tests/android/aidl/tests/UnionWithFd.aidl", 400 "tests/android/aidl/tests/extension/*.aidl", 401 "tests/android/aidl/tests/nested/*.aidl", 402 "tests/android/aidl/tests/unions/*.aidl", 403 ], 404 local_include_dir: "tests", 405 backend: { 406 cpp: { 407 additional_shared_libraries: [ 408 "libsimpleparcelable", 409 ], 410 }, 411 java: { 412 additional_libs: [ 413 "libsimpleparcelable_java", 414 ], 415 platform_apis: true, 416 }, 417 rust: { 418 enabled: true, 419 additional_rustlibs: [ 420 "libsimple_parcelable_rust", 421 ], 422 }, 423 ndk: { 424 apps_enabled: false, 425 additional_shared_libraries: [ 426 "libsimpleparcelable_ndk", 427 ], 428 }, 429 }, 430} 431 432aidl_interface { 433 name: "aidl-cpp-java-test-interface", 434 unstable: true, 435 srcs: [ 436 "tests/android/aidl/tests/BadParcelable.aidl", 437 "tests/android/aidl/tests/ICppJavaTests.aidl", 438 ], 439 local_include_dir: "tests", 440 include_dirs: [ 441 "frameworks/native/aidl/binder", 442 ], 443 imports: ["aidl-test-interface"], 444 backend: { 445 cpp: { 446 additional_shared_libraries: ["libsimpleparcelable"], 447 enabled: true, 448 }, 449 java: { 450 additional_libs: [ 451 "libsimpleparcelable_java", 452 ], 453 platform_apis: true, 454 enabled: true, 455 }, 456 rust: { 457 enabled: false, 458 }, 459 ndk: { 460 enabled: false, 461 }, 462 }, 463} 464 465aidl_interface { 466 name: "aidl-test-interface-permission", 467 srcs: [ 468 "tests/android/aidl/tests/permission/**/*.aidl", 469 ], 470 unstable: true, 471 flags: ["-Werror"], 472 include_dirs: [ 473 "frameworks/base/core/java", 474 ], 475 local_include_dir: "tests", 476 backend: { 477 cpp: { 478 enabled: false, 479 }, 480 java: { 481 platform_apis: true, 482 }, 483 rust: { 484 enabled: false, 485 }, 486 ndk: { 487 enabled: false, 488 }, 489 }, 490} 491 492aidl_interface { 493 name: "aidl-test-versioned-interface", 494 local_include_dir: "tests/versioned", 495 flags: ["-Werror"], 496 srcs: [ 497 "tests/versioned/**/*.aidl", 498 ], 499 500 backend: { 501 java: { 502 gen_rpc: true, 503 }, 504 rust: { 505 enabled: true, 506 }, 507 }, 508 versions_with_info: [ 509 { 510 version: "1", 511 imports: [], 512 }, 513 { 514 version: "2", 515 imports: [], 516 }, 517 { 518 version: "3", 519 imports: [], 520 }, 521 522 ], 523 frozen: true, 524 525} 526 527cc_test { 528 name: "aidl_test_service", 529 gtest: false, 530 defaults: ["aidl_test_defaults"], 531 static_libs: [ 532 "aidl-test-interface-cpp", 533 "aidl-cpp-java-test-interface-cpp", 534 "libsimpleparcelable", 535 "libcutils", 536 // service uses the old version 537 "aidl-test-versioned-interface-V1-cpp", 538 "aidl_test_loggable_interface-cpp", 539 "aidl-test-fixedsizearray-cpp", 540 "android.aidl.test.trunk-V2-cpp", 541 ], 542 srcs: ["tests/aidl_test_service.cpp"], 543} 544 545cc_test { 546 name: "aidl_test_service_ndk", 547 gtest: false, 548 defaults: ["aidl_test_defaults"], 549 shared_libs: [ 550 "libbinder_ndk", 551 "libcutils", 552 ], 553 static_libs: [ 554 // service uses the old version 555 "aidl-test-versioned-interface-V1-ndk", 556 "aidl-test-interface-ndk", 557 "aidl_test_loggable_interface-ndk", 558 "aidl-test-fixedsizearray-ndk", 559 "android.aidl.test.trunk-V2-ndk", 560 "libsimpleparcelable_ndk", 561 ], 562 srcs: ["tests/aidl_test_service_ndk.cpp"], 563} 564 565cc_test { 566 name: "aidl_test_client", 567 defaults: ["aidl_test_defaults"], 568 static_libs: [ 569 "aidl-test-interface-cpp", 570 "aidl-cpp-java-test-interface-cpp", 571 "libsimpleparcelable", 572 "libcutils", 573 "libgmock", 574 // client uses the latest version 575 "aidl-test-versioned-interface-V2-cpp", 576 "aidl_test_loggable_interface-cpp", 577 "aidl-test-fixedsizearray-cpp", 578 "android.aidl.test.trunk-V2-cpp", 579 ], 580 product_variables: { 581 release_aidl_use_unfrozen: { 582 cflags: ["-DAIDL_USE_UNFROZEN"], 583 }, 584 }, 585 tidy_timeout_srcs: [ 586 "tests/aidl_test_client_parcelables.cpp", 587 "tests/aidl_test_client_primitives.cpp", 588 ], 589 srcs: [ 590 "tests/aidl_test_client.cpp", 591 "tests/aidl_test_client_builtin_transactions.cpp", 592 "tests/aidl_test_client_file_descriptors.cpp", 593 "tests/aidl_test_client_parcelables.cpp", 594 "tests/aidl_test_client_nullables.cpp", 595 "tests/aidl_test_client_primitives.cpp", 596 "tests/aidl_test_client_utf8_strings.cpp", 597 "tests/aidl_test_client_service_exceptions.cpp", 598 "tests/aidl_test_client_defaultimpl.cpp", 599 "tests/aidl_test_client_delegate.cpp", 600 "tests/aidl_test_client_versioned_interface.cpp", 601 "tests/aidl_test_client_renamed_interface.cpp", 602 "tests/aidl_test_client_loggable_interface.cpp", 603 "tests/aidl_test_client_nested.cpp", 604 "tests/aidl_test_client_trunk_stable.cpp", 605 ], 606 cflags: ["-DAIDL_USE_V2_INTERFACE"], 607} 608 609cc_test { 610 name: "aidl_test_v1_client", 611 defaults: ["aidl_test_defaults"], 612 static_libs: [ 613 "aidl-test-interface-cpp", 614 "aidl-cpp-java-test-interface-cpp", 615 "libsimpleparcelable", 616 "libcutils", 617 "libgmock", 618 "android.aidl.test.trunk-V1-cpp", 619 ], 620 product_variables: { 621 release_aidl_use_unfrozen: { 622 cflags: ["-DAIDL_USE_UNFROZEN"], 623 }, 624 }, 625 srcs: [ 626 "tests/aidl_test_client_trunk_stable.cpp", 627 "tests/aidl_test_client.cpp", 628 ], 629} 630 631cc_test { 632 name: "aidl_test_client_ndk", 633 defaults: ["aidl_test_defaults"], 634 static_libs: [ 635 "libcutils", 636 "libgmock", 637 // client uses the latest version 638 "aidl-test-versioned-interface-V2-ndk", 639 "aidl-test-interface-ndk", 640 "aidl_test_loggable_interface-ndk", 641 "aidl-test-fixedsizearray-ndk", 642 "android.aidl.test.trunk-V2-ndk", 643 "libsimpleparcelable_ndk", 644 ], 645 shared_libs: [ 646 "libbinder_ndk", 647 ], 648 product_variables: { 649 release_aidl_use_unfrozen: { 650 cflags: ["-DAIDL_USE_UNFROZEN"], 651 }, 652 }, 653 srcs: [ 654 "tests/aidl_test_client_ndk_delegate.cpp", 655 "tests/aidl_test_client_ndk_loggable_interface.cpp", 656 "tests/aidl_test_client_ndk_nested.cpp", 657 "tests/aidl_test_client_ndk_nullables.cpp", 658 "tests/aidl_test_client_ndk_parcelables.cpp", 659 "tests/aidl_test_client_ndk_primitives_test.cpp", 660 "tests/aidl_test_client_ndk_strings_test.cpp", 661 "tests/aidl_test_client_ndk_versioned_interface.cpp", 662 "tests/aidl_test_client_ndk_trunk_stable.cpp", 663 ], 664} 665 666aidl_interface { 667 name: "aidl-test-fixedsizearray", 668 srcs: ["tests/android/aidl/fixedsizearray/FixedSizeArrayExample.aidl"], 669 local_include_dir: "tests", 670 unstable: true, 671 backend: { 672 cpp: { 673 enabled: true, 674 }, 675 java: { 676 enabled: true, 677 }, 678 ndk: { 679 enabled: true, 680 }, 681 rust: { 682 enabled: true, 683 }, 684 }, 685} 686 687java_defaults { 688 name: "aidl_test_java_integration_defaults", 689 platform_apis: true, 690 // Turn off Java optimization tools to speed up our test iterations. 691 optimize: { 692 enabled: false, 693 }, 694 dex_preopt: { 695 enabled: false, 696 }, 697 static_libs: [ 698 "androidx.test.core", 699 "androidx.test.runner", 700 ], 701 aidl: { 702 include_dirs: [ 703 "frameworks/native/aidl/binder", 704 ], 705 }, 706 test_suites: ["general-tests"], 707} 708 709java_defaults { 710 name: "aidl_test_java_defaults", 711 defaults: ["aidl_test_java_integration_defaults"], 712 static_libs: [ 713 "aidl_test_nonvintf_parcelable-V1-java", 714 "aidl_test_unstable_parcelable-java", 715 "aidl_test_vintf_parcelable-V1-java", 716 "aidl-test-fixedsizearray-java", 717 "aidl-cpp-java-test-interface-java", 718 // TODO: remove once Android migrates to JUnit 4.12, 719 // which provides assertThrows 720 "testng", 721 ], 722} 723 724java_test { 725 name: "aidl_test_java_client", 726 defaults: ["aidl_test_java_defaults"], 727 static_libs: [ 728 "aidl-test-extras-java", 729 // client uses the new version 730 "aidl-test-versioned-interface-V3-java", 731 "android.aidl.test.trunk-V2-java", 732 ], 733 // tests are included in defaults 734 srcs: [ 735 "tests/java/src/android/aidl/tests/MapTests.java", 736 "tests/java/src/android/aidl/tests/TestServiceClient.java", 737 "tests/java/src/android/aidl/tests/JavaOnlyImmutableAnnotationTests.java", 738 "tests/java/src/android/aidl/tests/AidlJavaTests.java", 739 "tests/java/src/android/aidl/tests/BuiltInTests.java", 740 "tests/java/src/android/aidl/tests/DelegatorTests.java", 741 "tests/java/src/android/aidl/tests/GenericTests.java", 742 "tests/java/src/android/aidl/tests/NestedTypesTests.java", 743 "tests/java/src/android/aidl/tests/TestVersionedInterface.java", 744 "tests/java/src/android/aidl/tests/TrunkStableTests.java", 745 "tests/java/src/android/aidl/tests/UnionTests.java", 746 "tests/java/src/android/aidl/tests/ExtensionTests.java", 747 "tests/java/src/android/aidl/tests/NullableTests.java", 748 "tests/java/src/android/aidl/tests/VintfTests.java", 749 "tests/java/src/android/aidl/tests/ServiceManagerNativeTests.java", 750 ], 751 data: [ 752 ":cts-dalvik-device-test-runner", 753 ], 754} 755 756java_test { 757 name: "aidl_test_java_service", 758 defaults: ["aidl_test_java_defaults"], 759 static_libs: [ 760 // service uses the old version 761 "aidl-test-versioned-interface-V1-java", 762 "android.aidl.test.trunk-V2-java", 763 ], 764 srcs: [ 765 "tests/java/src/android/aidl/service/**/*.java", 766 ], 767 data: [ 768 ":cts-dalvik-device-test-runner", 769 ], 770} 771 772filegroup { 773 name: "aidl-for-sdkversion-tests", 774 srcs: [ 775 "tests/java/src/android/aidl/sdkversion/ITestService.aidl", 776 ], 777 path: "tests/java/src", 778} 779 780java_defaults { 781 name: "aidl_test_java_sdkversion_defaults", 782 defaults: ["aidl_test_java_integration_defaults"], 783 srcs: [ 784 ":aidl-for-sdkversion-tests", 785 ], 786} 787 788java_test { 789 name: "aidl_test_java_client_sdk29", 790 defaults: ["aidl_test_java_sdkversion_defaults"], 791 min_sdk_version: "29", 792 data: [ 793 ":cts-dalvik-device-test-runner", 794 ], 795 srcs: [ 796 "tests/java/src/android/aidl/sdkversion/tests/*.java", 797 ], 798} 799 800java_test { 801 name: "aidl_test_java_service_sdk29", 802 defaults: ["aidl_test_java_sdkversion_defaults"], 803 min_sdk_version: "29", 804 srcs: [ 805 "tests/java/src/android/aidl/sdkversion/service/*.java", 806 ], 807 data: [ 808 ":cts-dalvik-device-test-runner", 809 ], 810} 811 812java_test { 813 name: "aidl_test_java_client_sdk1", 814 defaults: ["aidl_test_java_sdkversion_defaults"], 815 min_sdk_version: "1", 816 srcs: [ 817 "tests/java/src/android/aidl/sdkversion/tests/*.java", 818 ], 819 data: [ 820 ":cts-dalvik-device-test-runner", 821 ], 822} 823 824java_test { 825 name: "aidl_test_java_service_sdk1", 826 defaults: ["aidl_test_java_sdkversion_defaults"], 827 min_sdk_version: "1", 828 data: [ 829 ":cts-dalvik-device-test-runner", 830 ], 831 srcs: [ 832 "tests/java/src/android/aidl/sdkversion/service/*.java", 833 ], 834} 835 836java_test { 837 name: "aidl_test_java_client_permission", 838 defaults: ["aidl_test_java_integration_defaults"], 839 static_libs: [ 840 "aidl-test-interface-permission-java", 841 "frameworks-base-testutils", 842 ], 843 srcs: [ 844 "tests/java/src/android/aidl/permission/tests/*.java", 845 "tests/java/src/android/aidl/permission/service/*.java", 846 ], 847 data: [ 848 ":cts-dalvik-device-test-runner", 849 ], 850} 851 852java_test { 853 name: "aidl_test_java_service_permission", 854 defaults: ["aidl_test_java_integration_defaults"], 855 static_libs: [ 856 "aidl-test-interface-permission-java", 857 "frameworks-base-testutils", 858 ], 859 data: [ 860 ":cts-dalvik-device-test-runner", 861 ], 862 srcs: [ 863 "tests/java/src/android/aidl/permission/service/*.java", 864 ], 865} 866 867// 868// "Golden" test of compiler output 869// 870 871sh_binary_host { 872 name: "aidl-golden-test", 873 src: "tests/golden_test.sh", 874} 875 876genrule { 877 name: "aidl-golden-test-build-hook-gen", 878 tools: ["aidl-golden-test"], 879 880 // We don't have access to TARGET_RELEASE in the script when it's called from this 881 // hook, so we pass it explicitly. All the script needs to know is whether or not 882 // $TARGET_RELEASE is "next" 883 product_variables: { 884 release_aidl_use_unfrozen: { 885 cmd: "TARGET_RELEASE=trunk_staging $(location aidl-golden-test) check $(in) && " + 886 "touch $(out)", 887 }, 888 }, 889 890 cmd: "TARGET_RELEASE=next $(location aidl-golden-test) check $(in) && touch $(out)", 891 srcs: [ 892 // warning: keep this list up to date with tests/golden_test.sh 893 ":aidl-test-interface-cpp-source", 894 ":aidl-test-interface-java-source", 895 ":aidl-test-interface-ndk-source", 896 ":aidl-test-interface-rust-source", 897 ":aidl-test-extras-java-source", 898 ":aidl-cpp-java-test-interface-cpp-source", 899 ":aidl-cpp-java-test-interface-java-source", 900 ":aidl-test-versioned-interface-V1-cpp-source", 901 ":aidl-test-versioned-interface-V1-java-source", 902 ":aidl-test-versioned-interface-V1-ndk-source", 903 ":aidl-test-versioned-interface-V1-rust-source", 904 ":aidl-test-versioned-interface-V2-cpp-source", 905 ":aidl-test-versioned-interface-V2-java-source", 906 ":aidl-test-versioned-interface-V2-ndk-source", 907 ":aidl-test-versioned-interface-V2-rust-source", 908 ":aidl-test-versioned-interface-V3-cpp-source", 909 ":aidl-test-versioned-interface-V3-java-source", 910 ":aidl-test-versioned-interface-V3-ndk-source", 911 ":aidl-test-versioned-interface-V3-rust-source", 912 ":aidl_test_loggable_interface-cpp-source", 913 ":aidl_test_loggable_interface-java-source", 914 ":aidl_test_loggable_interface-ndk-source", 915 ":aidl-test-interface-permission-java-source", 916 ":aidl-test-fixedsizearray-cpp-source", 917 ":aidl-test-fixedsizearray-java-source", 918 ":aidl-test-fixedsizearray-ndk-source", 919 ":aidl-test-fixedsizearray-rust-source", 920 ":aidl-test-interface-cpp-analyzer-source", 921 ":android.aidl.test.trunk-V1-cpp-source", 922 ":android.aidl.test.trunk-V2-cpp-source", 923 ":android.aidl.test.trunk-V1-ndk-source", 924 ":android.aidl.test.trunk-V2-ndk-source", 925 ":android.aidl.test.trunk-V1-java-source", 926 ":android.aidl.test.trunk-V2-java-source", 927 ":android.aidl.test.trunk-V1-rust-source", 928 ":android.aidl.test.trunk-V2-rust-source", 929 "tests/golden_output/**/*", 930 ], 931 out: ["aidl_golden_test_stamp.txt"], 932} 933 934// 935// Testing generation of logs 936// 937 938aidl_interface { 939 name: "aidl_test_loggable_interface", 940 unstable: true, 941 local_include_dir: "tests", 942 flags: ["-Werror"], 943 srcs: [ 944 "tests/android/aidl/loggable/ILoggableInterface.aidl", 945 "tests/android/aidl/loggable/Data.aidl", 946 "tests/android/aidl/loggable/Enum.aidl", 947 "tests/android/aidl/loggable/Union.aidl", 948 ], 949 gen_trace: true, 950 backend: { 951 cpp: { 952 gen_log: true, 953 }, 954 ndk: { 955 gen_log: true, 956 }, 957 java: { 958 platform_apis: true, 959 }, 960 }, 961} 962 963aidl_interface { 964 name: "aidl-test-extras", 965 unstable: true, 966 flags: ["-Werror"], 967 srcs: [ 968 "tests/android/aidl/tests/generic/*.aidl", 969 "tests/android/aidl/tests/immutable/*.aidl", 970 "tests/android/aidl/tests/map/*.aidl", 971 ], 972 local_include_dir: "tests", 973 // Map is only valid for Java for now 974 backend: { 975 cpp: { 976 enabled: false, 977 }, 978 java: { 979 additional_libs: [ 980 "libsimpleparcelable_java", 981 ], 982 platform_apis: true, 983 }, 984 rust: { 985 enabled: false, 986 }, 987 ndk: { 988 enabled: false, 989 }, 990 }, 991} 992 993// 994// Rust tests 995// 996 997rust_test { 998 name: "aidl_test_rust_client", 999 srcs: [ 1000 "tests/rust/test_client.rs", 1001 ], 1002 rustlibs: [ 1003 "aidl-test-interface-rust", 1004 "aidl-test-versioned-interface-V2-rust", 1005 "aidl_test_nonvintf_parcelable-V1-rust", 1006 "aidl_test_unstable_parcelable-rust", 1007 "aidl_test_vintf_parcelable-V1-rust", 1008 "aidl-test-fixedsizearray-rust", 1009 "android.aidl.test.trunk-V2-rust", 1010 "liblibc", 1011 // We need to import binder_rs directly 1012 // for a few internal types like Parcel 1013 // and traits like Parcelable 1014 "libbinder_rs", 1015 "libsimple_parcelable_rust", 1016 ], 1017 prefer_rlib: true, 1018 compile_multilib: "both", 1019 multilib: { 1020 lib32: { 1021 suffix: "32", 1022 }, 1023 lib64: { 1024 suffix: "64", 1025 }, 1026 }, 1027 test_suites: ["general-tests"], 1028} 1029 1030rust_test { 1031 name: "aidl_test_rust_service", 1032 test_harness: false, 1033 srcs: [ 1034 "tests/rust/test_service.rs", 1035 ], 1036 rustlibs: [ 1037 "aidl-test-interface-rust", 1038 "aidl-test-versioned-interface-V1-rust", 1039 "aidl-test-fixedsizearray-rust", 1040 "android.aidl.test.trunk-V2-rust", 1041 "liblibc", 1042 "libsimple_parcelable_rust", 1043 ], 1044 prefer_rlib: true, 1045 compile_multilib: "both", 1046 multilib: { 1047 lib32: { 1048 suffix: "32", 1049 }, 1050 lib64: { 1051 suffix: "64", 1052 }, 1053 }, 1054 test_suites: ["general-tests"], 1055} 1056 1057rust_test { 1058 name: "aidl_test_rust_service_async", 1059 test_harness: false, 1060 srcs: [ 1061 "tests/rust/test_service_async.rs", 1062 ], 1063 rustlibs: [ 1064 "aidl-test-interface-rust", 1065 "aidl-test-versioned-interface-V1-rust", 1066 "aidl-test-fixedsizearray-rust", 1067 "android.aidl.test.trunk-V2-rust", 1068 "liblibc", 1069 "libbinder_tokio_rs", 1070 "libsimple_parcelable_rust", 1071 "libtokio", 1072 ], 1073 proc_macros: ["libasync_trait"], 1074 prefer_rlib: true, 1075 compile_multilib: "both", 1076 multilib: { 1077 lib32: { 1078 suffix: "32", 1079 }, 1080 lib64: { 1081 suffix: "64", 1082 }, 1083 }, 1084 test_suites: ["general-tests"], 1085} 1086 1087cc_library_static { 1088 name: "aidl-analyzer-main", 1089 host_supported: true, 1090 vendor_available: true, 1091 shared_libs: [ 1092 "libbase", 1093 "libbinder", 1094 ], 1095 srcs: [ 1096 "analyzer/analyzerMain.cpp", 1097 "analyzer/Analyzer.cpp", 1098 ], 1099 export_include_dirs: ["analyzer/include"], 1100} 1101 1102cc_binary { 1103 name: "record_binder", 1104 whole_static_libs: ["aidl-analyzer-main"], 1105 shared_libs: [ 1106 "libbase", 1107 "libbinder", 1108 "libutils", 1109 ], 1110} 1111