blob: 015be64445f82f5c9227d94ed8cf1bc3f46d52a3 [file] [log] [blame]
Dan Willemsen8fd503f2016-10-04 20:04:36 -07001//
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 Badour01cffa32021-02-12 17:18:34 -080017package {
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
Dan Willemsen8fd503f2016-10-04 20:04:36 -070034cc_defaults {
35 name: "aidl_defaults",
Chih-Hung Hsieh15607962017-10-02 10:03:55 -070036 cflags: [
Dan Willemsen8fd503f2016-10-04 20:04:36 -070037 "-Wall",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070038 "-Werror",
Chih-Hung Hsieh15607962017-10-02 10:03:55 -070039 "-Wextra",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070040 ],
41 whole_static_libs: ["libgtest_prod"],
42 static_libs: [
43 "libbase",
44 "libcutils",
Jooyung Hanb8a97772021-01-19 01:27:38 +090045 "libgtest",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070046 ],
Jooyung Han9969b9d2020-11-28 08:42:37 +090047 // TODO(b/174366536): basic_stringbuf::overflow causes "ubsan: implicit-conversion"
48 // sanitize: {
49 // integer_overflow: true,
50 // misc_undefined: ["integer"],
51 // },
Dan Willemsen8fd503f2016-10-04 20:04:36 -070052 target: {
53 windows: {
54 enabled: true,
55 },
Steven Morelandb49a33d2019-08-21 11:17:32 -070056 host: {
57 cflags: [
58 "-O0",
59 "-g",
60 ],
61 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -070062 },
Steven Moreland1c894432020-02-14 11:32:44 -080063 product_variables: {
64 platform_sdk_version: {
65 cflags: ["-DPLATFORM_SDK_VERSION=%d"],
66 },
67 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -070068}
69
70// Logic shared between aidl and its unittests
Andreas Gampe76a6a462018-10-08 17:44:16 -070071cc_library_static {
Dan Willemsen8fd503f2016-10-04 20:04:36 -070072 name: "libaidl-common",
73 defaults: ["aidl_defaults"],
Andreas Gampe76a6a462018-10-08 17:44:16 -070074 host_supported: true,
Dan Willemsen8fd503f2016-10-04 20:04:36 -070075
Dan Willemsen8fd503f2016-10-04 20:04:36 -070076 srcs: [
Steven Moreland49585242019-12-18 16:06:49 -080077 "aidl_checkapi.cpp",
Will McVickerefd970d2019-09-25 15:28:30 -070078 "aidl_const_expressions.cpp",
Jooyung Han1f56b702021-02-11 13:16:15 +090079 "aidl_dumpapi.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070080 "aidl_language_l.ll",
81 "aidl_language_y.yy",
Jooyung Han888c5bc2020-12-22 17:28:47 +090082 "aidl_language.cpp",
83 "aidl_to_cpp_common.cpp",
Steven Moreland860b1942018-08-16 14:59:28 -070084 "aidl_to_cpp.cpp",
Jiyong Park1d2df7d2018-07-23 15:22:50 +090085 "aidl_to_java.cpp",
Steven Morelande8a3a192018-09-20 14:14:28 -070086 "aidl_to_ndk.cpp",
Andrei Homescub62afd92020-05-11 19:24:59 -070087 "aidl_to_rust.cpp",
Jooyung Han888c5bc2020-12-22 17:28:47 +090088 "aidl_typenames.cpp",
89 "aidl.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070090 "ast_cpp.cpp",
91 "ast_java.cpp",
92 "code_writer.cpp",
Jooyung Hand4fe00e2021-01-11 16:21:53 +090093 "comments.cpp",
Jooyung Han888c5bc2020-12-22 17:28:47 +090094 "diagnostics.cpp",
Andrei Onea8714b022019-02-01 18:55:54 +000095 "generate_aidl_mappings.cpp",
Jooyung Han888c5bc2020-12-22 17:28:47 +090096 "generate_cpp.cpp",
97 "generate_java_binder.cpp",
98 "generate_java.cpp",
99 "generate_ndk.cpp",
Andrei Homescub62afd92020-05-11 19:24:59 -0700100 "generate_rust.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700101 "import_resolver.cpp",
Jooyung Han888c5bc2020-12-22 17:28:47 +0900102 "io_delegate.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700103 "line_reader.cpp",
Jooyung Han535c5e82020-12-29 15:16:59 +0900104 "location.cpp",
Jiyong Park2a7c92b2020-07-22 19:12:36 +0900105 "logging.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700106 "options.cpp",
Jiyong Parke5c45292020-05-26 19:06:24 +0900107 "parser.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700108 ],
Dan Willemsenfad411f2019-04-12 14:40:55 -0700109 yacc: {
110 gen_location_hh: true,
111 gen_position_hh: true,
112 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700113}
114
115// aidl executable
116cc_binary_host {
117 name: "aidl",
118 defaults: ["aidl_defaults"],
Jiyong Park74595c12018-07-23 15:22:50 +0900119 srcs: ["main.cpp"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700120 static_libs: [
121 "libaidl-common",
122 "libbase",
Tom Cherryffe43cd2020-01-08 14:10:30 -0800123 "liblog",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700124 ],
125}
126
Steven Morelandbb654e32020-01-08 19:52:05 -0800127// aidl-cpp legacy executable, please use 'aidl' instead
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700128cc_binary_host {
129 name: "aidl-cpp",
130 defaults: ["aidl_defaults"],
Steven Morelandbb654e32020-01-08 19:52:05 -0800131 srcs: ["main.cpp"],
132 cflags: ["-DAIDL_CPP_BUILD"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700133 static_libs: [
134 "libaidl-common",
135 "libbase",
Tom Cherryffe43cd2020-01-08 14:10:30 -0800136 "liblog",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700137 ],
138}
139
140// Unit tests
Andreas Gampe76a6a462018-10-08 17:44:16 -0700141cc_test {
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700142 name: "aidl_unittests",
Andreas Gampe76a6a462018-10-08 17:44:16 -0700143 host_supported: true,
144
Steven Moreland2921b8b2020-03-10 16:12:47 -0700145 test_suites: ["general-tests"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700146
147 cflags: [
148 "-Wall",
149 "-Wextra",
150 "-Werror",
151 "-g",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700152 ],
Steven Moreland1c41e972018-07-09 16:07:00 -0700153
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700154 srcs: [
155 "aidl_unittest.cpp",
156 "ast_cpp_unittest.cpp",
157 "ast_java_unittest.cpp",
Jiyong Park22b4ecd2018-07-23 23:34:42 +0900158 "code_writer_unittest.cpp",
Jooyung Han3557e482020-12-24 05:11:15 +0900159 "diagnostics_unittest.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700160 "generate_cpp_unittest.cpp",
161 "io_delegate_unittest.cpp",
162 "options_unittest.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700163 "tests/fake_io_delegate.cpp",
164 "tests/main.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700165 "tests/test_util.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700166 ],
167
168 static_libs: [
169 "libaidl-common",
170 "libbase",
171 "libcutils",
Steven Moreland57ec44a2019-10-25 15:50:21 -0700172 "libgmock",
Tom Cherryffe43cd2020-01-08 14:10:30 -0800173 "liblog",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700174 ],
Steven Morelandbc219352020-12-22 19:23:01 +0000175
176 required: ["aidl-golden-test-build-hook"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700177}
178
Steven Moreland45857d72019-10-25 17:08:09 -0700179cc_fuzz {
180 name: "aidl_parser_fuzzer",
181 host_supported: true,
182 dictionary: "tests/aidl_parser_fuzzer.dict",
Mitch Phillips17fad882019-12-18 11:27:40 -0800183 corpus: [
184 "tests/corpus/*",
185 ],
Steven Moreland00f1ee72019-11-04 09:52:06 -0800186
187 fuzz_config: {
188 cc: [
Steven Morelanda1e49872020-04-10 10:08:17 -0700189 "devinmoore@google.com",
Steven Moreland00f1ee72019-11-04 09:52:06 -0800190 "smoreland@google.com",
191 "jiyong@google.com",
192 "jeongik@google.com",
193 ],
194 },
195
Steven Moreland45857d72019-10-25 17:08:09 -0700196 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 Hanb8a97772021-01-19 01:27:38 +0900205 "libgtest",
Tom Cherryffe43cd2020-01-08 14:10:30 -0800206 "liblog",
Steven Moreland45857d72019-10-25 17:08:09 -0700207 ],
Steven Moreland45857d72019-10-25 17:08:09 -0700208 // Enable this to show additional information about what is being parsed during fuzzing.
209 // cflags: ["-DFUZZ_LOG"],
210}
211
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700212//
Steven Moreland9866fcd2020-03-10 16:51:48 -0700213// Integration testing of generated AIDL code.
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700214//
Steven Moreland9866fcd2020-03-10 16:51:48 -0700215
216python_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 Moreland9866fcd2020-03-10 16:51:48 -0700223 "aidl_test_service",
Steven Morelandf1a18c72021-02-04 02:38:52 +0000224 "aidl_test_java_client",
225 "aidl_test_java_service",
Andrei Homescu474754d2020-08-19 21:05:38 -0700226 "aidl_test_rust_client",
227 "aidl_test_rust_service",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700228 ],
Steven Moreland57620012020-09-29 00:22:34 +0000229 test_suites: ["general-tests"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700230}
Dan Willemsen8f883612016-11-03 14:22:48 -0700231
232cc_defaults {
233 name: "aidl_test_defaults",
234 cflags: [
235 "-Wall",
236 "-Wextra",
237 "-Werror",
Dan Willemsen8f883612016-11-03 14:22:48 -0700238 ],
239 shared_libs: [
240 "libbase",
241 "libbinder",
242 "liblog",
243 "libutils",
244 ],
Steven Moreland9866fcd2020-03-10 16:51:48 -0700245 compile_multilib: "both",
246 multilib: {
247 lib32: {
248 suffix: "32",
249 },
250 lib64: {
251 suffix: "64",
252 },
253 },
Steven Moreland57620012020-09-29 00:22:34 +0000254 test_suites: ["general-tests"],
Steven Moreland9866fcd2020-03-10 16:51:48 -0700255}
256
Devin Mooree337b7c2020-05-14 13:52:02 -0700257// Header-only library used for atrace in platform NDK builds
258cc_library_headers {
259 name: "libandroid_aidltrace",
260 host_supported: true,
261 vendor_available: true,
262 export_include_dirs: ["trace"],
Devin Moore40735df2020-05-15 09:12:57 -0700263 apex_available: [
264 "//apex_available:platform",
265 "//apex_available:anyapex",
266 ],
Devin Mooree337b7c2020-05-14 13:52:02 -0700267}
268
Dan Willemsenc46b65e2019-06-06 10:55:58 -0700269filegroup {
270 name: "libaidl-integration-test-files",
Andrei Homescu474754d2020-08-19 21:05:38 -0700271 srcs: [
Jooyung Han26fc4452020-10-31 03:56:04 +0900272 "tests/android/aidl/tests/BackendType.aidl",
Andrei Homescu474754d2020-08-19 21:05:38 -0700273 "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 Hanf93b5bd2020-10-28 15:12:08 +0900285 "tests/android/aidl/tests/Union.aidl",
286 "tests/android/aidl/tests/UnionWithFd.aidl",
Jooyung Han53fb4242020-12-17 16:03:49 +0900287 "tests/android/aidl/tests/unions/*.aidl",
Andrei Homescu474754d2020-08-19 21:05:38 -0700288 ],
289 path: "tests",
290}
291
292filegroup {
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 Willemsenc46b65e2019-06-06 10:55:58 -0700299 path: "tests",
300}
301
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900302aidl_interface {
303 name: "aidl-test-versioned-interface",
304 local_include_dir: "tests/versioned",
Jooyung Han0872ba82021-02-24 11:50:47 +0900305 flags: ["-Werror"],
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900306 srcs: [
307 "tests/versioned/**/*.aidl",
308 ],
309 versions: [
310 "1",
311 "2",
312 ],
Andrei Homescu474754d2020-08-19 21:05:38 -0700313 backend: {
314 rust: {
315 enabled: true,
316 },
317 },
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900318}
319
Steven Moreland87bbbd82019-07-30 16:32:54 -0700320cc_library_static {
Dan Willemsen8f883612016-11-03 14:22:48 -0700321 name: "libaidl-integration-test",
322 defaults: ["aidl_test_defaults"],
323 aidl: {
Devin Mooree2ccf8a2020-05-13 14:28:20 -0700324 generate_traces: true,
Dan Willemsen8f883612016-11-03 14:22:48 -0700325 export_aidl_headers: true,
326 local_include_dirs: ["tests"],
327 include_dirs: ["frameworks/native/aidl/binder"],
328 },
329 srcs: [
Dan Willemsenc46b65e2019-06-06 10:55:58 -0700330 ":libaidl-integration-test-files",
Andrei Homescu474754d2020-08-19 21:05:38 -0700331 ":libaidl-integration-cpp-java-test-files",
Dan Willemsen8f883612016-11-03 14:22:48 -0700332 "tests/simple_parcelable.cpp",
333 ],
334}
335
Steven Moreland87bbbd82019-07-30 16:32:54 -0700336cc_test {
Dan Willemsen8f883612016-11-03 14:22:48 -0700337 name: "aidl_test_service",
Steven Moreland87bbbd82019-07-30 16:32:54 -0700338 gtest: false,
Dan Willemsen8f883612016-11-03 14:22:48 -0700339 defaults: ["aidl_test_defaults"],
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900340 static_libs: [
341 "libaidl-integration-test",
342 "libcutils",
343 // service uses the old version
344 "aidl-test-versioned-interface-V1-cpp",
Jooyung Han26fc4452020-10-31 03:56:04 +0900345 "aidl_test_loggable_interface-cpp",
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900346 ],
Dan Willemsen8f883612016-11-03 14:22:48 -0700347 srcs: ["tests/aidl_test_service.cpp"],
348}
349
Steven Moreland87bbbd82019-07-30 16:32:54 -0700350cc_test {
Dan Willemsen8f883612016-11-03 14:22:48 -0700351 name: "aidl_test_client",
352 defaults: ["aidl_test_defaults"],
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900353 static_libs: [
354 "libaidl-integration-test",
355 "libcutils",
Jiyong Park7c8a2e12020-07-28 18:15:20 +0900356 "libgmock",
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900357 // client uses the latest version
Jeongik Cha1887cc72021-01-26 23:06:25 +0900358 "aidl-test-versioned-interface-V2-cpp",
Jooyung Han26fc4452020-10-31 03:56:04 +0900359 "aidl_test_loggable_interface-cpp"
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900360 ],
Dan Willemsen8f883612016-11-03 14:22:48 -0700361 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 Park75e1a742018-07-04 12:31:23 +0900369 "tests/aidl_test_client_defaultimpl.cpp",
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900370 "tests/aidl_test_client_versioned_interface.cpp",
Jiyong Park27fd7fd2020-08-27 16:25:09 +0900371 "tests/aidl_test_client_renamed_interface.cpp",
Jooyung Han26fc4452020-10-31 03:56:04 +0900372 "tests/aidl_test_client_loggable_interface.cpp",
Dan Willemsen8f883612016-11-03 14:22:48 -0700373 ],
374}
Steven Moreland0ae34602018-06-28 10:08:19 -0700375
Jooyung Han26f792e2021-02-25 16:46:02 +0900376cc_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 Morelandf1a18c72021-02-04 02:38:52 +0000393java_defaults {
394 name: "aidl_test_java_defaults",
Steven Moreland0ae34602018-06-28 10:08:19 -0700395 platform_apis: true,
396 // Turn off Java optimization tools to speed up our test iterations.
397 optimize: {
398 enabled: false,
399 },
Steven Morelanddc492992020-10-02 23:04:11 +0000400 dex_preopt: {
401 enabled: false,
402 },
Jeongik Cha649e8a72020-03-27 17:47:40 +0900403 static_libs: [
Jiyong Park0aa522d2020-07-27 23:59:00 +0900404 "androidx.test.core",
405 "androidx.test.runner",
Jeongik Cha1887cc72021-01-26 23:06:25 +0900406 "aidl_test_nonvintf_parcelable-V1-java",
Jeongik Cha649e8a72020-03-27 17:47:40 +0900407 "aidl_test_unstable_parcelable-java",
Jeongik Cha1887cc72021-01-26 23:06:25 +0900408 "aidl_test_vintf_parcelable-V1-java",
Jeongik Cha396221a2020-11-19 02:39:27 +0900409 // TODO: remove once Android migrates to JUnit 4.12,
410 // which provides assertThrows
411 "testng",
Jeongik Cha649e8a72020-03-27 17:47:40 +0900412 ],
Steven Moreland0ae34602018-06-28 10:08:19 -0700413 srcs: [
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800414 "tests/android/aidl/tests/*.aidl",
Jeongik Chae74c86d2019-12-12 16:54:03 +0900415 "tests/android/aidl/tests/generic/*.aidl",
Jeongik Cha36f76c32020-07-28 00:25:52 +0900416 "tests/android/aidl/tests/immutable/*.aidl",
Jeongik Chae48d9942020-01-02 17:39:00 +0900417 "tests/android/aidl/tests/map/*.aidl",
Jeongik Cha649e8a72020-03-27 17:47:40 +0900418 "tests/android/aidl/tests/extension/*.aidl",
Jooyung Han53fb4242020-12-17 16:03:49 +0900419 "tests/android/aidl/tests/unions/*.aidl",
Steven Morelandf1a18c72021-02-04 02:38:52 +0000420 "tests/java/src/android/aidl/tests/SimpleParcelable.java",
421 "tests/java/src/android/aidl/tests/generic/Pair.java",
Steven Moreland0ae34602018-06-28 10:08:19 -0700422 ],
423 aidl: {
424 include_dirs: [
425 "system/tools/aidl/tests/",
426 "frameworks/native/aidl/binder",
427 ],
Devin Mooree2ccf8a2020-05-13 14:28:20 -0700428 generate_traces: true,
Steven Moreland0ae34602018-06-28 10:08:19 -0700429 },
Steven Moreland57620012020-09-29 00:22:34 +0000430 test_suites: ["general-tests"],
Steven Moreland0ae34602018-06-28 10:08:19 -0700431}
Jiyong Parkce50e262018-10-29 09:54:20 +0900432
Steven Morelandf1a18c72021-02-04 02:38:52 +0000433java_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
454java_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 Moreland9866fcd2020-03-10 16:51:48 -0700466//
Steven Morelandbc219352020-12-22 19:23:01 +0000467// "Golden" test of compiler output
468//
469
470sh_binary_host {
471 name: "aidl-golden-test",
472 src: "tests/golden_test.sh",
473}
474
475genrule {
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
495cc_test_host {
496 name: "aidl-golden-test-build-hook",
497 generated_sources: ["aidl-golden-test-build-hook-gen"],
Julien Desprezb2f4fe62021-01-14 18:44:36 -0800498 gtest: false,
Steven Morelandbc219352020-12-22 19:23:01 +0000499}
500
501//
Steven Moreland9866fcd2020-03-10 16:51:48 -0700502// Testing generation of logs
503//
504
Jiyong Parkce50e262018-10-29 09:54:20 +0900505aidl_interface {
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800506 name: "aidl_test_loggable_interface",
Jiyong Parka3617e62020-04-13 11:32:05 +0900507 unstable: true,
Jiyong Parkce50e262018-10-29 09:54:20 +0900508 local_include_dir: "tests",
Jooyung Han0872ba82021-02-24 11:50:47 +0900509 flags: ["-Werror"],
Jiyong Parkce50e262018-10-29 09:54:20 +0900510 srcs: [
Steven Moreland6e435322019-03-29 18:16:39 -0700511 "tests/android/aidl/loggable/ILoggableInterface.aidl",
Jooyung Hanb8e01b92020-11-01 16:49:13 +0900512 "tests/android/aidl/loggable/Data.aidl",
513 "tests/android/aidl/loggable/Enum.aidl",
514 "tests/android/aidl/loggable/Union.aidl",
Jiyong Parkce50e262018-10-29 09:54:20 +0900515 ],
Devin Moorea45a3602020-04-16 11:22:55 -0700516 gen_trace: true,
Jiyong Parkce50e262018-10-29 09:54:20 +0900517 backend: {
518 cpp: {
Steven Morelandbc219352020-12-22 19:23:01 +0000519 srcs_available: true,
Jiyong Parkce50e262018-10-29 09:54:20 +0900520 gen_log: true,
521 },
522 ndk: {
Steven Morelandbc219352020-12-22 19:23:01 +0000523 srcs_available: true,
Jeongik Cha37e2ad52019-04-18 13:44:26 +0900524 gen_log: true,
525 },
Devin Mooree2ccf8a2020-05-13 14:28:20 -0700526 java: {
Steven Morelandbc219352020-12-22 19:23:01 +0000527 srcs_available: true,
Devin Mooree2ccf8a2020-05-13 14:28:20 -0700528 platform_apis: true,
Jiyong Park18c3dfe2020-07-27 20:27:03 +0900529 },
Jeongik Cha37e2ad52019-04-18 13:44:26 +0900530 },
Steven Morelandbb654e32020-01-08 19:52:05 -0800531}
Andrei Homescu474754d2020-08-19 21:05:38 -0700532
533//
534// Rust tests
535//
536
537aidl_interface {
538 name: "aidl-test-interface",
539 unstable: true,
Jooyung Han0872ba82021-02-24 11:50:47 +0900540 flags: ["-Werror"],
Andrei Homescu474754d2020-08-19 21:05:38 -0700541 srcs: [":libaidl-integration-test-files"],
542 local_include_dir: "tests",
543 backend: {
Steven Morelandbc219352020-12-22 19:23:01 +0000544 cpp: {
545 srcs_available: true,
546 },
Steven Morelanda7764e52020-10-27 17:29:29 +0000547 java: {
548 platform_apis: true,
Steven Morelandbc219352020-12-22 19:23:01 +0000549 srcs_available: true,
Steven Morelanda7764e52020-10-27 17:29:29 +0000550 },
Andrei Homescu474754d2020-08-19 21:05:38 -0700551 rust: {
552 enabled: true,
Steven Morelandbc219352020-12-22 19:23:01 +0000553 srcs_available: true,
Andrei Homescu474754d2020-08-19 21:05:38 -0700554 },
Steven Morelanda7764e52020-10-27 17:29:29 +0000555 ndk: {
556 apps_enabled: false,
Steven Morelandbc219352020-12-22 19:23:01 +0000557 srcs_available: true,
Steven Morelanda7764e52020-10-27 17:29:29 +0000558 },
Andrei Homescu474754d2020-08-19 21:05:38 -0700559 },
560}
561
562rust_test {
563 name: "aidl_test_rust_client",
564 srcs: [
565 "tests/rust/test_client.rs",
566 ],
567 rustlibs: [
568 "aidl-test-interface-rust",
Jeongik Cha1887cc72021-01-26 23:06:25 +0900569 "aidl-test-versioned-interface-V2-rust",
Andrei Homescu474754d2020-08-19 21:05:38 -0700570 "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
585rust_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}