blob: 154a1d6b37d5b4277bef494c019611cc013d28f8 [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",
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",
Ludovic Barman93ee3082023-06-20 12:18:43 +000026 "libprotobuf",
Andrew Walbran7eb5ca42022-08-08 15:33:34 +000027 "librpcbinder_rs",
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 Hsieh9a0ee7e2021-01-11 15:00:10 -080036 defaults: ["crosvm_defaults"],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080037}
38
Victor Hsieh88ac6ca2020-11-13 15:20:24 -080039rust_binary {
40 name: "authfs",
Victor Hsieh1fe51c42020-11-05 11:08:10 -080041 defaults: ["authfs_defaults"],
Victor Hsieh573c6492021-03-11 14:19:18 -080042 apex_available: ["com.android.virt"],
Victor Hsieh1fe51c42020-11-05 11:08:10 -080043}
44
Victor Hsiehad46e0b2021-01-25 16:07:38 -080045rust_test {
46 name: "authfs_device_test_src_lib",
47 defaults: ["authfs_defaults"],
Jiyong Park5c71cac2022-02-04 11:49:31 +090048 test_suites: ["general-tests"],
Victor Hsieh85b4f732021-03-09 16:02:14 -080049 data: [":authfs_test_files"],
50}
51
52filegroup {
53 name: "authfs_test_files",
54 srcs: [
55 "testdata/cert.der",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080056 "testdata/input.4k",
Inseob Kimc0886c22021-12-13 17:41:24 +090057 "testdata/input.4k.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080058 "testdata/input.4k1",
Inseob Kimc0886c22021-12-13 17:41:24 +090059 "testdata/input.4k1.fsv_meta",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080060 "testdata/input.4m",
Inseob Kimc0886c22021-12-13 17:41:24 +090061 "testdata/input.4m.fsv_meta",
62 "testdata/input.4m.fsv_meta.bad_merkle",
Victor Hsiehfa4477a2021-02-08 10:51:50 -080063 ],
Victor Hsiehad46e0b2021-01-25 16:07:38 -080064}
Andrew Scull6ad64402022-07-04 13:12:53 +000065
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}