pub fn from_tree_env(f: &impl FuchsiaPaths) -> Result<HostTools> {
        let host_out_dir = read_env_path("HOST_OUT_DIR")?;
        Ok(HostTools {
            // prebuilt binaries that can be optionally fetched from cipd.
            aemu: match read_env_path("PREBUILT_AEMU_DIR") {
                Ok(val) => val.join("emulator"),
                _ => {
                    let fuchsia_root = f.find_fuchsia_root()?;
                    WalkDir::new(fuchsia_root.join("prebuilt/third_party/aemu"))
                        .into_iter()
                        .filter_map(|e| e.ok())
                        .find(|e| e.file_name() == "emulator")
                        .ok_or(anyhow!(
                            "Cannot find find emulator executable from {:?}",
                            fuchsia_root.join("prebuilt/third_party/aemu").display()
                        ))?
                        .path()
                        .to_path_buf()
                }
            },
            grpcwebproxy: match read_env_path("PREBUILT_GRPCWEBPROXY_DIR") {
                Ok(val) => val.join("grpcwebproxy"),
                _ => {
                    let fuchsia_root = f.find_fuchsia_root()?;
                    WalkDir::new(fuchsia_root.join("prebuilt/third_party/grpcwebproxy"))
                        .into_iter()
                        .filter_map(|e| e.ok())
                        .find(|e| e.file_name() == "grpcwebproxy")
                        .ok_or(anyhow!(
                            "Cannot find find grpcwebproxy executable from {:?}",
                            fuchsia_root.join("prebuilt/third_party/grpcwebproxy").display()
                        ))?
                        .path()
                        .to_path_buf()
                }
            },
            vdl: match read_env_path("PREBUILT_VDL_DIR") {
                Ok(val) => val.join("device_launcher"),
                _ => f.find_fuchsia_root()?.join("prebuilt/vdl/device_launcher"),
            },
            device_finder: host_out_dir.join("device-finder"),
            far: host_out_dir.join("far"),
            fvm: host_out_dir.join("fvm"),
            pm: host_out_dir.join("pm"),
            zbi: host_out_dir.join("zbi"),
            is_sdk: false,
        })
    }
/// Initialize host tools for in-tree usage via fx vdl.
///
/// Requires the environment variable HOST_OUT_DIR to be specified
/// PREBUILT_AEMU_DIR, PREBUILT_GRPCWEBPROXY_DIR, PREBUILT_VDL_DIR are optional.
/// See: //tools/devshell/vdl
Initialize host tools for in-tree usage via fx vdl.
Initialize host tools for in - tree usage via fx vdl .
pub fn from_tree_env(f: &impl FuchsiaPaths) -> Result<HostTools> {
        let host_out_dir = read_env_path("HOST_OUT_DIR")?;
        Ok(HostTools {
            // prebuilt binaries that can be optionally fetched from cipd.
            aemu: match read_env_path("PREBUILT_AEMU_DIR") {
                Ok(val) => val.join("emulator"),
                _ => {
                    let fuchsia_root = f.find_fuchsia_root()?;
                    WalkDir::new(fuchsia_root.join("prebuilt/third_party/aemu"))
                        .into_iter()
                        .filter_map(|e| e.ok())
                        .find(|e| e.file_name() == "emulator")
                        .ok_or(anyhow!(
                            "Cannot find find emulator executable from {:?}",
                            fuchsia_root.join("prebuilt/third_party/aemu").display()
                        ))?
                        .path()
                        .to_path_buf()
                }
            },
            grpcwebproxy: match read_env_path("PREBUILT_GRPCWEBPROXY_DIR") {
                Ok(val) => val.join("grpcwebproxy"),
                _ => {
                    let fuchsia_root = f.find_fuchsia_root()?;
                    WalkDir::new(fuchsia_root.join("prebuilt/third_party/grpcwebproxy"))
                        .into_iter()
                        .filter_map(|e| e.ok())
                        .find(|e| e.file_name() == "grpcwebproxy")
                        .ok_or(anyhow!(
                            "Cannot find find grpcwebproxy executable from {:?}",
                            fuchsia_root.join("prebuilt/third_party/grpcwebproxy").display()
                        ))?
                        .path()
                        .to_path_buf()
                }
            },
            vdl: match read_env_path("PREBUILT_VDL_DIR") {
                Ok(val) => val.join("device_launcher"),
                _ => f.find_fuchsia_root()?.join("prebuilt/vdl/device_launcher"),
            },
            device_finder: host_out_dir.join("device-finder"),
            far: host_out_dir.join("far"),
            fvm: host_out_dir.join("fvm"),
            pm: host_out_dir.join("pm"),
            zbi: host_out_dir.join("zbi"),
            is_sdk: false,
        })
    }
pub fn from_tree_env ( f : & impl FuchsiaPaths ) -> Result < HostTools > { let host_out_dir = read_env_path ( " " ) ? ; Ok ( HostTools { // prebuilt binaries that can be optionally fetched from cipd. aemu : match read_env_path ( " " ) { Ok ( val ) => val . join ( " " ) , _ => { let fuchsia_root = f . find_fuchsia_root ( ) ? ; WalkDir :: new ( fuchsia_root . join ( " " ) ) . into_iter ( ) . filter_map ( | e | e . ok ( ) ) . find ( | e | e . file_name ( ) == " " ) . ok_or ( anyhow ! ( " " fuchsia_root join ( " " ) display ( ) ) ) ? . path ( ) . to_path_buf ( ) } } , grpcwebproxy : match read_env_path ( " " ) { Ok ( val ) => val . join ( " " ) , _ => { let fuchsia_root = f . find_fuchsia_root ( ) ? ; WalkDir :: new ( fuchsia_root . join ( " " ) ) . into_iter ( ) . filter_map ( | e | e . ok ( ) ) . find ( | e | e . file_name ( ) == " " ) . ok_or ( anyhow ! ( " " fuchsia_root join ( " " ) display ( ) ) ) ? . path ( ) . to_path_buf ( ) } } , vdl : match read_env_path ( " " ) { Ok ( val ) => val . join ( " " ) , _ => f . find_fuchsia_root ( ) ? . join ( " " ) , } , device_finder : host_out_dir . join ( " " ) , far : host_out_dir . join ( " " ) , fvm : host_out_dir . join ( " " ) , pm : host_out_dir . join ( " " ) , zbi : host_out_dir . join ( " " ) , is_sdk : false , } ) }
Initialize host tools for in-tree usage via fx vdl.
Initialize host tools for in - tree usage via fx vdl .
f
&impl FuchsiaPaths
f
&impl FuchsiaPaths