Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 1 | // |
| 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 | |
| 17 | cc_defaults { |
| 18 | name: "aidl_defaults", |
Chih-Hung Hsieh | 1560796 | 2017-10-02 10:03:55 -0700 | [diff] [blame] | 19 | cflags: [ |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 20 | "-Wall", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 21 | "-Werror", |
Chih-Hung Hsieh | 1560796 | 2017-10-02 10:03:55 -0700 | [diff] [blame] | 22 | "-Wextra", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 23 | ], |
| 24 | whole_static_libs: ["libgtest_prod"], |
| 25 | static_libs: [ |
| 26 | "libbase", |
| 27 | "libcutils", |
| 28 | ], |
| 29 | target: { |
| 30 | windows: { |
| 31 | enabled: true, |
| 32 | }, |
Steven Moreland | b49a33d | 2019-08-21 11:17:32 -0700 | [diff] [blame] | 33 | host: { |
| 34 | cflags: [ |
| 35 | "-O0", |
| 36 | "-g", |
| 37 | ], |
| 38 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 39 | }, |
| 40 | } |
| 41 | |
| 42 | // Logic shared between aidl and its unittests |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 43 | cc_library_static { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 44 | name: "libaidl-common", |
| 45 | defaults: ["aidl_defaults"], |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 46 | host_supported: true, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 47 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 48 | srcs: [ |
| 49 | "aidl.cpp", |
Steven Moreland | 4958524 | 2019-12-18 16:06:49 -0800 | [diff] [blame] | 50 | "aidl_checkapi.cpp", |
Will McVicker | efd970d | 2019-09-25 15:28:30 -0700 | [diff] [blame] | 51 | "aidl_const_expressions.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 52 | "aidl_language.cpp", |
| 53 | "aidl_language_l.ll", |
| 54 | "aidl_language_y.yy", |
Jiyong Park | 1deecc3 | 2018-07-17 01:14:41 +0900 | [diff] [blame] | 55 | "aidl_typenames.cpp", |
Steven Moreland | 860b194 | 2018-08-16 14:59:28 -0700 | [diff] [blame] | 56 | "aidl_to_cpp.cpp", |
Jiyong Park | 1d2df7d | 2018-07-23 15:22:50 +0900 | [diff] [blame] | 57 | "aidl_to_java.cpp", |
Steven Moreland | e8a3a19 | 2018-09-20 14:14:28 -0700 | [diff] [blame] | 58 | "aidl_to_ndk.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 59 | "ast_cpp.cpp", |
| 60 | "ast_java.cpp", |
| 61 | "code_writer.cpp", |
| 62 | "generate_cpp.cpp", |
Steven Moreland | b0057e7 | 2018-08-27 01:44:11 -0700 | [diff] [blame] | 63 | "aidl_to_cpp_common.cpp", |
| 64 | "generate_ndk.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 65 | "generate_java.cpp", |
| 66 | "generate_java_binder.cpp", |
Andrei Onea | 8714b02 | 2019-02-01 18:55:54 +0000 | [diff] [blame] | 67 | "generate_aidl_mappings.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 68 | "import_resolver.cpp", |
| 69 | "line_reader.cpp", |
| 70 | "io_delegate.cpp", |
| 71 | "options.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 72 | ], |
Dan Willemsen | fad411f | 2019-04-12 14:40:55 -0700 | [diff] [blame] | 73 | yacc: { |
| 74 | gen_location_hh: true, |
| 75 | gen_position_hh: true, |
| 76 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | // aidl executable |
| 80 | cc_binary_host { |
| 81 | name: "aidl", |
| 82 | defaults: ["aidl_defaults"], |
Jiyong Park | 74595c1 | 2018-07-23 15:22:50 +0900 | [diff] [blame] | 83 | srcs: ["main.cpp"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 84 | static_libs: [ |
| 85 | "libaidl-common", |
| 86 | "libbase", |
Tom Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 87 | "liblog", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 88 | ], |
| 89 | } |
| 90 | |
Steven Moreland | bb654e3 | 2020-01-08 19:52:05 -0800 | [diff] [blame] | 91 | // aidl-cpp legacy executable, please use 'aidl' instead |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 92 | cc_binary_host { |
| 93 | name: "aidl-cpp", |
| 94 | defaults: ["aidl_defaults"], |
Steven Moreland | bb654e3 | 2020-01-08 19:52:05 -0800 | [diff] [blame] | 95 | srcs: ["main.cpp"], |
| 96 | cflags: ["-DAIDL_CPP_BUILD"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 97 | static_libs: [ |
| 98 | "libaidl-common", |
| 99 | "libbase", |
Tom Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 100 | "liblog", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 101 | ], |
| 102 | } |
| 103 | |
| 104 | // Unit tests |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 105 | cc_test { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 106 | name: "aidl_unittests", |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 107 | host_supported: true, |
| 108 | |
| 109 | test_suites: ["device-tests"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 110 | |
| 111 | cflags: [ |
| 112 | "-Wall", |
| 113 | "-Wextra", |
| 114 | "-Werror", |
| 115 | "-g", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 116 | ], |
Steven Moreland | 1c41e97 | 2018-07-09 16:07:00 -0700 | [diff] [blame] | 117 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 118 | srcs: [ |
| 119 | "aidl_unittest.cpp", |
| 120 | "ast_cpp_unittest.cpp", |
| 121 | "ast_java_unittest.cpp", |
Jiyong Park | 22b4ecd | 2018-07-23 23:34:42 +0900 | [diff] [blame] | 122 | "code_writer_unittest.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 123 | "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 Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 133 | ], |
| 134 | |
| 135 | static_libs: [ |
| 136 | "libaidl-common", |
| 137 | "libbase", |
| 138 | "libcutils", |
Steven Moreland | 57ec44a | 2019-10-25 15:50:21 -0700 | [diff] [blame] | 139 | "libgmock", |
Tom Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 140 | "liblog", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 141 | ], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 142 | } |
| 143 | |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 144 | cc_fuzz { |
| 145 | name: "aidl_parser_fuzzer", |
| 146 | host_supported: true, |
| 147 | dictionary: "tests/aidl_parser_fuzzer.dict", |
Mitch Phillips | 17fad88 | 2019-12-18 11:27:40 -0800 | [diff] [blame] | 148 | corpus: [ |
| 149 | "tests/corpus/*", |
| 150 | ], |
Steven Moreland | 00f1ee7 | 2019-11-04 09:52:06 -0800 | [diff] [blame] | 151 | |
| 152 | fuzz_config: { |
| 153 | cc: [ |
| 154 | "smoreland@google.com", |
| 155 | "jiyong@google.com", |
| 156 | "jeongik@google.com", |
| 157 | ], |
| 158 | }, |
| 159 | |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 160 | 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 Cherry | ffe43cd | 2020-01-08 14:10:30 -0800 | [diff] [blame] | 169 | "liblog", |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 170 | ], |
Steven Moreland | 45857d7 | 2019-10-25 17:08:09 -0700 | [diff] [blame] | 171 | // Enable this to show additional information about what is being parsed during fuzzing. |
| 172 | // cflags: ["-DFUZZ_LOG"], |
| 173 | } |
| 174 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 175 | // |
| 176 | // Everything below here is used for integration testing of generated AIDL code. |
| 177 | // |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 178 | cc_test { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 179 | name: "aidl_test_sentinel_searcher", |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 180 | gtest: false, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 181 | srcs: ["tests/aidl_test_sentinel_searcher.cpp"], |
| 182 | cflags: [ |
| 183 | "-Wall", |
| 184 | "-Wextra", |
| 185 | "-Werror", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 186 | ], |
| 187 | } |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 188 | |
| 189 | cc_defaults { |
| 190 | name: "aidl_test_defaults", |
| 191 | cflags: [ |
| 192 | "-Wall", |
| 193 | "-Wextra", |
| 194 | "-Werror", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 195 | ], |
| 196 | shared_libs: [ |
| 197 | "libbase", |
| 198 | "libbinder", |
| 199 | "liblog", |
| 200 | "libutils", |
| 201 | ], |
| 202 | } |
| 203 | |
Dan Willemsen | c46b65e | 2019-06-06 10:55:58 -0700 | [diff] [blame] | 204 | filegroup { |
| 205 | name: "libaidl-integration-test-files", |
| 206 | srcs: ["tests/android/aidl/tests/*.aidl"], |
| 207 | path: "tests", |
| 208 | } |
| 209 | |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 210 | cc_library_static { |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 211 | 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 Willemsen | c46b65e | 2019-06-06 10:55:58 -0700 | [diff] [blame] | 219 | ":libaidl-integration-test-files", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 220 | "tests/simple_parcelable.cpp", |
| 221 | ], |
| 222 | } |
| 223 | |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 224 | cc_test { |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 225 | name: "aidl_test_service", |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 226 | gtest: false, |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 227 | defaults: ["aidl_test_defaults"], |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 228 | static_libs: ["libaidl-integration-test"], |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 229 | srcs: ["tests/aidl_test_service.cpp"], |
| 230 | } |
| 231 | |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 232 | cc_test { |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 233 | name: "aidl_test_client", |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 234 | gtest: false, |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 235 | defaults: ["aidl_test_defaults"], |
Steven Moreland | 87bbbd8 | 2019-07-30 16:32:54 -0700 | [diff] [blame] | 236 | static_libs: ["libaidl-integration-test"], |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 237 | 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 Park | 75e1a74 | 2018-07-04 12:31:23 +0900 | [diff] [blame] | 245 | "tests/aidl_test_client_defaultimpl.cpp", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 246 | ], |
| 247 | } |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 248 | |
| 249 | android_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 Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 263 | "tests/android/aidl/tests/*.aidl", |
Jeongik Cha | e74c86d | 2019-12-12 16:54:03 +0900 | [diff] [blame] | 264 | "tests/android/aidl/tests/generic/*.aidl", |
Jeongik Cha | e48d994 | 2020-01-02 17:39:00 +0900 | [diff] [blame] | 265 | "tests/android/aidl/tests/map/*.aidl", |
Jeongik Cha | e74c86d | 2019-12-12 16:54:03 +0900 | [diff] [blame] | 266 | "tests/java_app/src/android/aidl/tests/GenericTests.java", |
Jeongik Cha | e48d994 | 2020-01-02 17:39:00 +0900 | [diff] [blame] | 267 | "tests/java_app/src/android/aidl/tests/MapTests.java", |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 268 | "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 Cha | e74c86d | 2019-12-12 16:54:03 +0900 | [diff] [blame] | 273 | "tests/java_app/src/android/aidl/tests/generic/Pair.java", |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 274 | ], |
| 275 | aidl: { |
| 276 | include_dirs: [ |
| 277 | "system/tools/aidl/tests/", |
| 278 | "frameworks/native/aidl/binder", |
| 279 | ], |
| 280 | }, |
| 281 | } |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 282 | |
| 283 | aidl_interface { |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 284 | name: "aidl_test_loggable_interface", |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 285 | local_include_dir: "tests", |
| 286 | srcs: [ |
Steven Moreland | 6e43532 | 2019-03-29 18:16:39 -0700 | [diff] [blame] | 287 | "tests/android/aidl/loggable/ILoggableInterface.aidl", |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 288 | ], |
| 289 | backend: { |
| 290 | cpp: { |
| 291 | gen_log: true, |
| 292 | }, |
| 293 | ndk: { |
Jeongik Cha | 37e2ad5 | 2019-04-18 13:44:26 +0900 | [diff] [blame] | 294 | gen_log: true, |
| 295 | }, |
| 296 | }, |
Steven Moreland | bb654e3 | 2020-01-08 19:52:05 -0800 | [diff] [blame] | 297 | } |