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