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 |
| 37 | cc_library_host_static { |
| 38 | name: "libaidl-common", |
| 39 | defaults: ["aidl_defaults"], |
| 40 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 41 | srcs: [ |
| 42 | "aidl.cpp", |
| 43 | "aidl_language.cpp", |
| 44 | "aidl_language_l.ll", |
| 45 | "aidl_language_y.yy", |
Jiyong Park | 1deecc3 | 2018-07-17 01:14:41 +0900 | [diff] [blame] | 46 | "aidl_typenames.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 47 | "ast_cpp.cpp", |
| 48 | "ast_java.cpp", |
| 49 | "code_writer.cpp", |
| 50 | "generate_cpp.cpp", |
| 51 | "generate_java.cpp", |
| 52 | "generate_java_binder.cpp", |
| 53 | "import_resolver.cpp", |
| 54 | "line_reader.cpp", |
| 55 | "io_delegate.cpp", |
| 56 | "options.cpp", |
| 57 | "type_cpp.cpp", |
| 58 | "type_java.cpp", |
| 59 | "type_namespace.cpp", |
| 60 | ], |
| 61 | } |
| 62 | |
| 63 | // aidl executable |
| 64 | cc_binary_host { |
| 65 | name: "aidl", |
| 66 | defaults: ["aidl_defaults"], |
| 67 | srcs: ["main_java.cpp"], |
| 68 | static_libs: [ |
| 69 | "libaidl-common", |
| 70 | "libbase", |
| 71 | ], |
| 72 | } |
| 73 | |
| 74 | // aidl-cpp executable |
| 75 | cc_binary_host { |
| 76 | name: "aidl-cpp", |
| 77 | defaults: ["aidl_defaults"], |
| 78 | srcs: ["main_cpp.cpp"], |
| 79 | static_libs: [ |
| 80 | "libaidl-common", |
| 81 | "libbase", |
| 82 | ], |
| 83 | } |
| 84 | |
| 85 | // Unit tests |
| 86 | cc_test_host { |
| 87 | name: "aidl_unittests", |
| 88 | |
| 89 | cflags: [ |
| 90 | "-Wall", |
| 91 | "-Wextra", |
| 92 | "-Werror", |
| 93 | "-g", |
| 94 | "-DUNIT_TEST", |
| 95 | ], |
Steven Moreland | 1c41e97 | 2018-07-09 16:07:00 -0700 | [diff] [blame] | 96 | |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 97 | srcs: [ |
| 98 | "aidl_unittest.cpp", |
| 99 | "ast_cpp_unittest.cpp", |
| 100 | "ast_java_unittest.cpp", |
Jiyong Park | 22b4ecd | 2018-07-23 23:34:42 +0900 | [diff] [blame^] | 101 | "code_writer_unittest.cpp", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 102 | "generate_cpp_unittest.cpp", |
| 103 | "io_delegate_unittest.cpp", |
| 104 | "options_unittest.cpp", |
| 105 | "tests/end_to_end_tests.cpp", |
| 106 | "tests/fake_io_delegate.cpp", |
| 107 | "tests/main.cpp", |
| 108 | "tests/test_data_example_interface.cpp", |
| 109 | "tests/test_data_ping_responder.cpp", |
| 110 | "tests/test_data_string_constants.cpp", |
| 111 | "tests/test_util.cpp", |
| 112 | "type_cpp_unittest.cpp", |
| 113 | "type_java_unittest.cpp", |
| 114 | ], |
| 115 | |
| 116 | static_libs: [ |
| 117 | "libaidl-common", |
| 118 | "libbase", |
| 119 | "libcutils", |
| 120 | "libgmock_host", |
| 121 | ], |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | // |
| 125 | // Everything below here is used for integration testing of generated AIDL code. |
| 126 | // |
| 127 | cc_binary { |
| 128 | name: "aidl_test_sentinel_searcher", |
| 129 | srcs: ["tests/aidl_test_sentinel_searcher.cpp"], |
| 130 | cflags: [ |
| 131 | "-Wall", |
| 132 | "-Wextra", |
| 133 | "-Werror", |
Dan Willemsen | 8fd503f | 2016-10-04 20:04:36 -0700 | [diff] [blame] | 134 | ], |
| 135 | } |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 136 | |
| 137 | cc_defaults { |
| 138 | name: "aidl_test_defaults", |
| 139 | cflags: [ |
| 140 | "-Wall", |
| 141 | "-Wextra", |
| 142 | "-Werror", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 143 | ], |
| 144 | shared_libs: [ |
| 145 | "libbase", |
| 146 | "libbinder", |
| 147 | "liblog", |
| 148 | "libutils", |
| 149 | ], |
| 150 | } |
| 151 | |
| 152 | cc_library_shared { |
| 153 | name: "libaidl-integration-test", |
| 154 | defaults: ["aidl_test_defaults"], |
| 155 | aidl: { |
| 156 | export_aidl_headers: true, |
| 157 | local_include_dirs: ["tests"], |
| 158 | include_dirs: ["frameworks/native/aidl/binder"], |
| 159 | }, |
| 160 | srcs: [ |
| 161 | "tests/android/aidl/tests/ITestService.aidl", |
| 162 | "tests/android/aidl/tests/INamedCallback.aidl", |
Steven Moreland | 5557f1c | 2018-07-02 13:50:23 -0700 | [diff] [blame] | 163 | "tests/android/aidl/tests/StructuredParcelable.aidl", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 164 | "tests/simple_parcelable.cpp", |
| 165 | ], |
| 166 | } |
| 167 | |
| 168 | cc_binary { |
| 169 | name: "aidl_test_service", |
| 170 | defaults: ["aidl_test_defaults"], |
| 171 | shared_libs: ["libaidl-integration-test"], |
| 172 | srcs: ["tests/aidl_test_service.cpp"], |
| 173 | } |
| 174 | |
| 175 | cc_binary { |
| 176 | name: "aidl_test_client", |
| 177 | defaults: ["aidl_test_defaults"], |
| 178 | shared_libs: ["libaidl-integration-test"], |
| 179 | srcs: [ |
| 180 | "tests/aidl_test_client.cpp", |
| 181 | "tests/aidl_test_client_file_descriptors.cpp", |
| 182 | "tests/aidl_test_client_parcelables.cpp", |
| 183 | "tests/aidl_test_client_nullables.cpp", |
| 184 | "tests/aidl_test_client_primitives.cpp", |
| 185 | "tests/aidl_test_client_utf8_strings.cpp", |
| 186 | "tests/aidl_test_client_service_exceptions.cpp", |
Jiyong Park | 75e1a74 | 2018-07-04 12:31:23 +0900 | [diff] [blame] | 187 | "tests/aidl_test_client_defaultimpl.cpp", |
Dan Willemsen | 8f88361 | 2016-11-03 14:22:48 -0700 | [diff] [blame] | 188 | ], |
| 189 | } |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 190 | |
| 191 | android_app { |
| 192 | name: "aidl_test_services", |
| 193 | platform_apis: true, |
| 194 | // Turn off Java optimization tools to speed up our test iterations. |
| 195 | optimize: { |
| 196 | enabled: false, |
| 197 | }, |
| 198 | dex_preopt: { |
| 199 | enabled: false, |
| 200 | }, |
| 201 | certificate: "platform", |
| 202 | manifest: "tests/java_app/AndroidManifest.xml", |
| 203 | resource_dirs: ["tests/java_app/resources"], |
| 204 | srcs: [ |
| 205 | "tests/android/aidl/tests/INamedCallback.aidl", |
| 206 | "tests/android/aidl/tests/ITestService.aidl", |
Steven Moreland | 5557f1c | 2018-07-02 13:50:23 -0700 | [diff] [blame] | 207 | "tests/android/aidl/tests/StructuredParcelable.aidl", |
Steven Moreland | 0ae3460 | 2018-06-28 10:08:19 -0700 | [diff] [blame] | 208 | "tests/java_app/src/android/aidl/tests/NullableTests.java", |
| 209 | "tests/java_app/src/android/aidl/tests/SimpleParcelable.java", |
| 210 | "tests/java_app/src/android/aidl/tests/TestFailException.java", |
| 211 | "tests/java_app/src/android/aidl/tests/TestLogger.java", |
| 212 | "tests/java_app/src/android/aidl/tests/TestServiceClient.java", |
| 213 | ], |
| 214 | aidl: { |
| 215 | include_dirs: [ |
| 216 | "system/tools/aidl/tests/", |
| 217 | "frameworks/native/aidl/binder", |
| 218 | ], |
| 219 | }, |
| 220 | } |