blob: 8dc6d8686d2fe01614b304445125ee674bc28f42 [file] [log] [blame]
Bob Badour2efc4762021-02-03 18:36:27 -08001package {
Aditya Choudhary53696172024-02-05 15:46:19 +00002 default_team: "trendy_team_virtualization",
Bob Badour2efc4762021-02-03 18:36:27 -08003 default_applicable_licenses: ["Android-Apache-2.0"],
4}
5
Victor Hsieh1fe51c42020-11-05 11:08:10 -08006rust_defaults {
7 name: "authfs_defaults",
8 crate_name: "authfs",
9 srcs: [
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080010 "src/main.rs",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080011 ],
Alan Stokes6472ccd2022-08-31 13:41:28 +010012 edition: "2021",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080013 rustlibs: [
Victor Hsiehf01f3232020-12-11 13:31:31 -080014 "authfs_aidl_interface-rust",
Victor Hsieh9d0ab622021-04-26 17:07:02 -070015 "libandroid_logger",
Victor Hsiehec184562020-11-06 13:50:31 -080016 "libanyhow",
Inseob Kimc0886c22021-12-13 17:41:24 +090017 "libauthfs_fsverity_metadata",
Victor Hsieh2445e332021-06-04 16:44:53 -070018 "libbinder_rs",
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080019 "libcfg_if",
Victor Hsiehb5bcfab2022-09-12 13:06:26 -070020 "libclap",
Victor Hsieh99782572022-01-05 15:38:33 -080021 "libfsverity_digests_proto_rust",
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080022 "libfuse_rust",
Alice Wang0331d942023-12-01 08:55:59 +000023 "libhex",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080024 "liblibc",
Victor Hsieh9d0ab622021-04-26 17:07:02 -070025 "liblog_rust",
Victor Hsiehf393a722021-12-08 13:04:27 -080026 "libnix",
Andrew Scull761db1e2022-05-23 18:31:35 +000027 "libopenssl",
Ludovic Barman93ee3082023-06-20 12:18:43 +000028 "libprotobuf",
Andrew Walbran7eb5ca42022-08-08 15:33:34 +000029 "librpcbinder_rs",
Victor Hsiehd1cb0d72020-11-06 13:49:55 -080030 "libthiserror",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080031 ],
Victor Hsiehb50e0fa2021-06-04 15:09:57 -070032 prefer_rlib: true,
ThiƩbaud Weksteen858a9282021-01-12 12:02:37 +010033 target: {
34 darwin: {
35 enabled: false,
36 },
37 },
Nikita Ioffeda1b2732023-09-04 13:46:56 +010038 defaults: [
39 "crosvm_defaults",
40 "avf_build_flags_rust",
41 ],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080042}
43
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080044rust_binary {
45 name: "authfs",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080046 defaults: ["authfs_defaults"],
Victor Hsieh573c6492021-03-11 14:19:18 -080047 apex_available: ["com.android.virt"],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080048}
49
Victor Hsiehad46e0b2021-01-25 16:07:38 -080050rust_test {
51 name: "authfs_device_test_src_lib",
52 defaults: ["authfs_defaults"],
Jiyong Park5c71cac2022-02-04 11:49:31 +090053 test_suites: ["general-tests"],
Victor Hsieh85b4f732021-03-09 16:02:14 -080054 data: [":authfs_test_files"],
55}
56
57filegroup {
58 name: "authfs_test_files",
59 srcs: [
60 "testdata/cert.der",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080061 "testdata/input.4k",
Inseob Kimc0886c22021-12-13 17:41:24 +090062 "testdata/input.4k.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080063 "testdata/input.4k1",
Inseob Kimc0886c22021-12-13 17:41:24 +090064 "testdata/input.4k1.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080065 "testdata/input.4m",
Inseob Kimc0886c22021-12-13 17:41:24 +090066 "testdata/input.4m.fsv_meta",
67 "testdata/input.4m.fsv_meta.bad_merkle",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080068 ],
Victor Hsiehad46e0b2021-01-25 16:07:38 -080069}
Andrew Scull6ad64402022-07-04 13:12:53 +000070
71java_genrule {
72 name: "authfs_test_apk_assets",
73 out: ["authfs_test_apk_assets.jar"],
74 tools: [
75 "fsverity_manifest_generator",
76 "fsverity",
77 ],
78 srcs: [
79 "testdata/input.4k",
80 "testdata/input.4k1",
81 "testdata/input.4m",
82 ],
83 /*
84 * Create a JAR file with an assets directory that can merge into the
85 * assets of an APK that depends on it in static_libs. Use this mechanism
86 * to load a generated fsverity manifest for the test input files into the
87 * test VM.
88 */
89 cmd: "out_dir=$$(dirname $(out))" +
90 "&& assets_dir=\"assets\" " +
91 "&& mkdir -p $$out_dir/$$assets_dir" +
92 "&& $(location fsverity_manifest_generator) " +
93 " --fsverity-path $(location fsverity) " +
94 " --base-dir $$(dirname $(in) | head -1) " +
95 " --output $$out_dir/$$assets_dir/input_manifest.pb " +
96 " $(in) " +
97 "&& jar cf $(out) -C $$out_dir $$assets_dir",
98}