1/* 2 * Copyright (C) 2019 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 17package { 18 // See: http://go/android-license-faq 19 // A large-scale-change added 'default_applicable_licenses' to import 20 // all of the 'license_kinds' from "system_tools_hidl_license" 21 // to get the below license kinds: 22 // SPDX-license-identifier-Apache-2.0 23 default_applicable_licenses: ["system_tools_hidl_license"], 24} 25 26genrule_defaults { 27 name: "hidl2aidl_test_gen_defaults", 28 tools: ["hidl2aidl"], 29 cmd: "$(location hidl2aidl) -f -o $(genDir)/ " + 30 "-rhidl2aidl.test:system/tools/hidl/hidl2aidl/test " + 31 "[email protected] && " + 32 "$(location hidl2aidl) -f -o $(genDir)/ " + 33 "-rhidl2aidl.test:system/tools/hidl/hidl2aidl/test " + 34 "[email protected] && " + 35 "$(location hidl2aidl) -o $(genDir)/ " + 36 "-rhidl2aidl.test:system/tools/hidl/hidl2aidl/test " + 37 "[email protected] && " + 38 "mv $(genDir)/include/hidl2aidl/test/translate-ndk.h $(genDir)/hidl2aidl/test/ && " + 39 "mv $(genDir)/include/hidl2aidl/test/translate-cpp.h $(genDir)/hidl2aidl/test/ &&" + 40 "mv $(genDir)/include/hidl2aidl/test/extension/translate-ndk.h $(genDir)/hidl2aidl/test/extension/ && " + 41 "mv $(genDir)/include/hidl2aidl/test/extension/translate-cpp.h $(genDir)/hidl2aidl/test/extension/ ", 42 srcs: [ 43 ":[email protected]_hal", 44 ":[email protected]_hal", 45 ":[email protected]_hal", 46 ":[email protected]_hal", 47 ":[email protected]_hal", 48 ":[email protected]_hal", 49 ":[email protected]_hal", 50 "1.0/IBar.hal", 51 "1.0/IFoo.hal", 52 "1.0/types.hal", 53 "1.1/IFoo.hal", 54 "1.1/types.hal", 55 "1.2/IFoo.hal", 56 "2.0/IFoo.hal", 57 "extension/1.2/IFoo.hal", 58 "extension/1.2/types.hal", 59 ], 60} 61 62genrule { 63 name: "hidl2aidl_test_gen_aidl", 64 defaults: ["hidl2aidl_test_gen_defaults"], 65 out: [ 66 "hidl2aidl/test/ArrayFoo.aidl", 67 "hidl2aidl/test/VectorFoo.aidl", 68 "hidl2aidl/test/FooFlag.aidl", 69 "hidl2aidl/test/IBar.aidl", 70 "hidl2aidl/test/IFoo.aidl", 71 "hidl2aidl/test/NameCollision.aidl", 72 "hidl2aidl/test/OnlyIn10.aidl", 73 "hidl2aidl/test/OnlyIn11.aidl", 74 "hidl2aidl/test/Outer.aidl", 75 "hidl2aidl/test/OverrideMe.aidl", 76 "hidl2aidl/test/SafeUnionBar.aidl", 77 "hidl2aidl/test/UnionFoo.aidl", 78 "hidl2aidl/test/Value.aidl", 79 "hidl2aidl/test2/IFoo.aidl", 80 "hidl2aidl/test/extension/IFoo.aidl", 81 "hidl2aidl/test/extension/FooFlag.aidl", 82 "hidl2aidl/test/extension/ArrayFoo.aidl", 83 ], 84} 85 86genrule { 87 name: "hidl2aidl_translate_ndk_test_gen_src", 88 defaults: ["hidl2aidl_test_gen_defaults"], 89 out: [ 90 "translate/hidl2aidl/test/translate-ndk.cpp", 91 "translate/hidl2aidl/test/extension/translate-ndk.cpp", 92 ], 93} 94 95genrule { 96 name: "hidl2aidl_translate_ndk_test_gen_headers", 97 defaults: ["hidl2aidl_test_gen_defaults"], 98 out: [ 99 "hidl2aidl/test/translate-ndk.h", 100 "hidl2aidl/test/extension/translate-ndk.h", 101 ], 102} 103 104genrule { 105 name: "hidl2aidl_translate_cpp_test_gen_src", 106 defaults: ["hidl2aidl_test_gen_defaults"], 107 out: [ 108 "translate/hidl2aidl/test/translate-cpp.cpp", 109 "translate/hidl2aidl/test/extension/translate-cpp.cpp", 110 ], 111} 112 113genrule { 114 name: "hidl2aidl_translate_cpp_test_gen_headers", 115 defaults: ["hidl2aidl_test_gen_defaults"], 116 out: [ 117 "hidl2aidl/test/translate-cpp.h", 118 "hidl2aidl/test/extension/translate-cpp.h", 119 ], 120} 121 122genrule { 123 name: "hidl2aidl_translate_java_test_gen_src", 124 defaults: ["hidl2aidl_test_gen_defaults"], 125 out: [ 126 "translate/hidl2aidl/test/Translate.java", 127 "translate/hidl2aidl/test/extension/Translate.java", 128 ], 129} 130 131aidl_interface { 132 name: "hidl2aidl_test_gen", 133 owner: "test", 134 stability: "vintf", 135 srcs: [":hidl2aidl_test_gen_aidl"], 136 backend: { 137 java: { 138 sdk_version: "system_current", 139 }, 140 }, 141 flags: [ 142 "-Werror", 143 "-Wno-mixed-oneway", 144 ], 145} 146 147cc_test_library { 148 name: "hidl2aidl_test_comp_cc", 149 srcs: [ 150 "cpp_test_compile.cpp", 151 "ndk_test_compile.cpp", 152 ], 153 shared_libs: [ 154 "hidl2aidl_test_gen-V1-cpp", 155 "hidl2aidl_test_gen-V1-ndk", 156 "libbinder", 157 "libbinder_ndk", 158 "libutils", 159 ], 160 gtest: false, 161} 162 163cc_test { 164 name: "hidl2aidl_translate_ndk_test", 165 test_suites: ["general-tests"], 166 167 cflags: [ 168 "-Wall", 169 "-Wextra", 170 "-Werror", 171 "-g", 172 ], 173 srcs: [ 174 ":hidl2aidl_translate_ndk_test_gen_src", 175 "translate_ndk_test.cpp", 176 ], 177 generated_headers: [ 178 "hidl2aidl_translate_ndk_test_gen_headers", 179 ], 180 shared_libs: [ 181 "libbinder_ndk", 182 "libhidlbase", 183 "liblog", 184 ], 185 static_libs: [ 186 "hidl2aidl_test_gen-V1-ndk", 187 "[email protected]", 188 "[email protected]", 189 "[email protected]", 190 "[email protected]", 191 ], 192 host_required: [ 193 "hidl2aidl", 194 ], 195} 196 197cc_test { 198 name: "hidl2aidl_translate_cpp_test", 199 test_suites: ["general-tests"], 200 201 cflags: [ 202 "-Wall", 203 "-Wextra", 204 "-Werror", 205 "-g", 206 "-DHIDL2AIDLTESTING", 207 ], 208 srcs: [ 209 ":hidl2aidl_translate_cpp_test_gen_src", 210 "translate_cpp_test.cpp", 211 ], 212 generated_headers: [ 213 "hidl2aidl_translate_cpp_test_gen_headers", 214 ], 215 shared_libs: [ 216 "libbinder", 217 "libhidlbase", 218 "libutils", 219 "liblog", 220 ], 221 static_libs: [ 222 "hidl2aidl_test_gen-V1-cpp", 223 "[email protected]", 224 "[email protected]", 225 "[email protected]", 226 "[email protected]", 227 ], 228 host_required: [ 229 "hidl2aidl", 230 ], 231} 232 233android_test { 234 name: "hidl2aidl_translate_java_test", 235 platform_apis: true, 236 // Turn off Java optimization tools to speed up our test iterations. 237 optimize: { 238 enabled: false, 239 }, 240 dex_preopt: { 241 enabled: false, 242 }, 243 srcs: [ 244 ":hidl2aidl_translate_java_test_gen_src", 245 "TranslateJavaTest.java", 246 ], 247 static_libs: [ 248 "androidx.test.core", 249 "androidx.test.runner", 250 "hidl2aidl_test_gen-V1-java", 251 "hidl2aidl.test-V1.0-java", 252 "hidl2aidl.test-V1.1-java", 253 "hidl2aidl.test-V1.2-java", 254 "hidl2aidl.test.extension-V1.2-java", 255 ], 256 host_required: [ 257 "hidl2aidl", 258 ], 259 test_suites: ["general-tests"], 260} 261 262phony { 263 name: "hidl2aidl_test", 264 required: [ 265 "hidl2aidl_test_comp_cc", 266 "hidl2aidl_test_gen-V1-java", 267 "hidl2aidl_translate_ndk_test", 268 "hidl2aidl_translate_cpp_test", 269 ], 270} 271 272hidl_package_root { 273 name: "hidl2aidl.test", 274} 275