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", |
| 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 |
| 71 | cc_binary_host { |
| 72 | name: "aidl", |
| 73 | defaults: ["aidl_defaults"], |
Jiyong Park | 74595c1 | 2018-07-23 15:22:50 +0900 | [diff] [blame] | 74 | srcs: ["main.cpp"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 75 | static_libs: [ |
| 76 | "libaidl-common", |
| 77 | "libbase", |
| 78 | ], |
| 79 | } |
| 80 | |
| 81 | // aidl-cpp executable |
| 82 | cc_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 Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 93 | cc_test { |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 94 | name: "aidl_unittests", |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 95 | host_supported: true, |
| 96 | |
| 97 | test_suites: ["device-tests"], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 98 | |
| 99 | cflags: [ |
| 100 | "-Wall", |
| 101 | "-Wextra", |
| 102 | "-Werror", |
| 103 | "-g", |
| 104 | "-DUNIT_TEST", |
| 105 | ], |
Steven Moreland | 1c41e97 | 2018-07-09 16:07:00 -0700 | [diff] [blame] | 106 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 107 | srcs: [ |
| 108 | "aidl_unittest.cpp", |
| 109 | "ast_cpp_unittest.cpp", |
| 110 | "ast_java_unittest.cpp", |
Jiyong Park | 22b4ecd | 2018-07-23 23:34:42 +0900 | [diff] [blame] | 111 | "code_writer_unittest.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 112 | "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 Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 130 | ], |
Andreas Gampe | 76a6a46 | 2018-10-08 17:44:16 -0700 | [diff] [blame] | 131 | target: { |
| 132 | host: { |
| 133 | static_libs: ["libgmock_host"], |
| 134 | }, |
| 135 | android: { |
| 136 | static_libs: [ |
| 137 | "libgmock", |
| 138 | "liblog", |
| 139 | ], |
| 140 | }, |
| 141 | }, |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | // |
| 145 | // Everything below here is used for integration testing of generated AIDL code. |
| 146 | // |
| 147 | cc_binary { |
| 148 | name: "aidl_test_sentinel_searcher", |
| 149 | srcs: ["tests/aidl_test_sentinel_searcher.cpp"], |
| 150 | cflags: [ |
| 151 | "-Wall", |
| 152 | "-Wextra", |
| 153 | "-Werror", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 154 | ], |
| 155 | } |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 156 | |
| 157 | cc_defaults { |
| 158 | name: "aidl_test_defaults", |
| 159 | cflags: [ |
| 160 | "-Wall", |
| 161 | "-Wextra", |
| 162 | "-Werror", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 163 | ], |
| 164 | shared_libs: [ |
| 165 | "libbase", |
| 166 | "libbinder", |
| 167 | "liblog", |
| 168 | "libutils", |
| 169 | ], |
| 170 | } |
| 171 | |
| 172 | cc_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: [ |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 181 | "tests/android/aidl/tests/*.aidl", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 182 | "tests/simple_parcelable.cpp", |
| 183 | ], |
| 184 | } |
| 185 | |
| 186 | cc_binary { |
| 187 | name: "aidl_test_service", |
| 188 | defaults: ["aidl_test_defaults"], |
| 189 | shared_libs: ["libaidl-integration-test"], |
| 190 | srcs: ["tests/aidl_test_service.cpp"], |
| 191 | } |
| 192 | |
| 193 | cc_binary { |
| 194 | name: "aidl_test_client", |
| 195 | defaults: ["aidl_test_defaults"], |
| 196 | shared_libs: ["libaidl-integration-test"], |
| 197 | srcs: [ |
| 198 | "tests/aidl_test_client.cpp", |
| 199 | "tests/aidl_test_client_file_descriptors.cpp", |
| 200 | "tests/aidl_test_client_parcelables.cpp", |
| 201 | "tests/aidl_test_client_nullables.cpp", |
| 202 | "tests/aidl_test_client_primitives.cpp", |
| 203 | "tests/aidl_test_client_utf8_strings.cpp", |
| 204 | "tests/aidl_test_client_service_exceptions.cpp", |
Jiyong Park | 75e1a74 | 2018-07-04 12:31:23 +0900 | [diff] [blame] | 205 | "tests/aidl_test_client_defaultimpl.cpp", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 206 | ], |
| 207 | } |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 208 | |
| 209 | android_app { |
| 210 | name: "aidl_test_services", |
| 211 | platform_apis: true, |
| 212 | // Turn off Java optimization tools to speed up our test iterations. |
| 213 | optimize: { |
| 214 | enabled: false, |
| 215 | }, |
| 216 | dex_preopt: { |
| 217 | enabled: false, |
| 218 | }, |
| 219 | certificate: "platform", |
| 220 | manifest: "tests/java_app/AndroidManifest.xml", |
| 221 | resource_dirs: ["tests/java_app/resources"], |
| 222 | srcs: [ |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 223 | "tests/android/aidl/tests/*.aidl", |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 224 | "tests/java_app/src/android/aidl/tests/NullableTests.java", |
| 225 | "tests/java_app/src/android/aidl/tests/SimpleParcelable.java", |
| 226 | "tests/java_app/src/android/aidl/tests/TestFailException.java", |
| 227 | "tests/java_app/src/android/aidl/tests/TestLogger.java", |
| 228 | "tests/java_app/src/android/aidl/tests/TestServiceClient.java", |
| 229 | ], |
| 230 | aidl: { |
| 231 | include_dirs: [ |
| 232 | "system/tools/aidl/tests/", |
| 233 | "frameworks/native/aidl/binder", |
| 234 | ], |
| 235 | }, |
| 236 | } |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 237 | |
| 238 | aidl_interface { |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 239 | name: "aidl_test_loggable_interface", |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 240 | local_include_dir: "tests", |
| 241 | srcs: [ |
Steven Moreland | 2a9a7d6 | 2019-02-05 16:11:54 -0800 | [diff] [blame] | 242 | "tests/android/aidl/loggable/LoggableInterface.aidl", |
Jiyong Park | ce50e26 | 2018-10-29 09:54:20 +0900 | [diff] [blame] | 243 | ], |
| 244 | backend: { |
| 245 | cpp: { |
| 246 | gen_log: true, |
| 247 | }, |
| 248 | ndk: { |
| 249 | enabled: false, |
| 250 | }, |
| 251 | }, |
| 252 | } |