blob: 0deee8ddfdf613f5c8e587c676b7bf29ae88e295 [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 Onea390cb8b2019-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 ],
69}
70
71// aidl executable
72cc_binary_host {
73 name: "aidl",
74 defaults: ["aidl_defaults"],
Jiyong Park74595c12018-07-23 15:22:50 +090075 srcs: ["main.cpp"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -070076 static_libs: [
77 "libaidl-common",
78 "libbase",
79 ],
80}
81
82// aidl-cpp executable
83cc_binary_host {
84 name: "aidl-cpp",
85 defaults: ["aidl_defaults"],
86 srcs: ["main_cpp.cpp"],
87 static_libs: [
88 "libaidl-common",
89 "libbase",
90 ],
91}
92
93// Unit tests
Andreas Gampe76a6a462018-10-08 17:44:16 -070094cc_test {
Dan Willemsen8fd503f2016-10-04 20:04:36 -070095 name: "aidl_unittests",
Andreas Gampe76a6a462018-10-08 17:44:16 -070096 host_supported: true,
97
98 test_suites: ["device-tests"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -070099
100 cflags: [
101 "-Wall",
102 "-Wextra",
103 "-Werror",
104 "-g",
105 "-DUNIT_TEST",
106 ],
Steven Moreland1c41e972018-07-09 16:07:00 -0700107
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700108 srcs: [
109 "aidl_unittest.cpp",
110 "ast_cpp_unittest.cpp",
111 "ast_java_unittest.cpp",
Jiyong Park22b4ecd2018-07-23 23:34:42 +0900112 "code_writer_unittest.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700113 "generate_cpp_unittest.cpp",
114 "io_delegate_unittest.cpp",
115 "options_unittest.cpp",
116 "tests/end_to_end_tests.cpp",
117 "tests/fake_io_delegate.cpp",
118 "tests/main.cpp",
119 "tests/test_data_example_interface.cpp",
120 "tests/test_data_ping_responder.cpp",
121 "tests/test_data_string_constants.cpp",
122 "tests/test_util.cpp",
123 "type_cpp_unittest.cpp",
124 "type_java_unittest.cpp",
125 ],
126
127 static_libs: [
128 "libaidl-common",
129 "libbase",
130 "libcutils",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700131 ],
Andreas Gampe76a6a462018-10-08 17:44:16 -0700132 target: {
133 host: {
134 static_libs: ["libgmock_host"],
135 },
136 android: {
137 static_libs: [
138 "libgmock",
139 "liblog",
140 ],
141 },
142 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700143}
144
145//
146// Everything below here is used for integration testing of generated AIDL code.
147//
148cc_binary {
149 name: "aidl_test_sentinel_searcher",
150 srcs: ["tests/aidl_test_sentinel_searcher.cpp"],
151 cflags: [
152 "-Wall",
153 "-Wextra",
154 "-Werror",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700155 ],
156}
Dan Willemsen8f883612016-11-03 14:22:48 -0700157
158cc_defaults {
159 name: "aidl_test_defaults",
160 cflags: [
161 "-Wall",
162 "-Wextra",
163 "-Werror",
Dan Willemsen8f883612016-11-03 14:22:48 -0700164 ],
165 shared_libs: [
166 "libbase",
167 "libbinder",
168 "liblog",
169 "libutils",
170 ],
171}
172
173cc_library_shared {
174 name: "libaidl-integration-test",
175 defaults: ["aidl_test_defaults"],
176 aidl: {
177 export_aidl_headers: true,
178 local_include_dirs: ["tests"],
179 include_dirs: ["frameworks/native/aidl/binder"],
180 },
181 srcs: [
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800182 "tests/android/aidl/tests/*.aidl",
Dan Willemsen8f883612016-11-03 14:22:48 -0700183 "tests/simple_parcelable.cpp",
184 ],
185}
186
187cc_binary {
188 name: "aidl_test_service",
189 defaults: ["aidl_test_defaults"],
190 shared_libs: ["libaidl-integration-test"],
191 srcs: ["tests/aidl_test_service.cpp"],
192}
193
194cc_binary {
195 name: "aidl_test_client",
196 defaults: ["aidl_test_defaults"],
197 shared_libs: ["libaidl-integration-test"],
198 srcs: [
199 "tests/aidl_test_client.cpp",
200 "tests/aidl_test_client_file_descriptors.cpp",
201 "tests/aidl_test_client_parcelables.cpp",
202 "tests/aidl_test_client_nullables.cpp",
203 "tests/aidl_test_client_primitives.cpp",
204 "tests/aidl_test_client_utf8_strings.cpp",
205 "tests/aidl_test_client_service_exceptions.cpp",
Jiyong Park75e1a742018-07-04 12:31:23 +0900206 "tests/aidl_test_client_defaultimpl.cpp",
Dan Willemsen8f883612016-11-03 14:22:48 -0700207 ],
208}
Steven Moreland0ae34602018-06-28 10:08:19 -0700209
210android_app {
211 name: "aidl_test_services",
212 platform_apis: true,
213 // Turn off Java optimization tools to speed up our test iterations.
214 optimize: {
215 enabled: false,
216 },
217 dex_preopt: {
218 enabled: false,
219 },
220 certificate: "platform",
221 manifest: "tests/java_app/AndroidManifest.xml",
222 resource_dirs: ["tests/java_app/resources"],
223 srcs: [
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800224 "tests/android/aidl/tests/*.aidl",
Steven Moreland0ae34602018-06-28 10:08:19 -0700225 "tests/java_app/src/android/aidl/tests/NullableTests.java",
226 "tests/java_app/src/android/aidl/tests/SimpleParcelable.java",
227 "tests/java_app/src/android/aidl/tests/TestFailException.java",
228 "tests/java_app/src/android/aidl/tests/TestLogger.java",
229 "tests/java_app/src/android/aidl/tests/TestServiceClient.java",
230 ],
231 aidl: {
232 include_dirs: [
233 "system/tools/aidl/tests/",
234 "frameworks/native/aidl/binder",
235 ],
236 },
237}
Jiyong Parkce50e262018-10-29 09:54:20 +0900238
239aidl_interface {
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800240 name: "aidl_test_loggable_interface",
Jiyong Parkce50e262018-10-29 09:54:20 +0900241 local_include_dir: "tests",
242 srcs: [
Steven Moreland2a9a7d62019-02-05 16:11:54 -0800243 "tests/android/aidl/loggable/LoggableInterface.aidl",
Jiyong Parkce50e262018-10-29 09:54:20 +0900244 ],
245 backend: {
246 cpp: {
247 gen_log: true,
248 },
249 ndk: {
250 enabled: false,
251 },
252 },
253}