• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5rust_defaults {
6    name: "authfs_defaults",
7    crate_name: "authfs",
8    srcs: [
9        "src/main.rs",
10    ],
11    edition: "2021",
12    rustlibs: [
13        "authfs_aidl_interface-rust",
14        "libandroid_logger",
15        "libanyhow",
16        "libauthfs_fsverity_metadata",
17        "libbinder_rs",
18        "libcfg_if",
19        "libclap",
20        "libfsverity_digests_proto_rust",
21        "libfuse_rust",
22        "liblibc",
23        "liblog_rust",
24        "libnix",
25        "libopenssl",
26        "libprotobuf_deprecated",
27        "librpcbinder_rs",
28        "libthiserror",
29    ],
30    prefer_rlib: true,
31    target: {
32        darwin: {
33            enabled: false,
34        },
35    },
36    defaults: ["crosvm_defaults"],
37}
38
39rust_binary {
40    name: "authfs",
41    defaults: ["authfs_defaults"],
42    apex_available: ["com.android.virt"],
43}
44
45rust_test {
46    name: "authfs_device_test_src_lib",
47    defaults: ["authfs_defaults"],
48    test_suites: ["general-tests"],
49    data: [":authfs_test_files"],
50}
51
52filegroup {
53    name: "authfs_test_files",
54    srcs: [
55        "testdata/cert.der",
56        "testdata/input.4k",
57        "testdata/input.4k.fsv_meta",
58        "testdata/input.4k1",
59        "testdata/input.4k1.fsv_meta",
60        "testdata/input.4m",
61        "testdata/input.4m.fsv_meta",
62        "testdata/input.4m.fsv_meta.bad_merkle",
63    ],
64}
65
66java_genrule {
67    name: "authfs_test_apk_assets",
68    out: ["authfs_test_apk_assets.jar"],
69    tools: [
70        "fsverity_manifest_generator",
71        "fsverity",
72    ],
73    srcs: [
74        "testdata/input.4k",
75        "testdata/input.4k1",
76        "testdata/input.4m",
77    ],
78    /*
79     * Create a JAR file with an assets directory that can merge into the
80     * assets of an APK that depends on it in static_libs. Use this mechanism
81     * to load a generated fsverity manifest for the test input files into the
82     * test VM.
83     */
84    cmd: "out_dir=$$(dirname $(out))" +
85        "&& assets_dir=\"assets\" " +
86        "&& mkdir -p $$out_dir/$$assets_dir" +
87        "&& $(location fsverity_manifest_generator) " +
88        "    --fsverity-path $(location fsverity) " +
89        "    --base-dir $$(dirname $(in) | head -1) " +
90        "    --output $$out_dir/$$assets_dir/input_manifest.pb " +
91        "    $(in) " +
92        "&& jar cf $(out) -C $$out_dir $$assets_dir",
93}
94