blob: 37c54ecb1d73f76fbf6b20dbfdd1dce0679585f2 [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",
60 "import_resolver.cpp",
61 "line_reader.cpp",
62 "io_delegate.cpp",
63 "options.cpp",
64 "type_cpp.cpp",
65 "type_java.cpp",
66 "type_namespace.cpp",
67 ],
68}
69
70// aidl executable
71cc_binary_host {
72 name: "aidl",
73 defaults: ["aidl_defaults"],
Jiyong Park74595c12018-07-23 15:22:50 +090074 srcs: ["main.cpp"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -070075 static_libs: [
76 "libaidl-common",
77 "libbase",
78 ],
79}
80
81// aidl-cpp executable
82cc_binary_host {
83 name: "aidl-cpp",
84 defaults: ["aidl_defaults"],
85 srcs: ["main_cpp.cpp"],
86 static_libs: [
87 "libaidl-common",
88 "libbase",
89 ],
90}
91
92// Unit tests
Andreas Gampe76a6a462018-10-08 17:44:16 -070093cc_test {
Dan Willemsen8fd503f2016-10-04 20:04:36 -070094 name: "aidl_unittests",
Andreas Gampe76a6a462018-10-08 17:44:16 -070095 host_supported: true,
96
97 test_suites: ["device-tests"],
Dan Willemsen8fd503f2016-10-04 20:04:36 -070098
99 cflags: [
100 "-Wall",
101 "-Wextra",
102 "-Werror",
103 "-g",
104 "-DUNIT_TEST",
105 ],
Steven Moreland1c41e972018-07-09 16:07:00 -0700106
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700107 srcs: [
108 "aidl_unittest.cpp",
109 "ast_cpp_unittest.cpp",
110 "ast_java_unittest.cpp",
Jiyong Park22b4ecd2018-07-23 23:34:42 +0900111 "code_writer_unittest.cpp",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700112 "generate_cpp_unittest.cpp",
113 "io_delegate_unittest.cpp",
114 "options_unittest.cpp",
115 "tests/end_to_end_tests.cpp",
116 "tests/fake_io_delegate.cpp",
117 "tests/main.cpp",
118 "tests/test_data_example_interface.cpp",
119 "tests/test_data_ping_responder.cpp",
120 "tests/test_data_string_constants.cpp",
121 "tests/test_util.cpp",
122 "type_cpp_unittest.cpp",
123 "type_java_unittest.cpp",
124 ],
125
126 static_libs: [
127 "libaidl-common",
128 "libbase",
129 "libcutils",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700130 ],
Andreas Gampe76a6a462018-10-08 17:44:16 -0700131 target: {
132 host: {
133 static_libs: ["libgmock_host"],
134 },
135 android: {
136 static_libs: [
137 "libgmock",
138 "liblog",
139 ],
140 },
141 },
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700142}
143
144//
145// Everything below here is used for integration testing of generated AIDL code.
146//
147cc_binary {
148 name: "aidl_test_sentinel_searcher",
149 srcs: ["tests/aidl_test_sentinel_searcher.cpp"],
150 cflags: [
151 "-Wall",
152 "-Wextra",
153 "-Werror",
Dan Willemsen8fd503f2016-10-04 20:04:36 -0700154 ],
155}
Dan Willemsen8f883612016-11-03 14:22:48 -0700156
157cc_defaults {
158 name: "aidl_test_defaults",
159 cflags: [
160 "-Wall",
161 "-Wextra",
162 "-Werror",
Dan Willemsen8f883612016-11-03 14:22:48 -0700163 ],
164 shared_libs: [
165 "libbase",
166 "libbinder",
167 "liblog",
168 "libutils",
169 ],
170}
171
172cc_library_shared {
173 name: "libaidl-integration-test",
174 defaults: ["aidl_test_defaults"],
175 aidl: {
176 export_aidl_headers: true,
177 local_include_dirs: ["tests"],
178 include_dirs: ["frameworks/native/aidl/binder"],
179 },
180 srcs: [
181 "tests/android/aidl/tests/ITestService.aidl",
182 "tests/android/aidl/tests/INamedCallback.aidl",
Steven Moreland5557f1c2018-07-02 13:50:23 -0700183 "tests/android/aidl/tests/StructuredParcelable.aidl",
Dan Willemsen8f883612016-11-03 14:22:48 -0700184 "tests/simple_parcelable.cpp",
185 ],
186}
187
188cc_binary {
189 name: "aidl_test_service",
190 defaults: ["aidl_test_defaults"],
191 shared_libs: ["libaidl-integration-test"],
192 srcs: ["tests/aidl_test_service.cpp"],
193}
194
195cc_binary {
196 name: "aidl_test_client",
197 defaults: ["aidl_test_defaults"],
198 shared_libs: ["libaidl-integration-test"],
199 srcs: [
200 "tests/aidl_test_client.cpp",
201 "tests/aidl_test_client_file_descriptors.cpp",
202 "tests/aidl_test_client_parcelables.cpp",
203 "tests/aidl_test_client_nullables.cpp",
204 "tests/aidl_test_client_primitives.cpp",
205 "tests/aidl_test_client_utf8_strings.cpp",
206 "tests/aidl_test_client_service_exceptions.cpp",
Jiyong Park75e1a742018-07-04 12:31:23 +0900207 "tests/aidl_test_client_defaultimpl.cpp",
Dan Willemsen8f883612016-11-03 14:22:48 -0700208 ],
209}
Steven Moreland0ae34602018-06-28 10:08:19 -0700210
211android_app {
212 name: "aidl_test_services",
213 platform_apis: true,
214 // Turn off Java optimization tools to speed up our test iterations.
215 optimize: {
216 enabled: false,
217 },
218 dex_preopt: {
219 enabled: false,
220 },
221 certificate: "platform",
222 manifest: "tests/java_app/AndroidManifest.xml",
223 resource_dirs: ["tests/java_app/resources"],
224 srcs: [
225 "tests/android/aidl/tests/INamedCallback.aidl",
226 "tests/android/aidl/tests/ITestService.aidl",
Steven Moreland5557f1c2018-07-02 13:50:23 -0700227 "tests/android/aidl/tests/StructuredParcelable.aidl",
Steven Moreland0ae34602018-06-28 10:08:19 -0700228 "tests/java_app/src/android/aidl/tests/NullableTests.java",
229 "tests/java_app/src/android/aidl/tests/SimpleParcelable.java",
230 "tests/java_app/src/android/aidl/tests/TestFailException.java",
231 "tests/java_app/src/android/aidl/tests/TestLogger.java",
232 "tests/java_app/src/android/aidl/tests/TestServiceClient.java",
233 ],
234 aidl: {
235 include_dirs: [
236 "system/tools/aidl/tests/",
237 "frameworks/native/aidl/binder",
238 ],
239 },
240}
Jiyong Parkce50e262018-10-29 09:54:20 +0900241
242aidl_interface {
243 name: "aidl_test_interface",
244 local_include_dir: "tests",
245 srcs: [
246 "tests/android/aidl/tests/LoggableInterface.aidl",
247 ],
248 backend: {
249 cpp: {
250 gen_log: true,
251 },
252 ndk: {
253 enabled: false,
254 },
255 },
256}