blob: cb7f1198ac561bf344d32b757128e3d4adeb765f [file] [log] [blame]
Bob Badour2efc4762021-02-03 18:36:27 -08001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
Victor Hsieh1fe51c42020-11-05 11:08:10 -08005rust_defaults {
6 name: "authfs_defaults",
7 crate_name: "authfs",
8 srcs: [
Victor Hsieh88ac6ca2020-11-13 15:20:24 -08009 "src/main.rs",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080010 ],
11 edition: "2018",
12 rustlibs: [
Victor Hsiehf01f3232020-12-11 13:31:31 -080013 "authfs_aidl_interface-rust",
Victor Hsieh9d0ab622021-04-26 17:07:02 -070014 "libandroid_logger",
Victor Hsiehec184562020-11-06 13:50:31 -080015 "libanyhow",
Inseob Kimc0886c22021-12-13 17:41:24 +090016 "libauthfs_fsverity_metadata",
Andrew Walbranc4ce7872022-07-29 11:26:41 +000017 "libbinder_common",
Victor Hsieh2445e332021-06-04 16:44:53 -070018 "libbinder_rs",
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080019 "libcfg_if",
Victor Hsieh99782572022-01-05 15:38:33 -080020 "libfsverity_digests_proto_rust",
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080021 "libfuse_rust",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080022 "liblibc",
Victor Hsieh9d0ab622021-04-26 17:07:02 -070023 "liblog_rust",
Victor Hsiehf393a722021-12-08 13:04:27 -080024 "libnix",
Andrew Scull761db1e2022-05-23 18:31:35 +000025 "libopenssl",
Victor Hsieh99782572022-01-05 15:38:33 -080026 "libprotobuf",
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080027 "libstructopt",
Victor Hsiehd1cb0d72020-11-06 13:49:55 -080028 "libthiserror",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080029 ],
Victor Hsiehb50e0fa2021-06-04 15:09:57 -070030 prefer_rlib: true,
ThiƩbaud Weksteen858a9282021-01-12 12:02:37 +010031 target: {
32 darwin: {
33 enabled: false,
34 },
35 },
Victor Hsieh2445e332021-06-04 16:44:53 -070036 shared_libs: [
Victor Hsieh2445e332021-06-04 16:44:53 -070037 "libbinder_rpc_unstable",
38 ],
Victor Hsieh9a0ee7e2021-01-11 15:00:10 -080039 defaults: ["crosvm_defaults"],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080040}
41
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080042rust_binary {
43 name: "authfs",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080044 defaults: ["authfs_defaults"],
Victor Hsieh573c6492021-03-11 14:19:18 -080045 apex_available: ["com.android.virt"],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080046}
47
Victor Hsiehad46e0b2021-01-25 16:07:38 -080048rust_test {
49 name: "authfs_device_test_src_lib",
50 defaults: ["authfs_defaults"],
Jiyong Park5c71cac2022-02-04 11:49:31 +090051 test_suites: ["general-tests"],
Victor Hsieh85b4f732021-03-09 16:02:14 -080052 data: [":authfs_test_files"],
53}
54
55filegroup {
56 name: "authfs_test_files",
57 srcs: [
58 "testdata/cert.der",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080059 "testdata/input.4k",
Inseob Kimc0886c22021-12-13 17:41:24 +090060 "testdata/input.4k.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080061 "testdata/input.4k1",
Inseob Kimc0886c22021-12-13 17:41:24 +090062 "testdata/input.4k1.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080063 "testdata/input.4m",
Inseob Kimc0886c22021-12-13 17:41:24 +090064 "testdata/input.4m.fsv_meta",
65 "testdata/input.4m.fsv_meta.bad_merkle",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080066 ],
Victor Hsiehad46e0b2021-01-25 16:07:38 -080067}
Andrew Scull6ad64402022-07-04 13:12:53 +000068
69java_genrule {
70 name: "authfs_test_apk_assets",
71 out: ["authfs_test_apk_assets.jar"],
72 tools: [
73 "fsverity_manifest_generator",
74 "fsverity",
75 ],
76 srcs: [
77 "testdata/input.4k",
78 "testdata/input.4k1",
79 "testdata/input.4m",
80 ],
81 /*
82 * Create a JAR file with an assets directory that can merge into the
83 * assets of an APK that depends on it in static_libs. Use this mechanism
84 * to load a generated fsverity manifest for the test input files into the
85 * test VM.
86 */
87 cmd: "out_dir=$$(dirname $(out))" +
88 "&& assets_dir=\"assets\" " +
89 "&& mkdir -p $$out_dir/$$assets_dir" +
90 "&& $(location fsverity_manifest_generator) " +
91 " --fsverity-path $(location fsverity) " +
92 " --base-dir $$(dirname $(in) | head -1) " +
93 " --output $$out_dir/$$assets_dir/input_manifest.pb " +
94 " $(in) " +
95 "&& jar cf $(out) -C $$out_dir $$assets_dir",
96}