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 17cc_defaults { 18 name: "aidl_defaults", 19 cflags: [ 20 "-Wall", 21 "-Werror", 22 "-Wextra", 23 ], 24 whole_static_libs: ["libgtest_prod"], 25 static_libs: [ 26 "libbase", 27 "libcutils", 28 ], 29 target: { 30 windows: { 31 enabled: true, 32 }, 33 host: { 34 cflags: [ 35 "-O0", 36 "-g", 37 ], 38 }, 39 }, 40} 41 42// Logic shared between aidl and its unittests 43cc_library_static { 44 name: "libaidl-common", 45 defaults: ["aidl_defaults"], 46 host_supported: true, 47 cflags: [ 48 "-Wno-bool-operation", // found in aidl_const_expressions.cpp:69 49 ], 50 51 srcs: [ 52 "aidl.cpp", 53 "aidl_checkapi.cpp", 54 "aidl_const_expressions.cpp", 55 "aidl_language.cpp", 56 "aidl_language_l.ll", 57 "aidl_language_y.yy", 58 "aidl_typenames.cpp", 59 "aidl_to_cpp.cpp", 60 "aidl_to_java.cpp", 61 "aidl_to_ndk.cpp", 62 "ast_cpp.cpp", 63 "ast_java.cpp", 64 "code_writer.cpp", 65 "generate_cpp.cpp", 66 "aidl_to_cpp_common.cpp", 67 "generate_ndk.cpp", 68 "generate_java.cpp", 69 "generate_java_binder.cpp", 70 "generate_aidl_mappings.cpp", 71 "import_resolver.cpp", 72 "line_reader.cpp", 73 "io_delegate.cpp", 74 "options.cpp", 75 ], 76 yacc: { 77 gen_location_hh: true, 78 gen_position_hh: true, 79 }, 80} 81 82// aidl executable 83cc_binary_host { 84 name: "aidl", 85 defaults: ["aidl_defaults"], 86 srcs: ["main.cpp"], 87 static_libs: [ 88 "libaidl-common", 89 "libbase", 90 "liblog", 91 ], 92} 93 94// aidl-cpp legacy executable, please use 'aidl' instead 95cc_binary_host { 96 name: "aidl-cpp", 97 defaults: ["aidl_defaults"], 98 srcs: ["main.cpp"], 99 cflags: ["-DAIDL_CPP_BUILD"], 100 static_libs: [ 101 "libaidl-common", 102 "libbase", 103 "liblog", 104 ], 105} 106 107// Unit tests 108cc_test { 109 name: "aidl_unittests", 110 host_supported: true, 111 112 test_suites: ["device-tests"], 113 114 cflags: [ 115 "-Wall", 116 "-Wextra", 117 "-Werror", 118 "-g", 119 ], 120 121 srcs: [ 122 "aidl_unittest.cpp", 123 "ast_cpp_unittest.cpp", 124 "ast_java_unittest.cpp", 125 "code_writer_unittest.cpp", 126 "generate_cpp_unittest.cpp", 127 "io_delegate_unittest.cpp", 128 "options_unittest.cpp", 129 "tests/end_to_end_tests.cpp", 130 "tests/fake_io_delegate.cpp", 131 "tests/main.cpp", 132 "tests/test_data_example_interface.cpp", 133 "tests/test_data_ping_responder.cpp", 134 "tests/test_data_string_constants.cpp", 135 "tests/test_util.cpp", 136 ], 137 138 static_libs: [ 139 "libaidl-common", 140 "libbase", 141 "libcutils", 142 "libgmock", 143 "liblog", 144 ], 145} 146 147cc_fuzz { 148 name: "aidl_parser_fuzzer", 149 host_supported: true, 150 dictionary: "tests/aidl_parser_fuzzer.dict", 151 corpus: [ 152 "tests/corpus/*", 153 ], 154 155 fuzz_config: { 156 cc: [ 157 "smoreland@google.com", 158 "jiyong@google.com", 159 "jeongik@google.com", 160 ], 161 }, 162 163 srcs: [ 164 "tests/aidl_parser_fuzzer.cpp", 165 "tests/fake_io_delegate.cpp", 166 "tests/test_util.cpp", 167 ], 168 static_libs: [ 169 "libaidl-common", 170 "libbase", 171 "libcutils", 172 "liblog", 173 ], 174 // Enable this to show additional information about what is being parsed during fuzzing. 175 // cflags: ["-DFUZZ_LOG"], 176} 177 178// 179// Everything below here is used for integration testing of generated AIDL code. 180// 181cc_test { 182 name: "aidl_test_sentinel_searcher", 183 gtest: false, 184 srcs: ["tests/aidl_test_sentinel_searcher.cpp"], 185 cflags: [ 186 "-Wall", 187 "-Wextra", 188 "-Werror", 189 ], 190} 191 192cc_defaults { 193 name: "aidl_test_defaults", 194 cflags: [ 195 "-Wall", 196 "-Wextra", 197 "-Werror", 198 ], 199 shared_libs: [ 200 "libbase", 201 "libbinder", 202 "liblog", 203 "libutils", 204 ], 205} 206 207filegroup { 208 name: "libaidl-integration-test-files", 209 srcs: ["tests/android/aidl/tests/*.aidl"], 210 path: "tests", 211} 212 213cc_library_static { 214 name: "libaidl-integration-test", 215 defaults: ["aidl_test_defaults"], 216 aidl: { 217 export_aidl_headers: true, 218 local_include_dirs: ["tests"], 219 include_dirs: ["frameworks/native/aidl/binder"], 220 }, 221 srcs: [ 222 ":libaidl-integration-test-files", 223 "tests/simple_parcelable.cpp", 224 ], 225} 226 227cc_test { 228 name: "aidl_test_service", 229 gtest: false, 230 defaults: ["aidl_test_defaults"], 231 static_libs: ["libaidl-integration-test"], 232 srcs: ["tests/aidl_test_service.cpp"], 233} 234 235cc_test { 236 name: "aidl_test_client", 237 gtest: false, 238 defaults: ["aidl_test_defaults"], 239 static_libs: ["libaidl-integration-test"], 240 srcs: [ 241 "tests/aidl_test_client.cpp", 242 "tests/aidl_test_client_file_descriptors.cpp", 243 "tests/aidl_test_client_parcelables.cpp", 244 "tests/aidl_test_client_nullables.cpp", 245 "tests/aidl_test_client_primitives.cpp", 246 "tests/aidl_test_client_utf8_strings.cpp", 247 "tests/aidl_test_client_service_exceptions.cpp", 248 "tests/aidl_test_client_defaultimpl.cpp", 249 ], 250} 251 252android_app { 253 name: "aidl_test_services", 254 platform_apis: true, 255 // Turn off Java optimization tools to speed up our test iterations. 256 optimize: { 257 enabled: false, 258 }, 259 dex_preopt: { 260 enabled: false, 261 }, 262 certificate: "platform", 263 manifest: "tests/java_app/AndroidManifest.xml", 264 resource_dirs: ["tests/java_app/resources"], 265 srcs: [ 266 "tests/android/aidl/tests/*.aidl", 267 "tests/android/aidl/tests/generic/*.aidl", 268 "tests/android/aidl/tests/map/*.aidl", 269 "tests/java_app/src/android/aidl/tests/GenericTests.java", 270 "tests/java_app/src/android/aidl/tests/MapTests.java", 271 "tests/java_app/src/android/aidl/tests/NullableTests.java", 272 "tests/java_app/src/android/aidl/tests/SimpleParcelable.java", 273 "tests/java_app/src/android/aidl/tests/TestFailException.java", 274 "tests/java_app/src/android/aidl/tests/TestLogger.java", 275 "tests/java_app/src/android/aidl/tests/TestServiceClient.java", 276 "tests/java_app/src/android/aidl/tests/generic/Pair.java", 277 ], 278 aidl: { 279 include_dirs: [ 280 "system/tools/aidl/tests/", 281 "frameworks/native/aidl/binder", 282 ], 283 }, 284} 285 286aidl_interface { 287 name: "aidl_test_loggable_interface", 288 unstable: true, 289 local_include_dir: "tests", 290 srcs: [ 291 "tests/android/aidl/loggable/ILoggableInterface.aidl", 292 ], 293 gen_trace: true, 294 backend: { 295 cpp: { 296 gen_log: true, 297 }, 298 ndk: { 299 gen_log: true, 300 }, 301 }, 302} 303