blob: 0c2b36781a25c297e64511c1148b01dbb02abd91 [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
17cc_defaults {
18 name: "aidl_defaults",
Chih-Hung Hsieh15607962017-10-02 10:03:55 -070019 cflags: [
Dan Willemsen8fd503f2016-10-04 20:04:36 -070020 "-Wall",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070021 "-Werror",
Chih-Hung Hsieh15607962017-10-02 10:03:55 -070022 "-Wextra",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070023 ],
24 whole_static_libs: ["libgtest_prod"],
25 static_libs: [
26 "libbase",
27 "libcutils",
28 ],
29 target: {
30 windows: {
31 enabled: true,
32 },
Steven Morelandb49a33d2019-08-21 11:17:32 -070033 host: {
34 cflags: [
35 "-O0",
36 "-g",
37 ],
38 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -070039 },
40}
41
42// Logic shared between aidl and its unittests
Andreas Gampe76a6a462018-10-08 17:44:16 -070043cc_library_static {
Dan Willemsen8fd503f2016-10-04 20:04:36 -070044 name: "libaidl-common",
45 defaults: ["aidl_defaults"],
Andreas Gampe76a6a462018-10-08 17:44:16 -070046 host_supported: true,
Dan Willemsen8fd503f2016-10-04 20:04:36 -070047
Dan Willemsen8fd503f2016-10-04 20:04:36 -070048 srcs: [
49 "aidl.cpp",
Steven Moreland49585242019-12-18 16:06:49 -080050 "aidl_checkapi.cpp",
Will McVickerefd970d2019-09-25 15:28:30 -070051 "aidl_const_expressions.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070052 "aidl_language.cpp",
53 "aidl_language_l.ll",
54 "aidl_language_y.yy",
Jiyong Park1deecc32018-07-17 01:14:41 +090055 "aidl_typenames.cpp",
Steven Moreland860b1942018-08-16 14:59:28 -070056 "aidl_to_cpp.cpp",
Jiyong Park1d2df7d2018-07-23 15:22:50 +090057 "aidl_to_java.cpp",
Steven Morelande8a3a192018-09-20 14:14:28 -070058 "aidl_to_ndk.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070059 "ast_cpp.cpp",
60 "ast_java.cpp",
61 "code_writer.cpp",
62 "generate_cpp.cpp",
Steven Morelandb0057e72018-08-27 01:44:11 -070063 "aidl_to_cpp_common.cpp",
64 "generate_ndk.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070065 "generate_java.cpp",
66 "generate_java_binder.cpp",
Andrei Onea8714b022019-02-01 18:55:54 +000067 "generate_aidl_mappings.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070068 "import_resolver.cpp",
69 "line_reader.cpp",
70 "io_delegate.cpp",
71 "options.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070072 ],
Dan Willemsenfad411f2019-04-12 14:40:55 -070073 yacc: {
74 gen_location_hh: true,
75 gen_position_hh: true,
76 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -070077}
78
79// aidl executable
80cc_binary_host {
81 name: "aidl",
82 defaults: ["aidl_defaults"],
Jiyong Park74595c12018-07-23 15:22:50 +090083 srcs: ["main.cpp"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -070084 static_libs: [
85 "libaidl-common",
86 "libbase",
Tom Cherryffe43cd2020-01-08 14:10:30 -080087 "liblog",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070088 ],
89}
90
Steven Morelandbb654e32020-01-08 19:52:05 -080091// aidl-cpp legacy executable, please use 'aidl' instead
Dan Willemsen8fd503f2016-10-04 20:04:36 -070092cc_binary_host {
93 name: "aidl-cpp",
94 defaults: ["aidl_defaults"],
Steven Morelandbb654e32020-01-08 19:52:05 -080095 srcs: ["main.cpp"],
96 cflags: ["-DAIDL_CPP_BUILD"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -070097 static_libs: [
98 "libaidl-common",
99 "libbase",
Tom Cherryffe43cd2020-01-08 14:10:30 -0800100 "liblog",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700101 ],
102}
103
104// Unit tests
Andreas Gampe76a6a462018-10-08 17:44:16 -0700105cc_test {
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700106 name: "aidl_unittests",
Andreas Gampe76a6a462018-10-08 17:44:16 -0700107 host_supported: true,
108
109 test_suites: ["device-tests"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700110
111 cflags: [
112 "-Wall",
113 "-Wextra",
114 "-Werror",
115 "-g",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700116 ],
Steven Moreland1c41e972018-07-09 16:07:00 -0700117
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700118 srcs: [
119 "aidl_unittest.cpp",
120 "ast_cpp_unittest.cpp",
121 "ast_java_unittest.cpp",
Jiyong Park22b4ecd2018-07-23 23:34:42 +0900122 "code_writer_unittest.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700123 "generate_cpp_unittest.cpp",
124 "io_delegate_unittest.cpp",
125 "options_unittest.cpp",
126 "tests/end_to_end_tests.cpp",
127 "tests/fake_io_delegate.cpp",
128 "tests/main.cpp",
129 "tests/test_data_example_interface.cpp",
130 "tests/test_data_ping_responder.cpp",
131 "tests/test_data_string_constants.cpp",
132 "tests/test_util.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700133 ],
134
135 static_libs: [
136 "libaidl-common",
137 "libbase",
138 "libcutils",
Steven Moreland57ec44a2019-10-25 15:50:21 -0700139 "libgmock",
Tom Cherryffe43cd2020-01-08 14:10:30 -0800140 "liblog",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700141 ],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700142}
143
Steven Moreland45857d72019-10-25 17:08:09 -0700144cc_fuzz {
145 name: "aidl_parser_fuzzer",
146 host_supported: true,
147 dictionary: "tests/aidl_parser_fuzzer.dict",
Mitch Phillips17fad882019-12-18 11:27:40 -0800148 corpus: [
149 "tests/corpus/*",
150 ],
Steven Moreland00f1ee72019-11-04 09:52:06 -0800151
152 fuzz_config: {
153 cc: [
154 "smoreland@google.com",
155 "jiyong@google.com",
156 "jeongik@google.com",
157 ],
158 },
159
Steven Moreland45857d72019-10-25 17:08:09 -0700160 srcs: [
161 "tests/aidl_parser_fuzzer.cpp",
162 "tests/fake_io_delegate.cpp",
163 "tests/test_util.cpp",
164 ],
165 static_libs: [
166 "libaidl-common",
167 "libbase",
168 "libcutils",
Tom Cherryffe43cd2020-01-08 14:10:30 -0800169 "liblog",
Steven Moreland45857d72019-10-25 17:08:09 -0700170 ],
Steven Moreland45857d72019-10-25 17:08:09 -0700171 // Enable this to show additional information about what is being parsed during fuzzing.
172 // cflags: ["-DFUZZ_LOG"],
173}
174
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700175//
176// Everything below here is used for integration testing of generated AIDL code.
177//
Steven Moreland87bbbd82019-07-30 16:32:54 -0700178cc_test {
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700179 name: "aidl_test_sentinel_searcher",
Steven Moreland87bbbd82019-07-30 16:32:54 -0700180 gtest: false,
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700181 srcs: ["tests/aidl_test_sentinel_searcher.cpp"],
182 cflags: [
183 "-Wall",
184 "-Wextra",
185 "-Werror",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700186 ],
187}
Dan Willemsen8f883612016-11-03 14:22:48 -0700188
189cc_defaults {
190 name: "aidl_test_defaults",
191 cflags: [
192 "-Wall",
193 "-Wextra",
194 "-Werror",
Dan Willemsen8f883612016-11-03 14:22:48 -0700195 ],
196 shared_libs: [
197 "libbase",
198 "libbinder",
199 "liblog",
200 "libutils",
201 ],
202}
203
Dan Willemsenc46b65e2019-06-06 10:55:58 -0700204filegroup {
205 name: "libaidl-integration-test-files",
206 srcs: ["tests/android/aidl/tests/*.aidl"],
207 path: "tests",
208}
209
Steven Moreland87bbbd82019-07-30 16:32:54 -0700210cc_library_static {
Dan Willemsen8f883612016-11-03 14:22:48 -0700211 name: "libaidl-integration-test",
212 defaults: ["aidl_test_defaults"],
213 aidl: {
214 export_aidl_headers: true,
215 local_include_dirs: ["tests"],
216 include_dirs: ["frameworks/native/aidl/binder"],
217 },
218 srcs: [
Dan Willemsenc46b65e2019-06-06 10:55:58 -0700219 ":libaidl-integration-test-files",
Dan Willemsen8f883612016-11-03 14:22:48 -0700220 "tests/simple_parcelable.cpp",
221 ],
222}
223
Steven Moreland87bbbd82019-07-30 16:32:54 -0700224cc_test {
Dan Willemsen8f883612016-11-03 14:22:48 -0700225 name: "aidl_test_service",
Steven Moreland87bbbd82019-07-30 16:32:54 -0700226 gtest: false,
Dan Willemsen8f883612016-11-03 14:22:48 -0700227 defaults: ["aidl_test_defaults"],
Steven Moreland87bbbd82019-07-30 16:32:54 -0700228 static_libs: ["libaidl-integration-test"],
Dan Willemsen8f883612016-11-03 14:22:48 -0700229 srcs: ["tests/aidl_test_service.cpp"],
230}
231
Steven Moreland87bbbd82019-07-30 16:32:54 -0700232cc_test {
Dan Willemsen8f883612016-11-03 14:22:48 -0700233 name: "aidl_test_client",
Steven Moreland87bbbd82019-07-30 16:32:54 -0700234 gtest: false,
Dan Willemsen8f883612016-11-03 14:22:48 -0700235 defaults: ["aidl_test_defaults"],
Steven Moreland87bbbd82019-07-30 16:32:54 -0700236 static_libs: ["libaidl-integration-test"],
Dan Willemsen8f883612016-11-03 14:22:48 -0700237 srcs: [
238 "tests/aidl_test_client.cpp",
239 "tests/aidl_test_client_file_descriptors.cpp",
240 "tests/aidl_test_client_parcelables.cpp",
241 "tests/aidl_test_client_nullables.cpp",
242 "tests/aidl_test_client_primitives.cpp",
243 "tests/aidl_test_client_utf8_strings.cpp",
244 "tests/aidl_test_client_service_exceptions.cpp",
Jiyong Park75e1a742018-07-04 12:31:23 +0900245 "tests/aidl_test_client_defaultimpl.cpp",
Dan Willemsen8f883612016-11-03 14:22:48 -0700246 ],
247}
Steven Moreland0ae34602018-06-28 10:08:19 -0700248
249android_app {
250 name: "aidl_test_services",
251 platform_apis: true,
252 // Turn off Java optimization tools to speed up our test iterations.
253 optimize: {
254 enabled: false,
255 },
256 dex_preopt: {
257 enabled: false,
258 },
259 certificate: "platform",
260 manifest: "tests/java_app/AndroidManifest.xml",
261 resource_dirs: ["tests/java_app/resources"],
262 srcs: [
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800263 "tests/android/aidl/tests/*.aidl",
Jeongik Chae74c86d2019-12-12 16:54:03 +0900264 "tests/android/aidl/tests/generic/*.aidl",
Jeongik Chae48d9942020-01-02 17:39:00 +0900265 "tests/android/aidl/tests/map/*.aidl",
Jeongik Chae74c86d2019-12-12 16:54:03 +0900266 "tests/java_app/src/android/aidl/tests/GenericTests.java",
Jeongik Chae48d9942020-01-02 17:39:00 +0900267 "tests/java_app/src/android/aidl/tests/MapTests.java",
Steven Moreland0ae34602018-06-28 10:08:19 -0700268 "tests/java_app/src/android/aidl/tests/NullableTests.java",
269 "tests/java_app/src/android/aidl/tests/SimpleParcelable.java",
270 "tests/java_app/src/android/aidl/tests/TestFailException.java",
271 "tests/java_app/src/android/aidl/tests/TestLogger.java",
272 "tests/java_app/src/android/aidl/tests/TestServiceClient.java",
Jeongik Chae74c86d2019-12-12 16:54:03 +0900273 "tests/java_app/src/android/aidl/tests/generic/Pair.java",
Steven Moreland0ae34602018-06-28 10:08:19 -0700274 ],
275 aidl: {
276 include_dirs: [
277 "system/tools/aidl/tests/",
278 "frameworks/native/aidl/binder",
279 ],
280 },
281}
Jiyong Parkce50e262018-10-29 09:54:20 +0900282
283aidl_interface {
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800284 name: "aidl_test_loggable_interface",
Jiyong Parkce50e262018-10-29 09:54:20 +0900285 local_include_dir: "tests",
286 srcs: [
Steven Moreland6e435322019-03-29 18:16:39 -0700287 "tests/android/aidl/loggable/ILoggableInterface.aidl",
Jiyong Parkce50e262018-10-29 09:54:20 +0900288 ],
289 backend: {
290 cpp: {
291 gen_log: true,
292 },
293 ndk: {
Jeongik Cha37e2ad52019-04-18 13:44:26 +0900294 gen_log: true,
295 },
296 },
Steven Morelandbb654e32020-01-08 19:52:05 -0800297}