Bob Badour | 2efc476 | 2021-02-03 18:36:27 -0800 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 3 | } |
| 4 | |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 5 | rust_defaults { |
| 6 | name: "authfs_defaults", |
| 7 | crate_name: "authfs", |
| 8 | srcs: [ |
Victor Hsieh | 88ac6ca | 2020-11-13 15:20:24 -0800 | [diff] [blame] | 9 | "src/main.rs", |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 10 | ], |
Alan Stokes | 6472ccd | 2022-08-31 13:41:28 +0100 | [diff] [blame] | 11 | edition: "2021", |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 12 | rustlibs: [ |
Victor Hsieh | f01f323 | 2020-12-11 13:31:31 -0800 | [diff] [blame] | 13 | "authfs_aidl_interface-rust", |
Victor Hsieh | 9d0ab62 | 2021-04-26 17:07:02 -0700 | [diff] [blame] | 14 | "libandroid_logger", |
Victor Hsieh | ec18456 | 2020-11-06 13:50:31 -0800 | [diff] [blame] | 15 | "libanyhow", |
Inseob Kim | c0886c2 | 2021-12-13 17:41:24 +0900 | [diff] [blame] | 16 | "libauthfs_fsverity_metadata", |
Victor Hsieh | 2445e33 | 2021-06-04 16:44:53 -0700 | [diff] [blame] | 17 | "libbinder_rs", |
Victor Hsieh | 88ac6ca | 2020-11-13 15:20:24 -0800 | [diff] [blame] | 18 | "libcfg_if", |
Victor Hsieh | b5bcfab | 2022-09-12 13:06:26 -0700 | [diff] [blame] | 19 | "libclap", |
Victor Hsieh | 9978257 | 2022-01-05 15:38:33 -0800 | [diff] [blame] | 20 | "libfsverity_digests_proto_rust", |
Victor Hsieh | 88ac6ca | 2020-11-13 15:20:24 -0800 | [diff] [blame] | 21 | "libfuse_rust", |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 22 | "liblibc", |
Victor Hsieh | 9d0ab62 | 2021-04-26 17:07:02 -0700 | [diff] [blame] | 23 | "liblog_rust", |
Victor Hsieh | f393a72 | 2021-12-08 13:04:27 -0800 | [diff] [blame] | 24 | "libnix", |
Andrew Scull | 761db1e | 2022-05-23 18:31:35 +0000 | [diff] [blame] | 25 | "libopenssl", |
Ludovic Barman | 93ee308 | 2023-06-20 12:18:43 +0000 | [diff] [blame] | 26 | "libprotobuf", |
Andrew Walbran | 7eb5ca4 | 2022-08-08 15:33:34 +0000 | [diff] [blame] | 27 | "librpcbinder_rs", |
Victor Hsieh | d1cb0d7 | 2020-11-06 13:49:55 -0800 | [diff] [blame] | 28 | "libthiserror", |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 29 | ], |
Victor Hsieh | b50e0fa | 2021-06-04 15:09:57 -0700 | [diff] [blame] | 30 | prefer_rlib: true, |
ThiƩbaud Weksteen | 858a928 | 2021-01-12 12:02:37 +0100 | [diff] [blame] | 31 | target: { |
| 32 | darwin: { |
| 33 | enabled: false, |
| 34 | }, |
| 35 | }, |
Victor Hsieh | 9a0ee7e | 2021-01-11 15:00:10 -0800 | [diff] [blame] | 36 | defaults: ["crosvm_defaults"], |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 37 | } |
| 38 | |
Victor Hsieh | 88ac6ca | 2020-11-13 15:20:24 -0800 | [diff] [blame] | 39 | rust_binary { |
| 40 | name: "authfs", |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 41 | defaults: ["authfs_defaults"], |
Victor Hsieh | 573c649 | 2021-03-11 14:19:18 -0800 | [diff] [blame] | 42 | apex_available: ["com.android.virt"], |
Victor Hsieh | 1fe51c4 | 2020-11-05 11:08:10 -0800 | [diff] [blame] | 43 | } |
| 44 | |
Victor Hsieh | ad46e0b | 2021-01-25 16:07:38 -0800 | [diff] [blame] | 45 | rust_test { |
| 46 | name: "authfs_device_test_src_lib", |
| 47 | defaults: ["authfs_defaults"], |
Jiyong Park | 5c71cac | 2022-02-04 11:49:31 +0900 | [diff] [blame] | 48 | test_suites: ["general-tests"], |
Victor Hsieh | 85b4f73 | 2021-03-09 16:02:14 -0800 | [diff] [blame] | 49 | data: [":authfs_test_files"], |
| 50 | } |
| 51 | |
| 52 | filegroup { |
| 53 | name: "authfs_test_files", |
| 54 | srcs: [ |
| 55 | "testdata/cert.der", |
Victor Hsieh | fa4477a | 2021-02-08 10:51:50 -0800 | [diff] [blame] | 56 | "testdata/input.4k", |
Inseob Kim | c0886c2 | 2021-12-13 17:41:24 +0900 | [diff] [blame] | 57 | "testdata/input.4k.fsv_meta", |
Victor Hsieh | fa4477a | 2021-02-08 10:51:50 -0800 | [diff] [blame] | 58 | "testdata/input.4k1", |
Inseob Kim | c0886c2 | 2021-12-13 17:41:24 +0900 | [diff] [blame] | 59 | "testdata/input.4k1.fsv_meta", |
Victor Hsieh | fa4477a | 2021-02-08 10:51:50 -0800 | [diff] [blame] | 60 | "testdata/input.4m", |
Inseob Kim | c0886c2 | 2021-12-13 17:41:24 +0900 | [diff] [blame] | 61 | "testdata/input.4m.fsv_meta", |
| 62 | "testdata/input.4m.fsv_meta.bad_merkle", |
Victor Hsieh | fa4477a | 2021-02-08 10:51:50 -0800 | [diff] [blame] | 63 | ], |
Victor Hsieh | ad46e0b | 2021-01-25 16:07:38 -0800 | [diff] [blame] | 64 | } |
Andrew Scull | 6ad6440 | 2022-07-04 13:12:53 +0000 | [diff] [blame] | 65 | |
| 66 | java_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 | } |