• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/Android.bp b/Android.bp
2index aced8a6..578cc68 100644
3--- a/Android.bp
4+++ b/Android.bp
5@@ -43,25 +43,38 @@ cc_library_headers {
6     min_sdk_version: "29",
7 }
8
9-rust_ffi_shared {
10-    name: "libquiche_shared",
11+rust_defaults {
12+    name: "libquiche_defaults",
13     stem: "libquiche",
14     host_supported: true,
15     crate_name: "quiche",
16     srcs: ["src/lib.rs"],
17     edition: "2018",
18     features: [
19-        "boringssl-vendored",
20+        "boringssl",
21         "default",
22     ],
23-    rustlibs: [
24+    // Link all crates statically to create a self-contained .so library.
25+    rlibs: [
26         "liblazy_static",
27         "liblibc",
28         "liblibm",
29         "liblog_rust",
30         "libring",
31     ],
32-    static_libs: [
33+    prefer_rlib: true,
34+    // For DnsResolver (Mainline module introduced in Q).
35+    apex_available: [
36+        "//apex_available:platform",
37+        "com.android.resolv",
38+    ],
39+    min_sdk_version: "29",
40+}
41+
42+rust_ffi {
43+    name: "libquiche_ffi",
44+    defaults: ["libquiche_defaults"],
45+    shared_libs: [
46         "libcrypto",
47         "libssl",
48     ],
49@@ -69,52 +82,20 @@ rust_ffi_shared {
50
51 rust_library {
52     name: "libquiche",
53-    host_supported: true,
54-    crate_name: "quiche",
55-    srcs: ["src/lib.rs"],
56-    edition: "2018",
57-    features: [
58-        "boringssl-vendored",
59-        "default",
60-    ],
61-    rustlibs: [
62-        "liblazy_static",
63-        "liblibc",
64-        "liblibm",
65-        "liblog_rust",
66-        "libring",
67-    ],
68-    static_libs: [
69+    defaults: ["libquiche_defaults"],
70+    shared_libs: [
71         "libcrypto",
72         "libssl",
73     ],
74-    apex_available: [
75-        "//apex_available:platform",
76-        "com.android.resolv",
77-    ],
78-    min_sdk_version: "29",
79 }
80
81-rust_ffi_static {
82+// This target is used by doh_unit_test to prevent compatibility issues
83+// because doh_unit_test needs to be run on the R platform.
84+rust_library_rlib {
85     name: "libquiche_static",
86-    stem: "libquiche",
87-    host_supported: true,
88-    crate_name: "quiche",
89-    srcs: ["src/lib.rs"],
90-    edition: "2018",
91-    features: [
92-        "boringssl-vendored",
93-        "default",
94-    ],
95-    rustlibs: [
96-        "liblazy_static",
97-        "liblibc",
98-        "liblibm",
99-        "liblog_rust",
100-        "libring",
101-    ],
102+    defaults: ["libquiche_defaults"],
103     static_libs: [
104-        "libcrypto",
105+        "libcrypto_static",
106         "libssl",
107     ],
108 }
109@@ -127,7 +108,7 @@ rust_defaults {
110     auto_gen_config: true,
111     edition: "2018",
112     features: [
113-        "boringssl-vendored",
114+        "boringssl",
115         "default",
116     ],
117     rustlibs: [
118@@ -139,10 +120,12 @@ rust_defaults {
119         "libring",
120         "liburl",
121     ],
122-    static_libs: [
123-        "libcrypto",
124-        "libssl",
125-    ],
126+    data: [
127+        "examples/cert.crt",
128+        "examples/cert.key",
129+        "examples/cert-big.crt",
130+        "examples/rootca.crt",
131+    ]
132 }
133
134 rust_test_host {
135@@ -151,11 +134,21 @@ rust_test_host {
136     test_options: {
137         unit_test: true,
138     },
139+    shared_libs: [
140+        "libcrypto",
141+        "libssl",
142+    ],
143 }
144
145 rust_test {
146     name: "quiche_device_test_src_lib",
147     defaults: ["quiche_defaults"],
148+    // To run this test in R platform, it's required to statically link
149+    // libcrypto and libssl.
150+    static_libs: [
151+        "libcrypto_static",
152+        "libssl",
153+    ],
154 }
155
156 // dependent_library ["feature_list"]
157