blob: 8ac600d716ea64626d2af72a2f799556750d5658 [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 ],
Alan Stokes6472ccd2022-08-31 13:41:28 +010011 edition: "2021",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080012 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",
Victor Hsieh2445e332021-06-04 16:44:53 -070017 "libbinder_rs",
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080018 "libcfg_if",
Victor Hsiehb5bcfab2022-09-12 13:06:26 -070019 "libclap",
Victor Hsieh99782572022-01-05 15:38:33 -080020 "libfsverity_digests_proto_rust",
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080021 "libfuse_rust",
Alice Wang0331d942023-12-01 08:55:59 +000022 "libhex",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080023 "liblibc",
Victor Hsieh9d0ab622021-04-26 17:07:02 -070024 "liblog_rust",
Victor Hsiehf393a722021-12-08 13:04:27 -080025 "libnix",
Andrew Scull761db1e2022-05-23 18:31:35 +000026 "libopenssl",
Ludovic Barman93ee3082023-06-20 12:18:43 +000027 "libprotobuf",
Andrew Walbran7eb5ca42022-08-08 15:33:34 +000028 "librpcbinder_rs",
Victor Hsiehd1cb0d72020-11-06 13:49:55 -080029 "libthiserror",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080030 ],
Victor Hsiehb50e0fa2021-06-04 15:09:57 -070031 prefer_rlib: true,
ThiƩbaud Weksteen858a9282021-01-12 12:02:37 +010032 target: {
33 darwin: {
34 enabled: false,
35 },
36 },
Nikita Ioffeda1b2732023-09-04 13:46:56 +010037 defaults: [
38 "crosvm_defaults",
39 "avf_build_flags_rust",
40 ],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080041}
42
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080043rust_binary {
44 name: "authfs",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080045 defaults: ["authfs_defaults"],
Victor Hsieh573c6492021-03-11 14:19:18 -080046 apex_available: ["com.android.virt"],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080047}
48
Victor Hsiehad46e0b2021-01-25 16:07:38 -080049rust_test {
50 name: "authfs_device_test_src_lib",
51 defaults: ["authfs_defaults"],
Jiyong Park5c71cac2022-02-04 11:49:31 +090052 test_suites: ["general-tests"],
Victor Hsieh85b4f732021-03-09 16:02:14 -080053 data: [":authfs_test_files"],
54}
55
56filegroup {
57 name: "authfs_test_files",
58 srcs: [
59 "testdata/cert.der",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080060 "testdata/input.4k",
Inseob Kimc0886c22021-12-13 17:41:24 +090061 "testdata/input.4k.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080062 "testdata/input.4k1",
Inseob Kimc0886c22021-12-13 17:41:24 +090063 "testdata/input.4k1.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080064 "testdata/input.4m",
Inseob Kimc0886c22021-12-13 17:41:24 +090065 "testdata/input.4m.fsv_meta",
66 "testdata/input.4m.fsv_meta.bad_merkle",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080067 ],
Victor Hsiehad46e0b2021-01-25 16:07:38 -080068}
Andrew Scull6ad64402022-07-04 13:12:53 +000069
70java_genrule {
71 name: "authfs_test_apk_assets",
72 out: ["authfs_test_apk_assets.jar"],
73 tools: [
74 "fsverity_manifest_generator",
75 "fsverity",
76 ],
77 srcs: [
78 "testdata/input.4k",
79 "testdata/input.4k1",
80 "testdata/input.4m",
81 ],
82 /*
83 * Create a JAR file with an assets directory that can merge into the
84 * assets of an APK that depends on it in static_libs. Use this mechanism
85 * to load a generated fsverity manifest for the test input files into the
86 * test VM.
87 */
88 cmd: "out_dir=$$(dirname $(out))" +
89 "&& assets_dir=\"assets\" " +
90 "&& mkdir -p $$out_dir/$$assets_dir" +
91 "&& $(location fsverity_manifest_generator) " +
92 " --fsverity-path $(location fsverity) " +
93 " --base-dir $$(dirname $(in) | head -1) " +
94 " --output $$out_dir/$$assets_dir/input_manifest.pb " +
95 " $(in) " +
96 "&& jar cf $(out) -C $$out_dir $$assets_dir",
97}