1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "frameworks_native_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["frameworks_native_license"],
8}
9
10rust_test {
11    name: "rustBinderTest",
12    srcs: ["integration.rs"],
13    rustlibs: [
14        "libbinder_rs",
15        "libselinux_bindgen",
16    ],
17    shared_libs: [
18        "libselinux",
19    ],
20    // For the binaries to be pushed properly as specified in AndroidTest.xml,
21    // this cannot be the same as the module name.
22    stem: "rustBinderTestClientBinary",
23    test_suites: ["general-tests"],
24}
25
26rust_test {
27    name: "rustBinderTestService",
28    srcs: ["integration.rs"],
29    rustlibs: [
30        "libbinder_rs",
31        "liblibc",
32    ],
33    // For the binaries to be pushed properly as specified in AndroidTest.xml,
34    // this cannot be the same as the module name.
35    stem: "rustBinderTestServiceBinary",
36    test_harness: false,
37    // TODO(b/164473602): Remove this setting and add the module to `data`
38    // attribute of rustBinderTest.
39    auto_gen_config: false,
40    test_suites: ["general-tests"],
41}
42
43cc_test {
44    name: "binderRustNdkInteropTest",
45    srcs: [
46        "binderRustNdkInteropTest.cpp",
47    ],
48    shared_libs: [
49        "libbinder",
50        "libbinder_ndk",
51    ],
52    static_libs: [
53        "IBinderRustNdkInteropTest-ndk_platform",
54        "libbinder_ndk_rust_interop",
55    ],
56    test_suites: ["general-tests"],
57    require_root: true,
58
59    // rustBinderTestService uses a custom config
60    auto_gen_config: true,
61}
62
63aidl_interface {
64    name: "IBinderRustNdkInteropTest",
65    unstable: true,
66    srcs: [
67        "IBinderRustNdkInteropTest.aidl",
68        "IBinderRustNdkInteropTestOther.aidl",
69    ],
70    backend: {
71        ndk: {
72            enabled: true,
73        },
74        rust: {
75            enabled: true,
76        },
77    },
78}
79
80rust_ffi_static {
81    name: "libbinder_ndk_rust_interop",
82    crate_name: "binder_ndk_rust_interop",
83    srcs: [
84        "ndk_rust_interop.rs",
85    ],
86    rustlibs: [
87        "libbinder_rs",
88        "IBinderRustNdkInteropTest-rust",
89    ],
90}
91
92cc_test {
93    name: "rustBinderSerializationTest",
94    shared_libs: [
95        "libbinder",
96        "libbinder_ndk",
97        "libutils",
98        "libbase",
99    ],
100    static_libs: [
101        "libbinder_rs_serialization_test"
102    ],
103    srcs: [
104        "serialization.cpp",
105    ],
106    auto_gen_config: true,
107    test_suites: ["general-tests"],
108}
109
110rust_bindgen {
111    name: "libbinder_rs_serialization_bindgen",
112    crate_name: "binder_rs_serialization_bindgen",
113    wrapper_src: "serialization.hpp",
114    source_stem: "bindings",
115    cpp_std: "gnu++17",
116    bindgen_flags: [
117        "--allowlist-type", "Transaction",
118        "--allowlist-var", "TESTDATA_.*",
119    ],
120
121    shared_libs: [
122        "libbinder",
123        "libc++",
124    ],
125}
126
127rust_ffi_static {
128    name: "libbinder_rs_serialization_test",
129    crate_name: "binder_rs_serialization_test",
130    srcs: [
131        "serialization.rs",
132        ":libbinder_rs_serialization_bindgen",
133    ],
134    rustlibs: [
135        "libbinder_rs",
136    ],
137}
138