1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
rust_defaults {
name: "aconfig_storage_read_api.defaults",
edition: "2021",
lints: "none",
srcs: ["src/lib.rs"],
rustlibs: [
"libanyhow",
"libonce_cell",
"libtempfile",
"libmemmap2",
"libcxx",
"libthiserror",
"libaconfig_storage_file",
],
}
rust_library {
name: "libaconfig_storage_read_api",
crate_name: "aconfig_storage_read_api",
host_supported: true,
defaults: ["aconfig_storage_read_api.defaults"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
min_sdk_version: "29",
}
rust_test_host {
name: "aconfig_storage_read_api.test",
test_suites: ["general-tests"],
defaults: ["aconfig_storage_read_api.defaults"],
data: [
"tests/package.map",
"tests/flag.map",
"tests/flag.val",
"tests/flag.info",
],
}
// cxx source codegen from rust api
genrule {
name: "libcxx_aconfig_storage_read_api_bridge_code",
tools: ["cxxbridge"],
cmd: "$(location cxxbridge) $(in) > $(out)",
srcs: ["src/lib.rs"],
out: ["aconfig_storage/lib.rs.cc"],
}
// cxx header codegen from rust api
genrule {
name: "libcxx_aconfig_storage_read_api_bridge_header",
tools: ["cxxbridge"],
cmd: "$(location cxxbridge) $(in) --header > $(out)",
srcs: ["src/lib.rs"],
out: ["aconfig_storage/lib.rs.h"],
}
// a static cc lib based on generated code
rust_ffi_static {
name: "libaconfig_storage_read_api_cxx_bridge",
crate_name: "aconfig_storage_read_api_cxx_bridge",
host_supported: true,
vendor_available: true,
product_available: true,
defaults: ["aconfig_storage_read_api.defaults"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
min_sdk_version: "29",
}
// flag read api cc interface
cc_library {
name: "libaconfig_storage_read_api_cc",
srcs: ["aconfig_storage_read_api.cpp"],
generated_headers: [
"cxx-bridge-header",
"libcxx_aconfig_storage_read_api_bridge_header",
],
generated_sources: ["libcxx_aconfig_storage_read_api_bridge_code"],
whole_static_libs: ["libaconfig_storage_read_api_cxx_bridge"],
export_include_dirs: ["include"],
host_supported: true,
vendor_available: true,
product_available: true,
static_libs: [
"libaconfig_storage_protos_cc",
"libprotobuf-cpp-lite",
"libbase",
],
shared_libs: [
"liblog",
],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
min_sdk_version: "29",
target: {
linux: {
version_script: "libaconfig_storage_read_api_cc.map",
},
},
double_loadable: true,
}
|