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", 19 clang_cflags: [ 20 "-Wall", 21 "-Wextra", 22 "-Werror", 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 37 cc_library_host_static { 38 name: "libaidl-common", 39 defaults: ["aidl_defaults"], 40 41 clang_cflags: [ 42 // Tragically, the code is riddled with unused parameters. 43 "-Wno-unused-parameter", 44 45 // yacc dumps a lot of code *just in case*. 46 "-Wno-unused-function", 47 "-Wno-unneeded-internal-declaration", 48 49 // yacc is a tool from a more civilized age. 50 "-Wno-deprecated-register", 51 52 // yacc also has a habit of using char* over const char*. 53 "-Wno-writable-strings", 54 ], 55 56 srcs: [ 57 "aidl.cpp", 58 "aidl_language.cpp", 59 "aidl_language_l.ll", 60 "aidl_language_y.yy", 61 "ast_cpp.cpp", 62 "ast_java.cpp", 63 "code_writer.cpp", 64 "generate_cpp.cpp", 65 "generate_java.cpp", 66 "generate_java_binder.cpp", 67 "import_resolver.cpp", 68 "line_reader.cpp", 69 "io_delegate.cpp", 70 "options.cpp", 71 "type_cpp.cpp", 72 "type_java.cpp", 73 "type_namespace.cpp", 74 ], 75 } 76 77 // aidl executable 78 cc_binary_host { 79 name: "aidl", 80 defaults: ["aidl_defaults"], 81 srcs: ["main_java.cpp"], 82 static_libs: [ 83 "libaidl-common", 84 "libbase", 85 ], 86 } 87 88 // aidl-cpp executable 89 cc_binary_host { 90 name: "aidl-cpp", 91 defaults: ["aidl_defaults"], 92 srcs: ["main_cpp.cpp"], 93 static_libs: [ 94 "libaidl-common", 95 "libbase", 96 ], 97 } 98 99 // Unit tests 100 cc_test_host { 101 name: "aidl_unittests", 102 103 cflags: [ 104 "-Wall", 105 "-Wextra", 106 "-Werror", 107 "-g", 108 "-DUNIT_TEST", 109 ], 110 // Tragically, the code is riddled with unused parameters. 111 clang_cflags: ["-Wno-unused-parameter"], 112 srcs: [ 113 "aidl_unittest.cpp", 114 "ast_cpp_unittest.cpp", 115 "ast_java_unittest.cpp", 116 "generate_cpp_unittest.cpp", 117 "io_delegate_unittest.cpp", 118 "options_unittest.cpp", 119 "tests/end_to_end_tests.cpp", 120 "tests/fake_io_delegate.cpp", 121 "tests/main.cpp", 122 "tests/test_data_example_interface.cpp", 123 "tests/test_data_ping_responder.cpp", 124 "tests/test_data_string_constants.cpp", 125 "tests/test_util.cpp", 126 "type_cpp_unittest.cpp", 127 "type_java_unittest.cpp", 128 ], 129 130 static_libs: [ 131 "libaidl-common", 132 "libbase", 133 "libcutils", 134 "libgmock_host", 135 ], 136 137 target: { 138 linux: { 139 host_ldlibs: ["-lrt"], 140 }, 141 }, 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", 154 "-Wunused-parameter", 155 ], 156 } 157 158 cc_defaults { 159 name: "aidl_test_defaults", 160 cflags: [ 161 "-Wall", 162 "-Wextra", 163 "-Werror", 164 "-Wunused-parameter", 165 ], 166 shared_libs: [ 167 "libbase", 168 "libbinder", 169 "liblog", 170 "libutils", 171 ], 172 } 173 174 cc_library_shared { 175 name: "libaidl-integration-test", 176 defaults: ["aidl_test_defaults"], 177 aidl: { 178 export_aidl_headers: true, 179 local_include_dirs: ["tests"], 180 include_dirs: ["frameworks/native/aidl/binder"], 181 }, 182 srcs: [ 183 "tests/android/aidl/tests/ITestService.aidl", 184 "tests/android/aidl/tests/INamedCallback.aidl", 185 "tests/simple_parcelable.cpp", 186 ], 187 } 188 189 cc_binary { 190 name: "aidl_test_service", 191 defaults: ["aidl_test_defaults"], 192 shared_libs: ["libaidl-integration-test"], 193 srcs: ["tests/aidl_test_service.cpp"], 194 } 195 196 cc_binary { 197 name: "aidl_test_client", 198 defaults: ["aidl_test_defaults"], 199 shared_libs: ["libaidl-integration-test"], 200 srcs: [ 201 "tests/aidl_test_client.cpp", 202 "tests/aidl_test_client_file_descriptors.cpp", 203 "tests/aidl_test_client_parcelables.cpp", 204 "tests/aidl_test_client_nullables.cpp", 205 "tests/aidl_test_client_primitives.cpp", 206 "tests/aidl_test_client_utf8_strings.cpp", 207 "tests/aidl_test_client_service_exceptions.cpp", 208 ], 209 } 210