Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 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 | |
Bob Badour | 01cffa3 | 2021-02-12 17:18:34 -0800 | [diff] [blame] | 17 | package { |
| 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 |
| 23 | license { |
| 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 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 34 | cc_defaults { |
| 35 | name: "aidl_defaults", |
Chih-Hung Hsieh | 1560796 | 2017-10-02 10:03:55 -0700 | [diff] [blame] | 36 | cflags: [ |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 37 | "-Wall", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 38 | "-Werror", |
Chih-Hung Hsieh | 1560796 | 2017-10-02 10:03:55 -0700 | [diff] [blame] | 39 | "-Wextra", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 40 | ], |
| 41 | whole_static_libs: ["libgtest_prod"], |
| 42 | static_libs: [ |
| 43 | "libbase", |
| 44 | "libcutils", |
Jooyung Han | b8a9777 | 2021-01-19 01:27:38 +0900 | [diff] [blame] | 45 | "libgtest", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 46 | ], |
Jooyung Han | 9969b9d | 2020-11-28 08:42:37 +0900 | [diff] [blame] | 47 | // TODO(b/174366536): basic_stringbuf::overflow causes "ubsan: implicit-conversion" |
| 48 | // sanitize: { |
| 49 | // integer_overflow: true, |
| 50 | // misc_undefined: ["integer"], |
| 51 | // }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 52 | target: { |
| 53 | windows: { |
| 54 | enabled: true, |
| 55 | }, |
Steven Moreland | b49a33d | 2019-08-21 11:17:32 -0700 | [diff] [blame] | 56 | host: { |
| 57 | cflags: [ |
| 58 | "-O0", |
| 59 | "-g", |
| 60 | ], |
| 61 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 62 | }, |
Steven Moreland | 1c89443 | 2020-02-14 11:32:44 -0800 | [diff] [blame] | 63 | product_variables: { |
| 64 | platform_sdk_version: { |
| 65 | cflags: ["-DPLATFORM_SDK_VERSION=%d"], |
| 66 | }, |
| 67 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | // Logic shared between aidl and its unittests |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 71 | cc_library_static { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 72 | name: "libaidl-common", |
| 73 | defaults: ["aidl_defaults"], |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 74 | host_supported: true, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 75 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 76 | srcs: [ |
Steven Moreland | 4958524 | 2019-12-18 16:06:49 -0800 | [diff] [blame] | 77 | "aidl_checkapi.cpp", |
Will McVicker | efd970d | 2019-09-25 15:28:30 -0700 | [diff] [blame] | 78 | "aidl_const_expressions.cpp", |
Jooyung Han | 1f56b70 | 2021-02-11 13:16:15 +0900 | [diff] [blame] | 79 | "aidl_dumpapi.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 80 | "aidl_language_l.ll", |
| 81 | "aidl_language_y.yy", |
Jooyung Han | 888c5bc | 2020-12-22 17:28:47 +0900 | [diff] [blame] | 82 | "aidl_language.cpp", |
| 83 | "aidl_to_cpp_common.cpp", |
Steven Moreland | 860b194 | 2018-08-16 14:59:28 -0700 | [diff] [blame] | 84 | "aidl_to_cpp.cpp", |
Jiyong Park | 1d2df7d | 2018-07-23 15:22:50 +0900 | [diff] [blame] | 85 | "aidl_to_java.cpp", |
Steven Moreland | e8a3a19 | 2018-09-20 14:14:28 -0700 | [diff] [blame] | 86 | "aidl_to_ndk.cpp", |
Andrei Homescu | b62afd9 | 2020-05-11 19:24:59 -0700 | [diff] [blame] | 87 | "aidl_to_rust.cpp", |
Jooyung Han | 888c5bc | 2020-12-22 17:28:47 +0900 | [diff] [blame] | 88 | "aidl_typenames.cpp", |
| 89 | "aidl.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 90 | "ast_cpp.cpp", |
| 91 | "ast_java.cpp", |
| 92 | "code_writer.cpp", |
Jooyung Han | d4fe00e | 2021-01-11 16:21:53 +0900 | [diff] [blame] | 93 | "comments.cpp", |
Jooyung Han | 888c5bc | 2020-12-22 17:28:47 +0900 | [diff] [blame] | 94 | "diagnostics.cpp", |
Andrei Onea | 8714b02 | 2019-02-01 18:55:54 +0000 | [diff] [blame] | 95 | "generate_aidl_mappings.cpp", |
Jooyung Han | 888c5bc | 2020-12-22 17:28:47 +0900 | [diff] [blame] | 96 | "generate_cpp.cpp", |
| 97 | "generate_java_binder.cpp", |
| 98 | "generate_java.cpp", |
| 99 | "generate_ndk.cpp", |
Andrei Homescu | b62afd9 | 2020-05-11 19:24:59 -0700 | [diff] [blame] | 100 | "generate_rust.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 101 | "import_resolver.cpp", |
Jooyung Han | 888c5bc | 2020-12-22 17:28:47 +0900 | [diff] [blame] | 102 | "io_delegate.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 103 | "line_reader.cpp", |
Jooyung Han | 535c5e8 | 2020-12-29 15:16:59 +0900 | [diff] [blame] | 104 | "location.cpp", |
Jiyong Park | 2a7c92b | 2020-07-22 19:12:36 +0900 | [diff] [blame] | 105 | "logging.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 106 | "options.cpp", |
Jiyong Park | e5c4529 | 2020-05-26 19:06:24 +0900 | [diff] [blame] | 107 | "parser.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 108 | ], |
Dan Willemsen | fad411f | 2019-04-12 14:40:55 -0700 | [diff] [blame] | 109 | yacc: { |
| 110 | gen_location_hh: true, |
| 111 | gen_position_hh: true, |
| 112 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | // aidl executable |
| 116 | cc_binary_host { |
| 117 | name: "aidl", |
| 118 | defaults: ["aidl_defaults"], |
Jiyong Park | 74595c1 | 2018-07-23 15:22:50 +0900 | [diff] [blame] | 119 | srcs: ["main.cpp"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 120 | static_libs: [ |
| 121 | "libaidl-common", |
| 122 | "libbase", |
Tom Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 123 | "liblog", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 124 | ], |
| 125 | } |
| 126 | |
Steven Moreland | bb654e3 | 2020-01-08 19:52:05 -0800 | [diff] [blame] | 127 | // aidl-cpp legacy executable, please use 'aidl' instead |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 128 | cc_binary_host { |
| 129 | name: "aidl-cpp", |
| 130 | defaults: ["aidl_defaults"], |
Steven Moreland | bb654e3 | 2020-01-08 19:52:05 -0800 | [diff] [blame] | 131 | srcs: ["main.cpp"], |
| 132 | cflags: ["-DAIDL_CPP_BUILD"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 133 | static_libs: [ |
| 134 | "libaidl-common", |
| 135 | "libbase", |
Tom Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 136 | "liblog", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 137 | ], |
| 138 | } |
| 139 | |
| 140 | // Unit tests |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 141 | cc_test { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 142 | name: "aidl_unittests", |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 143 | host_supported: true, |
| 144 | |
Steven Moreland | 2921b8b | 2020-03-10 16:12:47 -0700 | [diff] [blame] | 145 | test_suites: ["general-tests"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 146 | |
| 147 | cflags: [ |
| 148 | "-Wall", |
| 149 | "-Wextra", |
| 150 | "-Werror", |
| 151 | "-g", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 152 | ], |
Steven Moreland | 1c41e97 | 2018-07-09 16:07:00 -0700 | [diff] [blame] | 153 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 154 | srcs: [ |
| 155 | "aidl_unittest.cpp", |
| 156 | "ast_cpp_unittest.cpp", |
| 157 | "ast_java_unittest.cpp", |
Jiyong Park | 22b4ecd | 2018-07-23 23:34:42 +0900 | [diff] [blame] | 158 | "code_writer_unittest.cpp", |
Jooyung Han | 3557e48 | 2020-12-24 05:11:15 +0900 | [diff] [blame] | 159 | "diagnostics_unittest.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 160 | "generate_cpp_unittest.cpp", |
| 161 | "io_delegate_unittest.cpp", |
| 162 | "options_unittest.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 163 | "tests/fake_io_delegate.cpp", |
| 164 | "tests/main.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 165 | "tests/test_util.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 166 | ], |
| 167 | |
| 168 | static_libs: [ |
| 169 | "libaidl-common", |
| 170 | "libbase", |
| 171 | "libcutils", |
Steven Moreland | 57ec44a | 2019-10-25 15:50:21 -0700 | [diff] [blame] | 172 | "libgmock", |
Tom Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 173 | "liblog", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 174 | ], |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 175 | |
| 176 | required: ["aidl-golden-test-build-hook"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 177 | } |
| 178 | |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 179 | cc_fuzz { |
| 180 | name: "aidl_parser_fuzzer", |
| 181 | host_supported: true, |
| 182 | dictionary: "tests/aidl_parser_fuzzer.dict", |
Mitch Phillips | 17fad88 | 2019-12-18 11:27:40 -0800 | [diff] [blame] | 183 | corpus: [ |
| 184 | "tests/corpus/*", |
| 185 | ], |
Steven Moreland | 00f1ee7 | 2019-11-04 09:52:06 -0800 | [diff] [blame] | 186 | |
| 187 | fuzz_config: { |
| 188 | cc: [ |
Steven Moreland | a1e4987 | 2020-04-10 10:08:17 -0700 | [diff] [blame] | 189 | "devinmoore@google.com", |
Steven Moreland | 00f1ee7 | 2019-11-04 09:52:06 -0800 | [diff] [blame] | 190 | "smoreland@google.com", |
| 191 | "jiyong@google.com", |
| 192 | "jeongik@google.com", |
| 193 | ], |
| 194 | }, |
| 195 | |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 196 | srcs: [ |
| 197 | "tests/aidl_parser_fuzzer.cpp", |
| 198 | "tests/fake_io_delegate.cpp", |
| 199 | "tests/test_util.cpp", |
| 200 | ], |
| 201 | static_libs: [ |
| 202 | "libaidl-common", |
| 203 | "libbase", |
| 204 | "libcutils", |
Jooyung Han | b8a9777 | 2021-01-19 01:27:38 +0900 | [diff] [blame] | 205 | "libgtest", |
Tom Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 206 | "liblog", |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 207 | ], |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 208 | // Enable this to show additional information about what is being parsed during fuzzing. |
| 209 | // cflags: ["-DFUZZ_LOG"], |
| 210 | } |
| 211 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 212 | // |
Steven Moreland | 9866fcd | 2020-03-10 16:51:48 -0700 | [diff] [blame] | 213 | // Integration testing of generated AIDL code. |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 214 | // |
Steven Moreland | 9866fcd | 2020-03-10 16:51:48 -0700 | [diff] [blame] | 215 | |
| 216 | python_test_host { |
| 217 | name: "aidl_integration_test", |
| 218 | main: "tests/aidl_integration_test.py", |
| 219 | srcs: ["tests/aidl_integration_test.py"], |
| 220 | test_config: "tests/aidl_integration_test.xml", |
| 221 | target_required: [ |
| 222 | "aidl_test_client", |
Steven Moreland | 9866fcd | 2020-03-10 16:51:48 -0700 | [diff] [blame] | 223 | "aidl_test_service", |
Steven Moreland | f1a18c7 | 2021-02-04 02:38:52 +0000 | [diff] [blame] | 224 | "aidl_test_java_client", |
| 225 | "aidl_test_java_service", |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 226 | "aidl_test_rust_client", |
| 227 | "aidl_test_rust_service", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 228 | ], |
Steven Moreland | 5762001 | 2020-09-29 00:22:34 +0000 | [diff] [blame] | 229 | test_suites: ["general-tests"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 230 | } |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 231 | |
| 232 | cc_defaults { |
| 233 | name: "aidl_test_defaults", |
| 234 | cflags: [ |
| 235 | "-Wall", |
| 236 | "-Wextra", |
| 237 | "-Werror", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 238 | ], |
| 239 | shared_libs: [ |
| 240 | "libbase", |
| 241 | "libbinder", |
| 242 | "liblog", |
| 243 | "libutils", |
| 244 | ], |
Steven Moreland | 9866fcd | 2020-03-10 16:51:48 -0700 | [diff] [blame] | 245 | compile_multilib: "both", |
| 246 | multilib: { |
| 247 | lib32: { |
| 248 | suffix: "32", |
| 249 | }, |
| 250 | lib64: { |
| 251 | suffix: "64", |
| 252 | }, |
| 253 | }, |
Steven Moreland | 5762001 | 2020-09-29 00:22:34 +0000 | [diff] [blame] | 254 | test_suites: ["general-tests"], |
Steven Moreland | 9866fcd | 2020-03-10 16:51:48 -0700 | [diff] [blame] | 255 | } |
| 256 | |
Devin Moore | e337b7c | 2020-05-14 13:52:02 -0700 | [diff] [blame] | 257 | // Header-only library used for atrace in platform NDK builds |
| 258 | cc_library_headers { |
| 259 | name: "libandroid_aidltrace", |
| 260 | host_supported: true, |
| 261 | vendor_available: true, |
| 262 | export_include_dirs: ["trace"], |
Devin Moore | 40735df | 2020-05-15 09:12:57 -0700 | [diff] [blame] | 263 | apex_available: [ |
| 264 | "//apex_available:platform", |
| 265 | "//apex_available:anyapex", |
| 266 | ], |
Devin Moore | e337b7c | 2020-05-14 13:52:02 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Dan Willemsen | c46b65e | 2019-06-06 10:55:58 -0700 | [diff] [blame] | 269 | filegroup { |
| 270 | name: "libaidl-integration-test-files", |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 271 | srcs: [ |
Jooyung Han | 26fc445 | 2020-10-31 03:56:04 +0900 | [diff] [blame] | 272 | "tests/android/aidl/tests/BackendType.aidl", |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 273 | "tests/android/aidl/tests/ByteEnum.aidl", |
| 274 | "tests/android/aidl/tests/ConstantExpressionEnum.aidl", |
| 275 | "tests/android/aidl/tests/GenericStructuredParcelable.aidl", |
| 276 | "tests/android/aidl/tests/INamedCallback.aidl", |
| 277 | "tests/android/aidl/tests/INewName.aidl", |
| 278 | "tests/android/aidl/tests/IntEnum.aidl", |
| 279 | "tests/android/aidl/tests/IOldName.aidl", |
| 280 | "tests/android/aidl/tests/ITestService.aidl", |
| 281 | "tests/android/aidl/tests/LongEnum.aidl", |
| 282 | "tests/android/aidl/tests/OtherParcelableForToString.aidl", |
| 283 | "tests/android/aidl/tests/ParcelableForToString.aidl", |
| 284 | "tests/android/aidl/tests/StructuredParcelable.aidl", |
Jooyung Han | f93b5bd | 2020-10-28 15:12:08 +0900 | [diff] [blame] | 285 | "tests/android/aidl/tests/Union.aidl", |
| 286 | "tests/android/aidl/tests/UnionWithFd.aidl", |
Jooyung Han | 53fb424 | 2020-12-17 16:03:49 +0900 | [diff] [blame] | 287 | "tests/android/aidl/tests/unions/*.aidl", |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 288 | ], |
| 289 | path: "tests", |
| 290 | } |
| 291 | |
| 292 | filegroup { |
| 293 | name: "libaidl-integration-cpp-java-test-files", |
| 294 | srcs: [ |
| 295 | "tests/android/aidl/tests/ICppJavaTests.aidl", |
| 296 | "tests/android/aidl/tests/SimpleParcelable.aidl", |
| 297 | "tests/android/aidl/tests/extension/*.aidl", |
| 298 | ], |
Dan Willemsen | c46b65e | 2019-06-06 10:55:58 -0700 | [diff] [blame] | 299 | path: "tests", |
| 300 | } |
| 301 | |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 302 | aidl_interface { |
| 303 | name: "aidl-test-versioned-interface", |
| 304 | local_include_dir: "tests/versioned", |
Jooyung Han | 0872ba8 | 2021-02-24 11:50:47 +0900 | [diff] [blame] | 305 | flags: ["-Werror"], |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 306 | srcs: [ |
| 307 | "tests/versioned/**/*.aidl", |
| 308 | ], |
| 309 | versions: [ |
| 310 | "1", |
| 311 | "2", |
| 312 | ], |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 313 | backend: { |
| 314 | rust: { |
| 315 | enabled: true, |
| 316 | }, |
| 317 | }, |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 318 | } |
| 319 | |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 320 | cc_library_static { |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 321 | name: "libaidl-integration-test", |
| 322 | defaults: ["aidl_test_defaults"], |
| 323 | aidl: { |
Devin Moore | e2ccf8a | 2020-05-13 14:28:20 -0700 | [diff] [blame] | 324 | generate_traces: true, |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 325 | export_aidl_headers: true, |
| 326 | local_include_dirs: ["tests"], |
| 327 | include_dirs: ["frameworks/native/aidl/binder"], |
| 328 | }, |
| 329 | srcs: [ |
Dan Willemsen | c46b65e | 2019-06-06 10:55:58 -0700 | [diff] [blame] | 330 | ":libaidl-integration-test-files", |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 331 | ":libaidl-integration-cpp-java-test-files", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 332 | "tests/simple_parcelable.cpp", |
| 333 | ], |
| 334 | } |
| 335 | |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 336 | cc_test { |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 337 | name: "aidl_test_service", |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 338 | gtest: false, |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 339 | defaults: ["aidl_test_defaults"], |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 340 | static_libs: [ |
| 341 | "libaidl-integration-test", |
| 342 | "libcutils", |
| 343 | // service uses the old version |
| 344 | "aidl-test-versioned-interface-V1-cpp", |
Jooyung Han | 26fc445 | 2020-10-31 03:56:04 +0900 | [diff] [blame] | 345 | "aidl_test_loggable_interface-cpp", |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 346 | ], |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 347 | srcs: ["tests/aidl_test_service.cpp"], |
| 348 | } |
| 349 | |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 350 | cc_test { |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 351 | name: "aidl_test_client", |
| 352 | defaults: ["aidl_test_defaults"], |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 353 | static_libs: [ |
| 354 | "libaidl-integration-test", |
| 355 | "libcutils", |
Jiyong Park | 7c8a2e1 | 2020-07-28 18:15:20 +0900 | [diff] [blame] | 356 | "libgmock", |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 357 | // client uses the latest version |
Jeongik Cha | 1887cc7 | 2021-01-26 23:06:25 +0900 | [diff] [blame] | 358 | "aidl-test-versioned-interface-V2-cpp", |
Jooyung Han | 26fc445 | 2020-10-31 03:56:04 +0900 | [diff] [blame] | 359 | "aidl_test_loggable_interface-cpp" |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 360 | ], |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 361 | srcs: [ |
| 362 | "tests/aidl_test_client.cpp", |
| 363 | "tests/aidl_test_client_file_descriptors.cpp", |
| 364 | "tests/aidl_test_client_parcelables.cpp", |
| 365 | "tests/aidl_test_client_nullables.cpp", |
| 366 | "tests/aidl_test_client_primitives.cpp", |
| 367 | "tests/aidl_test_client_utf8_strings.cpp", |
| 368 | "tests/aidl_test_client_service_exceptions.cpp", |
Jiyong Park | 75e1a74 | 2018-07-04 12:31:23 +0900 | [diff] [blame] | 369 | "tests/aidl_test_client_defaultimpl.cpp", |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 370 | "tests/aidl_test_client_versioned_interface.cpp", |
Jiyong Park | 27fd7fd | 2020-08-27 16:25:09 +0900 | [diff] [blame] | 371 | "tests/aidl_test_client_renamed_interface.cpp", |
Jooyung Han | 26fc445 | 2020-10-31 03:56:04 +0900 | [diff] [blame] | 372 | "tests/aidl_test_client_loggable_interface.cpp", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 373 | ], |
| 374 | } |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 375 | |
Jooyung Han | 26f792e | 2021-02-25 16:46:02 +0900 | [diff] [blame] | 376 | cc_test { |
| 377 | name: "aidl_test_client_ndk", |
| 378 | defaults: ["aidl_test_defaults"], |
| 379 | static_libs: [ |
| 380 | "libcutils", |
| 381 | "libgmock", |
| 382 | "aidl-test-interface-ndk_platform", |
| 383 | "aidl_test_loggable_interface-ndk_platform" |
| 384 | ], |
| 385 | shared_libs: [ |
| 386 | "libbinder_ndk", |
| 387 | ], |
| 388 | srcs: [ |
| 389 | "tests/aidl_test_client_ndk_loggable_interface.cpp", |
| 390 | ], |
| 391 | } |
| 392 | |
Steven Moreland | f1a18c7 | 2021-02-04 02:38:52 +0000 | [diff] [blame] | 393 | java_defaults { |
| 394 | name: "aidl_test_java_defaults", |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 395 | platform_apis: true, |
| 396 | // Turn off Java optimization tools to speed up our test iterations. |
| 397 | optimize: { |
| 398 | enabled: false, |
| 399 | }, |
Steven Moreland | dc49299 | 2020-10-02 23:04:11 +0000 | [diff] [blame] | 400 | dex_preopt: { |
| 401 | enabled: false, |
| 402 | }, |
Jeongik Cha | 649e8a7 | 2020-03-27 17:47:40 +0900 | [diff] [blame] | 403 | static_libs: [ |
Jiyong Park | 0aa522d | 2020-07-27 23:59:00 +0900 | [diff] [blame] | 404 | "androidx.test.core", |
| 405 | "androidx.test.runner", |
Jeongik Cha | 1887cc7 | 2021-01-26 23:06:25 +0900 | [diff] [blame] | 406 | "aidl_test_nonvintf_parcelable-V1-java", |
Jeongik Cha | 649e8a7 | 2020-03-27 17:47:40 +0900 | [diff] [blame] | 407 | "aidl_test_unstable_parcelable-java", |
Jeongik Cha | 1887cc7 | 2021-01-26 23:06:25 +0900 | [diff] [blame] | 408 | "aidl_test_vintf_parcelable-V1-java", |
Jeongik Cha | 396221a | 2020-11-19 02:39:27 +0900 | [diff] [blame] | 409 | // TODO: remove once Android migrates to JUnit 4.12, |
| 410 | // which provides assertThrows |
| 411 | "testng", |
Jeongik Cha | 649e8a7 | 2020-03-27 17:47:40 +0900 | [diff] [blame] | 412 | ], |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 413 | srcs: [ |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 414 | "tests/android/aidl/tests/*.aidl", |
Jeongik Cha | e74c86d | 2019-12-12 16:54:03 +0900 | [diff] [blame] | 415 | "tests/android/aidl/tests/generic/*.aidl", |
Jeongik Cha | 36f76c3 | 2020-07-28 00:25:52 +0900 | [diff] [blame] | 416 | "tests/android/aidl/tests/immutable/*.aidl", |
Jeongik Cha | e48d994 | 2020-01-02 17:39:00 +0900 | [diff] [blame] | 417 | "tests/android/aidl/tests/map/*.aidl", |
Jeongik Cha | 649e8a7 | 2020-03-27 17:47:40 +0900 | [diff] [blame] | 418 | "tests/android/aidl/tests/extension/*.aidl", |
Jooyung Han | 53fb424 | 2020-12-17 16:03:49 +0900 | [diff] [blame] | 419 | "tests/android/aidl/tests/unions/*.aidl", |
Steven Moreland | f1a18c7 | 2021-02-04 02:38:52 +0000 | [diff] [blame] | 420 | "tests/java/src/android/aidl/tests/SimpleParcelable.java", |
| 421 | "tests/java/src/android/aidl/tests/generic/Pair.java", |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 422 | ], |
| 423 | aidl: { |
| 424 | include_dirs: [ |
| 425 | "system/tools/aidl/tests/", |
| 426 | "frameworks/native/aidl/binder", |
| 427 | ], |
Devin Moore | e2ccf8a | 2020-05-13 14:28:20 -0700 | [diff] [blame] | 428 | generate_traces: true, |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 429 | }, |
Steven Moreland | 5762001 | 2020-09-29 00:22:34 +0000 | [diff] [blame] | 430 | test_suites: ["general-tests"], |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 431 | } |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 432 | |
Steven Moreland | f1a18c7 | 2021-02-04 02:38:52 +0000 | [diff] [blame] | 433 | java_test { |
| 434 | name: "aidl_test_java_client", |
| 435 | defaults: ["aidl_test_java_defaults"], |
| 436 | static_libs: [ |
| 437 | // client uses the new version |
| 438 | "aidl-test-versioned-interface-V2-java", |
| 439 | ], |
| 440 | // tests are included in defaults |
| 441 | srcs: [ |
| 442 | "tests/java/src/android/aidl/tests/MapTests.java", |
| 443 | "tests/java/src/android/aidl/tests/TestServiceClient.java", |
| 444 | "tests/java/src/android/aidl/tests/JavaOnlyImmutableAnnotationTests.java", |
| 445 | "tests/java/src/android/aidl/tests/AidlJavaTests.java", |
| 446 | "tests/java/src/android/aidl/tests/GenericTests.java", |
| 447 | "tests/java/src/android/aidl/tests/TestVersionedInterface.java", |
| 448 | "tests/java/src/android/aidl/tests/UnionTests.java", |
| 449 | "tests/java/src/android/aidl/tests/ExtensionTests.java", |
| 450 | "tests/java/src/android/aidl/tests/NullableTests.java", |
| 451 | ], |
| 452 | } |
| 453 | |
| 454 | java_test { |
| 455 | name: "aidl_test_java_service", |
| 456 | defaults: ["aidl_test_java_defaults"], |
| 457 | static_libs: [ |
| 458 | // service uses the old version |
| 459 | "aidl-test-versioned-interface-V1-java", |
| 460 | ], |
| 461 | srcs: [ |
| 462 | "tests/java/src/android/aidl/service/**/*.java", |
| 463 | ], |
| 464 | } |
| 465 | |
Steven Moreland | 9866fcd | 2020-03-10 16:51:48 -0700 | [diff] [blame] | 466 | // |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 467 | // "Golden" test of compiler output |
| 468 | // |
| 469 | |
| 470 | sh_binary_host { |
| 471 | name: "aidl-golden-test", |
| 472 | src: "tests/golden_test.sh", |
| 473 | } |
| 474 | |
| 475 | genrule { |
| 476 | name: "aidl-golden-test-build-hook-gen", |
| 477 | tools: ["aidl-golden-test"], |
| 478 | cmd: "$(location aidl-golden-test) check && " + |
| 479 | "echo 'int main(){return 0;}' > $(genDir)/TODO_b_37575883.cpp", |
| 480 | srcs: [ |
| 481 | // warning: keep this list up to date with tests/golden_test.sh |
| 482 | ":aidl-test-interface-cpp-source", |
| 483 | ":aidl-test-interface-java-source", |
| 484 | ":aidl-test-interface-ndk_platform-source", |
| 485 | ":aidl-test-interface-rust-source", |
| 486 | ":aidl_test_loggable_interface-cpp-source", |
| 487 | ":aidl_test_loggable_interface-java-source", |
| 488 | ":aidl_test_loggable_interface-ndk_platform-source", |
| 489 | ":aidl_test_loggable_interface-ndk-source", |
| 490 | "tests/golden_output/**/*", |
| 491 | ], |
| 492 | out: ["TODO_b_37575883.cpp"], |
| 493 | } |
| 494 | |
| 495 | cc_test_host { |
| 496 | name: "aidl-golden-test-build-hook", |
| 497 | generated_sources: ["aidl-golden-test-build-hook-gen"], |
Julien Desprez | b2f4fe6 | 2021-01-14 18:44:36 -0800 | [diff] [blame] | 498 | gtest: false, |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | // |
Steven Moreland | 9866fcd | 2020-03-10 16:51:48 -0700 | [diff] [blame] | 502 | // Testing generation of logs |
| 503 | // |
| 504 | |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 505 | aidl_interface { |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 506 | name: "aidl_test_loggable_interface", |
Jiyong Park | a3617e6 | 2020-04-13 11:32:05 +0900 | [diff] [blame] | 507 | unstable: true, |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 508 | local_include_dir: "tests", |
Jooyung Han | 0872ba8 | 2021-02-24 11:50:47 +0900 | [diff] [blame] | 509 | flags: ["-Werror"], |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 510 | srcs: [ |
Steven Moreland | 6e43532 | 2019-03-29 18:16:39 -0700 | [diff] [blame] | 511 | "tests/android/aidl/loggable/ILoggableInterface.aidl", |
Jooyung Han | b8e01b9 | 2020-11-01 16:49:13 +0900 | [diff] [blame] | 512 | "tests/android/aidl/loggable/Data.aidl", |
| 513 | "tests/android/aidl/loggable/Enum.aidl", |
| 514 | "tests/android/aidl/loggable/Union.aidl", |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 515 | ], |
Devin Moore | a45a360 | 2020-04-16 11:22:55 -0700 | [diff] [blame] | 516 | gen_trace: true, |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 517 | backend: { |
| 518 | cpp: { |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 519 | srcs_available: true, |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 520 | gen_log: true, |
| 521 | }, |
| 522 | ndk: { |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 523 | srcs_available: true, |
Jeongik Cha | 37e2ad5 | 2019-04-18 13:44:26 +0900 | [diff] [blame] | 524 | gen_log: true, |
| 525 | }, |
Devin Moore | e2ccf8a | 2020-05-13 14:28:20 -0700 | [diff] [blame] | 526 | java: { |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 527 | srcs_available: true, |
Devin Moore | e2ccf8a | 2020-05-13 14:28:20 -0700 | [diff] [blame] | 528 | platform_apis: true, |
Jiyong Park | 18c3dfe | 2020-07-27 20:27:03 +0900 | [diff] [blame] | 529 | }, |
Jeongik Cha | 37e2ad5 | 2019-04-18 13:44:26 +0900 | [diff] [blame] | 530 | }, |
Steven Moreland | bb654e3 | 2020-01-08 19:52:05 -0800 | [diff] [blame] | 531 | } |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 532 | |
| 533 | // |
| 534 | // Rust tests |
| 535 | // |
| 536 | |
| 537 | aidl_interface { |
| 538 | name: "aidl-test-interface", |
| 539 | unstable: true, |
Jooyung Han | 0872ba8 | 2021-02-24 11:50:47 +0900 | [diff] [blame] | 540 | flags: ["-Werror"], |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 541 | srcs: [":libaidl-integration-test-files"], |
| 542 | local_include_dir: "tests", |
| 543 | backend: { |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 544 | cpp: { |
| 545 | srcs_available: true, |
| 546 | }, |
Steven Moreland | a7764e5 | 2020-10-27 17:29:29 +0000 | [diff] [blame] | 547 | java: { |
| 548 | platform_apis: true, |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 549 | srcs_available: true, |
Steven Moreland | a7764e5 | 2020-10-27 17:29:29 +0000 | [diff] [blame] | 550 | }, |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 551 | rust: { |
| 552 | enabled: true, |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 553 | srcs_available: true, |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 554 | }, |
Steven Moreland | a7764e5 | 2020-10-27 17:29:29 +0000 | [diff] [blame] | 555 | ndk: { |
| 556 | apps_enabled: false, |
Steven Moreland | bc21935 | 2020-12-22 19:23:01 +0000 | [diff] [blame] | 557 | srcs_available: true, |
Steven Moreland | a7764e5 | 2020-10-27 17:29:29 +0000 | [diff] [blame] | 558 | }, |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 559 | }, |
| 560 | } |
| 561 | |
| 562 | rust_test { |
| 563 | name: "aidl_test_rust_client", |
| 564 | srcs: [ |
| 565 | "tests/rust/test_client.rs", |
| 566 | ], |
| 567 | rustlibs: [ |
| 568 | "aidl-test-interface-rust", |
Jeongik Cha | 1887cc7 | 2021-01-26 23:06:25 +0900 | [diff] [blame] | 569 | "aidl-test-versioned-interface-V2-rust", |
Andrei Homescu | 474754d | 2020-08-19 21:05:38 -0700 | [diff] [blame] | 570 | "liblibc", |
| 571 | ], |
| 572 | prefer_rlib: true, |
| 573 | compile_multilib: "both", |
| 574 | multilib: { |
| 575 | lib32: { |
| 576 | suffix: "32", |
| 577 | }, |
| 578 | lib64: { |
| 579 | suffix: "64", |
| 580 | }, |
| 581 | }, |
| 582 | test_suites: ["general-tests"], |
| 583 | } |
| 584 | |
| 585 | rust_test { |
| 586 | name: "aidl_test_rust_service", |
| 587 | test_harness: false, |
| 588 | srcs: [ |
| 589 | "tests/rust/test_service.rs", |
| 590 | ], |
| 591 | rustlibs: [ |
| 592 | "aidl-test-interface-rust", |
| 593 | "aidl-test-versioned-interface-V1-rust", |
| 594 | "liblibc", |
| 595 | ], |
| 596 | prefer_rlib: true, |
| 597 | compile_multilib: "both", |
| 598 | multilib: { |
| 599 | lib32: { |
| 600 | suffix: "32", |
| 601 | }, |
| 602 | lib64: { |
| 603 | suffix: "64", |
| 604 | }, |
| 605 | }, |
| 606 | test_suites: ["general-tests"], |
| 607 | } |