package { default_applicable_licenses: ["Android-Apache-2.0"], } rust_defaults { name: "authfs_defaults", crate_name: "authfs", srcs: [ "src/main.rs", ], edition: "2021", rustlibs: [ "authfs_aidl_interface-rust", "libandroid_logger", "libanyhow", "libauthfs_fsverity_metadata", "libbinder_rs", "libcfg_if", "libclap", "libfsverity_digests_proto_rust", "libfuse_rust", "liblibc", "liblog_rust", "libnix", "libopenssl", "libprotobuf_deprecated", "librpcbinder_rs", "libthiserror", ], prefer_rlib: true, target: { darwin: { enabled: false, }, }, defaults: ["crosvm_defaults"], } rust_binary { name: "authfs", defaults: ["authfs_defaults"], apex_available: ["com.android.virt"], } rust_test { name: "authfs_device_test_src_lib", defaults: ["authfs_defaults"], test_suites: ["general-tests"], data: [":authfs_test_files"], } filegroup { name: "authfs_test_files", srcs: [ "testdata/cert.der", "testdata/input.4k", "testdata/input.4k.fsv_meta", "testdata/input.4k1", "testdata/input.4k1.fsv_meta", "testdata/input.4m", "testdata/input.4m.fsv_meta", "testdata/input.4m.fsv_meta.bad_merkle", ], } java_genrule { name: "authfs_test_apk_assets", out: ["authfs_test_apk_assets.jar"], tools: [ "fsverity_manifest_generator", "fsverity", ], srcs: [ "testdata/input.4k", "testdata/input.4k1", "testdata/input.4m", ], /* * Create a JAR file with an assets directory that can merge into the * assets of an APK that depends on it in static_libs. Use this mechanism * to load a generated fsverity manifest for the test input files into the * test VM. */ cmd: "out_dir=$$(dirname $(out))" + "&& assets_dir=\"assets\" " + "&& mkdir -p $$out_dir/$$assets_dir" + "&& $(location fsverity_manifest_generator) " + " --fsverity-path $(location fsverity) " + " --base-dir $$(dirname $(in) | head -1) " + " --output $$out_dir/$$assets_dir/input_manifest.pb " + " $(in) " + "&& jar cf $(out) -C $$out_dir $$assets_dir", }