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 | }, |
| 33 | }, |
| 34 | } |
| 35 | |
| 36 | // Logic shared between aidl and its unittests |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 37 | cc_library_static { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 38 | name: "libaidl-common", |
| 39 | defaults: ["aidl_defaults"], |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 40 | host_supported: true, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 41 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 42 | srcs: [ |
| 43 | "aidl.cpp", |
Jiyong Park | 3656c3c | 2018-08-01 20:02:01 +0900 | [diff] [blame] | 44 | "aidl_apicheck.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 45 | "aidl_language.cpp", |
| 46 | "aidl_language_l.ll", |
| 47 | "aidl_language_y.yy", |
Jiyong Park | 1deecc3 | 2018-07-17 01:14:41 +0900 | [diff] [blame] | 48 | "aidl_typenames.cpp", |
Steven Moreland | 860b194 | 2018-08-16 14:59:28 -0700 | [diff] [blame] | 49 | "aidl_to_cpp.cpp", |
Jiyong Park | 1d2df7d | 2018-07-23 15:22:50 +0900 | [diff] [blame] | 50 | "aidl_to_java.cpp", |
Steven Moreland | e8a3a19 | 2018-09-20 14:14:28 -0700 | [diff] [blame] | 51 | "aidl_to_ndk.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 52 | "ast_cpp.cpp", |
| 53 | "ast_java.cpp", |
| 54 | "code_writer.cpp", |
| 55 | "generate_cpp.cpp", |
Steven Moreland | b0057e7 | 2018-08-27 01:44:11 -0700 | [diff] [blame] | 56 | "aidl_to_cpp_common.cpp", |
| 57 | "generate_ndk.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 58 | "generate_java.cpp", |
| 59 | "generate_java_binder.cpp", |
Andrei Onea | 8714b02 | 2019-02-01 18:55:54 +0000 | [diff] [blame] | 60 | "generate_aidl_mappings.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 61 | "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 Willemsen | fad411f | 2019-04-12 14:40:55 -0700 | [diff] [blame] | 69 | yacc: { |
| 70 | gen_location_hh: true, |
| 71 | gen_position_hh: true, |
| 72 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | // aidl executable |
| 76 | cc_binary_host { |
| 77 | name: "aidl", |
| 78 | defaults: ["aidl_defaults"], |
Jiyong Park | 74595c1 | 2018-07-23 15:22:50 +0900 | [diff] [blame] | 79 | srcs: ["main.cpp"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 80 | static_libs: [ |
| 81 | "libaidl-common", |
| 82 | "libbase", |
| 83 | ], |
| 84 | } |
| 85 | |
| 86 | // aidl-cpp executable |
| 87 | cc_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 Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 98 | cc_test { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 99 | name: "aidl_unittests", |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 100 | host_supported: true, |
| 101 | |
| 102 | test_suites: ["device-tests"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 103 | |
| 104 | cflags: [ |
| 105 | "-Wall", |
| 106 | "-Wextra", |
| 107 | "-Werror", |
| 108 | "-g", |
| 109 | "-DUNIT_TEST", |
| 110 | ], |
Steven Moreland | 1c41e97 | 2018-07-09 16:07:00 -0700 | [diff] [blame] | 111 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 112 | srcs: [ |
| 113 | "aidl_unittest.cpp", |
| 114 | "ast_cpp_unittest.cpp", |
| 115 | "ast_java_unittest.cpp", |
Jiyong Park | 22b4ecd | 2018-07-23 23:34:42 +0900 | [diff] [blame] | 116 | "code_writer_unittest.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 117 | "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 Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 135 | ], |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 136 | target: { |
| 137 | host: { |
| 138 | static_libs: ["libgmock_host"], |
| 139 | }, |
| 140 | android: { |
| 141 | static_libs: [ |
| 142 | "libgmock", |
| 143 | "liblog", |
| 144 | ], |
| 145 | }, |
| 146 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | // |
| 150 | // Everything below here is used for integration testing of generated AIDL code. |
| 151 | // |
| 152 | cc_binary { |
| 153 | name: "aidl_test_sentinel_searcher", |
| 154 | srcs: ["tests/aidl_test_sentinel_searcher.cpp"], |
| 155 | cflags: [ |
| 156 | "-Wall", |
| 157 | "-Wextra", |
| 158 | "-Werror", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 159 | ], |
| 160 | } |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 161 | |
| 162 | cc_defaults { |
| 163 | name: "aidl_test_defaults", |
| 164 | cflags: [ |
| 165 | "-Wall", |
| 166 | "-Wextra", |
| 167 | "-Werror", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 168 | ], |
| 169 | shared_libs: [ |
| 170 | "libbase", |
| 171 | "libbinder", |
| 172 | "liblog", |
| 173 | "libutils", |
| 174 | ], |
| 175 | } |
| 176 | |
| 177 | cc_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 Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 186 | "tests/android/aidl/tests/*.aidl", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 187 | "tests/simple_parcelable.cpp", |
| 188 | ], |
| 189 | } |
| 190 | |
| 191 | cc_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 | |
| 198 | cc_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 Park | 75e1a74 | 2018-07-04 12:31:23 +0900 | [diff] [blame] | 210 | "tests/aidl_test_client_defaultimpl.cpp", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 211 | ], |
| 212 | } |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 213 | |
| 214 | android_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 Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 228 | "tests/android/aidl/tests/*.aidl", |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 229 | "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 Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 242 | |
| 243 | aidl_interface { |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 244 | name: "aidl_test_loggable_interface", |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 245 | local_include_dir: "tests", |
| 246 | srcs: [ |
Steven Moreland | 6e43532 | 2019-03-29 18:16:39 -0700 | [diff] [blame] | 247 | "tests/android/aidl/loggable/ILoggableInterface.aidl", |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 248 | ], |
| 249 | backend: { |
| 250 | cpp: { |
| 251 | gen_log: true, |
| 252 | }, |
| 253 | ndk: { |
| 254 | enabled: false, |
| 255 | }, |
| 256 | }, |
| 257 | } |
Jeongik Cha | 37e2ad5 | 2019-04-18 13:44:26 +0900 | [diff] [blame] | 258 | |
| 259 | aidl_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 | } |