fn copy_deps(tmp_dir: &Path, pkg_dir: &Path) -> anyhow::Result<PathBuf> {
    // Sometimes we run a test that isn't a package for metatests so if there isn't a package we
    // don't need to nest at all.
    let package_resolution = match (BuildConfig {
        dev_mode: true,
        ..Default::default()
    })
    .resolution_graph_for_package(pkg_dir)
    {
        Ok(pkg) => pkg,
        Err(_) => return Ok(tmp_dir.to_path_buf()),
    };
    let package_nest_depth = determine_package_nest_depth(&package_resolution, pkg_dir)?;
    let tmp_dir = pad_tmp_path(tmp_dir, package_nest_depth)?;
    for (_, dep) in package_resolution.package_table.iter() {
        let source_dep_path = &dep.package_path;
        let dest_dep_path = tmp_dir.join(&dep.package_path.strip_prefix(pkg_dir).unwrap());
        if !dest_dep_path.exists() {
            fs::create_dir_all(&dest_dep_path)?;
        }
        simple_copy_dir(&dest_dep_path, source_dep_path)?;
    }
    Ok(tmp_dir)
}
// We need to copy dependencies over (transitively) and at the same time keep the paths valid in
// the package. To do this we compute the resolution graph for all possible dependencies (so in dev
// mode) and then calculate the nesting under `tmp_dir` the we need to copy the root package so
// that it, and all its dependencies reside under `tmp_dir` with the same paths as in the original
// package manifest.
We need to copy dependencies over (transitively) and at the same time keep the paths valid in
the package. To do this we compute the resolution graph for all possible dependencies (so in dev
mode) and then calculate the nesting under `tmp_dir` the we need to copy the root package so
that it, and all its dependencies reside under `tmp_dir` with the same paths as in the original
package manifest.
We need to copy dependencies over ( transitively ) and at the same time keep the paths valid in the package . To do this we compute the resolution graph for all possible dependencies ( so in dev mode ) and then calculate the nesting under ` tmp_dir ` the we need to copy the root package so that it and all its dependencies reside under ` tmp_dir ` with the same paths as in the original package manifest .
fn copy_deps(tmp_dir: &Path, pkg_dir: &Path) -> anyhow::Result<PathBuf> {
    // Sometimes we run a test that isn't a package for metatests so if there isn't a package we
    // don't need to nest at all.
    let package_resolution = match (BuildConfig {
        dev_mode: true,
        ..Default::default()
    })
    .resolution_graph_for_package(pkg_dir)
    {
        Ok(pkg) => pkg,
        Err(_) => return Ok(tmp_dir.to_path_buf()),
    };
    let package_nest_depth = determine_package_nest_depth(&package_resolution, pkg_dir)?;
    let tmp_dir = pad_tmp_path(tmp_dir, package_nest_depth)?;
    for (_, dep) in package_resolution.package_table.iter() {
        let source_dep_path = &dep.package_path;
        let dest_dep_path = tmp_dir.join(&dep.package_path.strip_prefix(pkg_dir).unwrap());
        if !dest_dep_path.exists() {
            fs::create_dir_all(&dest_dep_path)?;
        }
        simple_copy_dir(&dest_dep_path, source_dep_path)?;
    }
    Ok(tmp_dir)
}
fn copy_deps ( tmp_dir : & Path , pkg_dir : & Path ) -> anyhow :: Result < PathBuf > { // Sometimes we run a test that isn't a package for metatests so if there isn't a package we // don't need to nest at all. let package_resolution = match ( BuildConfig { dev_mode : true , .. Default :: default ( ) } ) . resolution_graph_for_package ( pkg_dir ) { Ok ( pkg ) => pkg , Err ( _ ) => return Ok ( tmp_dir . to_path_buf ( ) ) , } ; let package_nest_depth = determine_package_nest_depth ( & package_resolution , pkg_dir ) ? ; let tmp_dir = pad_tmp_path ( tmp_dir , package_nest_depth ) ? ; for ( _ , dep ) in package_resolution . package_table . iter ( ) { let source_dep_path = & dep . package_path ; let dest_dep_path = tmp_dir . join ( & dep . package_path . strip_prefix ( pkg_dir ) . unwrap ( ) ) ; if ! dest_dep_path . exists ( ) { fs :: create_dir_all ( & dest_dep_path ) ? ; } simple_copy_dir ( & dest_dep_path , source_dep_path ) ? ; } Ok ( tmp_dir ) }
We need to copy dependencies over (transitively) and at the same time keep the paths valid in
the package.
We need to copy dependencies over ( transitively ) and at the same time keep the paths valid in the package .
tmp_dir
&Path
pkg_dir
&Path