blob: 13df40976413c19440c8a302ed17b2d3ec373000 [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 },
33 },
34}
35
36// Logic shared between aidl and its unittests
Andreas Gampe76a6a462018-10-08 17:44:16 -070037cc_library_static {
Dan Willemsen8fd503f2016-10-04 20:04:36 -070038 name: "libaidl-common",
39 defaults: ["aidl_defaults"],
Andreas Gampe76a6a462018-10-08 17:44:16 -070040 host_supported: true,
Dan Willemsen8fd503f2016-10-04 20:04:36 -070041
Dan Willemsen8fd503f2016-10-04 20:04:36 -070042 srcs: [
43 "aidl.cpp",
Jiyong Park3656c3c2018-08-01 20:02:01 +090044 "aidl_apicheck.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070045 "aidl_language.cpp",
46 "aidl_language_l.ll",
47 "aidl_language_y.yy",
Jiyong Park1deecc32018-07-17 01:14:41 +090048 "aidl_typenames.cpp",
Steven Moreland860b1942018-08-16 14:59:28 -070049 "aidl_to_cpp.cpp",
Jiyong Park1d2df7d2018-07-23 15:22:50 +090050 "aidl_to_java.cpp",
Steven Morelande8a3a192018-09-20 14:14:28 -070051 "aidl_to_ndk.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070052 "ast_cpp.cpp",
53 "ast_java.cpp",
54 "code_writer.cpp",
55 "generate_cpp.cpp",
Steven Morelandb0057e72018-08-27 01:44:11 -070056 "aidl_to_cpp_common.cpp",
57 "generate_ndk.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070058 "generate_java.cpp",
59 "generate_java_binder.cpp",
Andrei Onea8714b022019-02-01 18:55:54 +000060 "generate_aidl_mappings.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -070061 "import_resolver.cpp",
62 "line_reader.cpp",
63 "io_delegate.cpp",
64 "options.cpp",
65 "type_cpp.cpp",
66 "type_java.cpp",
67 "type_namespace.cpp",
68 ],
Dan Willemsenfad411f2019-04-12 14:40:55 -070069 yacc: {
70 gen_location_hh: true,
71 gen_position_hh: true,
72 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -070073}
74
75// aidl executable
76cc_binary_host {
77 name: "aidl",
78 defaults: ["aidl_defaults"],
Jiyong Park74595c12018-07-23 15:22:50 +090079 srcs: ["main.cpp"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -070080 static_libs: [
81 "libaidl-common",
82 "libbase",
83 ],
84}
85
86// aidl-cpp executable
87cc_binary_host {
88 name: "aidl-cpp",
89 defaults: ["aidl_defaults"],
90 srcs: ["main_cpp.cpp"],
91 static_libs: [
92 "libaidl-common",
93 "libbase",
94 ],
95}
96
97// Unit tests
Andreas Gampe76a6a462018-10-08 17:44:16 -070098cc_test {
Dan Willemsen8fd503f2016-10-04 20:04:36 -070099 name: "aidl_unittests",
Andreas Gampe76a6a462018-10-08 17:44:16 -0700100 host_supported: true,
101
102 test_suites: ["device-tests"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700103
104 cflags: [
105 "-Wall",
106 "-Wextra",
107 "-Werror",
108 "-g",
109 "-DUNIT_TEST",
110 ],
Steven Moreland1c41e972018-07-09 16:07:00 -0700111
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700112 srcs: [
113 "aidl_unittest.cpp",
114 "ast_cpp_unittest.cpp",
115 "ast_java_unittest.cpp",
Jiyong Park22b4ecd2018-07-23 23:34:42 +0900116 "code_writer_unittest.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700117 "generate_cpp_unittest.cpp",
118 "io_delegate_unittest.cpp",
119 "options_unittest.cpp",
120 "tests/end_to_end_tests.cpp",
121 "tests/fake_io_delegate.cpp",
122 "tests/main.cpp",
123 "tests/test_data_example_interface.cpp",
124 "tests/test_data_ping_responder.cpp",
125 "tests/test_data_string_constants.cpp",
126 "tests/test_util.cpp",
127 "type_cpp_unittest.cpp",
128 "type_java_unittest.cpp",
129 ],
130
131 static_libs: [
132 "libaidl-common",
133 "libbase",
134 "libcutils",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700135 ],
Andreas Gampe76a6a462018-10-08 17:44:16 -0700136 target: {
137 host: {
138 static_libs: ["libgmock_host"],
139 },
140 android: {
141 static_libs: [
142 "libgmock",
143 "liblog",
144 ],
145 },
146 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700147}
148
149//
150// Everything below here is used for integration testing of generated AIDL code.
151//
152cc_binary {
153 name: "aidl_test_sentinel_searcher",
154 srcs: ["tests/aidl_test_sentinel_searcher.cpp"],
155 cflags: [
156 "-Wall",
157 "-Wextra",
158 "-Werror",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700159 ],
160}
Dan Willemsen8f883612016-11-03 14:22:48 -0700161
162cc_defaults {
163 name: "aidl_test_defaults",
164 cflags: [
165 "-Wall",
166 "-Wextra",
167 "-Werror",
Dan Willemsen8f883612016-11-03 14:22:48 -0700168 ],
169 shared_libs: [
170 "libbase",
171 "libbinder",
172 "liblog",
173 "libutils",
174 ],
175}
176
177cc_library_shared {
178 name: "libaidl-integration-test",
179 defaults: ["aidl_test_defaults"],
180 aidl: {
181 export_aidl_headers: true,
182 local_include_dirs: ["tests"],
183 include_dirs: ["frameworks/native/aidl/binder"],
184 },
185 srcs: [
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800186 "tests/android/aidl/tests/*.aidl",
Dan Willemsen8f883612016-11-03 14:22:48 -0700187 "tests/simple_parcelable.cpp",
188 ],
189}
190
191cc_binary {
192 name: "aidl_test_service",
193 defaults: ["aidl_test_defaults"],
194 shared_libs: ["libaidl-integration-test"],
195 srcs: ["tests/aidl_test_service.cpp"],
196}
197
198cc_binary {
199 name: "aidl_test_client",
200 defaults: ["aidl_test_defaults"],
201 shared_libs: ["libaidl-integration-test"],
202 srcs: [
203 "tests/aidl_test_client.cpp",
204 "tests/aidl_test_client_file_descriptors.cpp",
205 "tests/aidl_test_client_parcelables.cpp",
206 "tests/aidl_test_client_nullables.cpp",
207 "tests/aidl_test_client_primitives.cpp",
208 "tests/aidl_test_client_utf8_strings.cpp",
209 "tests/aidl_test_client_service_exceptions.cpp",
Jiyong Park75e1a742018-07-04 12:31:23 +0900210 "tests/aidl_test_client_defaultimpl.cpp",
Dan Willemsen8f883612016-11-03 14:22:48 -0700211 ],
212}
Steven Moreland0ae34602018-06-28 10:08:19 -0700213
214android_app {
215 name: "aidl_test_services",
216 platform_apis: true,
217 // Turn off Java optimization tools to speed up our test iterations.
218 optimize: {
219 enabled: false,
220 },
221 dex_preopt: {
222 enabled: false,
223 },
224 certificate: "platform",
225 manifest: "tests/java_app/AndroidManifest.xml",
226 resource_dirs: ["tests/java_app/resources"],
227 srcs: [
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800228 "tests/android/aidl/tests/*.aidl",
Steven Moreland0ae34602018-06-28 10:08:19 -0700229 "tests/java_app/src/android/aidl/tests/NullableTests.java",
230 "tests/java_app/src/android/aidl/tests/SimpleParcelable.java",
231 "tests/java_app/src/android/aidl/tests/TestFailException.java",
232 "tests/java_app/src/android/aidl/tests/TestLogger.java",
233 "tests/java_app/src/android/aidl/tests/TestServiceClient.java",
234 ],
235 aidl: {
236 include_dirs: [
237 "system/tools/aidl/tests/",
238 "frameworks/native/aidl/binder",
239 ],
240 },
241}
Jiyong Parkce50e262018-10-29 09:54:20 +0900242
243aidl_interface {
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800244 name: "aidl_test_loggable_interface",
Jiyong Parkce50e262018-10-29 09:54:20 +0900245 local_include_dir: "tests",
246 srcs: [
Steven Moreland6e435322019-03-29 18:16:39 -0700247 "tests/android/aidl/loggable/ILoggableInterface.aidl",
Jiyong Parkce50e262018-10-29 09:54:20 +0900248 ],
249 backend: {
250 cpp: {
251 gen_log: true,
252 },
253 ndk: {
254 enabled: false,
255 },
256 },
257}
Jeongik Cha37e2ad52019-04-18 13:44:26 +0900258
259aidl_interface {
260 name: "aidl_test_loggable_interface_ndk",
261 local_include_dir: "tests",
262 srcs: [
263 "tests/android/aidl/loggable/ILoggableInterfaceNdk.aidl",
264 ],
265 backend: {
266 ndk: {
267 gen_log: true,
268 },
269 },
270}