pub fn gen(
    config: &Config,
    metadata: &Metadata,
    submodule_path: Option<&Path>,
    bike: &bicycle::Bicycle,
    wrapper: &TextWrapper,
    non_interactive: opts::NonInteractive,
    skip_dev_tools: opts::SkipDevTools,
    reinstall_deps: opts::ReinstallDeps,
    filter: &templating::Filter,
) -> Result<(), Error> {
    println!("Installing iOS toolchains...");
    Target::install_all().map_err(Error::RustupFailed)?;
    rust_version_check(wrapper).map_err(Error::RustVersionCheckFailed)?;

    deps::install_all(wrapper, non_interactive, skip_dev_tools, reinstall_deps)
        .map_err(Error::DepsInstallFailed)?;

    let dest = config.project_dir();
    let rel_prefix = util::relativize_path(config.app().root_dir(), &dest);
    let source_dirs = std::iter::once("src".as_ref())
        .chain(submodule_path)
        .map(|path| rel_prefix.join(path))
        .collect::<Vec<PathBuf>>();

    let src = Pack::lookup_platform(TEMPLATE_PACK)
        .map_err(Error::MissingPack)?
        .expect_local();

    let asset_catalogs = metadata.ios().asset_catalogs().unwrap_or_default();

    bike.filter_and_process(
        src,
        &dest,
        |map| {
            map.insert("file-groups", &source_dirs);
            map.insert("ios-frameworks", metadata.ios().frameworks());
            map.insert("ios-vendor-frameworks", metadata.ios().vendor_frameworks());
            map.insert("macos-frameworks", metadata.macos().frameworks());
            map.insert(
                "macos-vendor-frameworks",
                metadata.macos().vendor_frameworks(),
            );
            map.insert("asset-catalogs", asset_catalogs);
        },
        filter.fun(),
    )
    .map_err(Error::TemplateProcessingFailed)?;

    ln::force_symlink_relative(config.app().asset_dir(), &dest, ln::TargetStyle::Directory)
        .map_err(Error::AssetDirSymlinkFailed)?;

    // Create all asset catalog directories if they don't already exist
    for dir in asset_catalogs {
        std::fs::create_dir_all(dir).map_err(|cause| Error::DirectoryCreationFailed {
            path: dest.clone(),
            cause,
        })?;
    }

    // Note that Xcode doesn't always reload the project nicely; reopening is
    // often necessary.
    println!("Generating Xcode project...");
    bossy::Command::impure("xcodegen")
        .with_args(&["generate", "--spec"])
        .with_arg(dest.join("project.yml"))
        .run_and_wait()
        .map_err(Error::XcodegenFailed)?;
    Ok(())
}
// unprefixed app_root seems pretty dangerous!!
// TODO: figure out what I meant by that
unprefixed app_root seems pretty dangerous
TODO: figure out what I meant by that
unprefixed app_root seems pretty dangerous TODO : figure out what I meant by that
pub fn gen(
    config: &Config,
    metadata: &Metadata,
    submodule_path: Option<&Path>,
    bike: &bicycle::Bicycle,
    wrapper: &TextWrapper,
    non_interactive: opts::NonInteractive,
    skip_dev_tools: opts::SkipDevTools,
    reinstall_deps: opts::ReinstallDeps,
    filter: &templating::Filter,
) -> Result<(), Error> {
    println!("Installing iOS toolchains...");
    Target::install_all().map_err(Error::RustupFailed)?;
    rust_version_check(wrapper).map_err(Error::RustVersionCheckFailed)?;
    deps::install_all(wrapper, non_interactive, skip_dev_tools, reinstall_deps)
        .map_err(Error::DepsInstallFailed)?;
    let dest = config.project_dir();
    let rel_prefix = util::relativize_path(config.app().root_dir(), &dest);
    let source_dirs = std::iter::once("src".as_ref())
        .chain(submodule_path)
        .map(|path| rel_prefix.join(path))
        .collect::<Vec<PathBuf>>();
    let src = Pack::lookup_platform(TEMPLATE_PACK)
        .map_err(Error::MissingPack)?
        .expect_local();
    let asset_catalogs = metadata.ios().asset_catalogs().unwrap_or_default();
    bike.filter_and_process(
        src,
        &dest,
        |map| {
            map.insert("file-groups", &source_dirs);
            map.insert("ios-frameworks", metadata.ios().frameworks());
            map.insert("ios-vendor-frameworks", metadata.ios().vendor_frameworks());
            map.insert("macos-frameworks", metadata.macos().frameworks());
            map.insert(
                "macos-vendor-frameworks",
                metadata.macos().vendor_frameworks(),
            );
            map.insert("asset-catalogs", asset_catalogs);
        },
        filter.fun(),
    )
    .map_err(Error::TemplateProcessingFailed)?;
    ln::force_symlink_relative(config.app().asset_dir(), &dest, ln::TargetStyle::Directory)
        .map_err(Error::AssetDirSymlinkFailed)?;
    // Create all asset catalog directories if they don't already exist
    for dir in asset_catalogs {
        std::fs::create_dir_all(dir).map_err(|cause| Error::DirectoryCreationFailed {
            path: dest.clone(),
            cause,
        })?;
    }
    // Note that Xcode doesn't always reload the project nicely; reopening is
    // often necessary.
    println!("Generating Xcode project...");
    bossy::Command::impure("xcodegen")
        .with_args(&["generate", "--spec"])
        .with_arg(dest.join("project.yml"))
        .run_and_wait()
        .map_err(Error::XcodegenFailed)?;
    Ok(())
}
pub fn gen ( config : & Config , metadata : & Metadata , submodule_path : Option < & Path > , bike : & bicycle :: Bicycle , wrapper : & TextWrapper , non_interactive : opts :: NonInteractive , skip_dev_tools : opts :: SkipDevTools , reinstall_deps : opts :: ReinstallDeps , filter : & templating :: Filter , ) -> Result < ( ) , Error > { println ! ( " " ) ; Target :: install_all ( ) . map_err ( Error :: RustupFailed ) ? ; rust_version_check ( wrapper ) . map_err ( Error :: RustVersionCheckFailed ) ? ; deps :: install_all ( wrapper , non_interactive , skip_dev_tools , reinstall_deps ) . map_err ( Error :: DepsInstallFailed ) ? ; let dest = config . project_dir ( ) ; let rel_prefix = util :: relativize_path ( config . app ( ) . root_dir ( ) , & dest ) ; let source_dirs = std :: iter :: once ( " " . as_ref ( ) ) . chain ( submodule_path ) . map ( | path | rel_prefix . join ( path ) ) . collect :: < Vec < PathBuf > > ( ) ; let src = Pack :: lookup_platform ( TEMPLATE_PACK ) . map_err ( Error :: MissingPack ) ? . expect_local ( ) ; let asset_catalogs = metadata . ios ( ) . asset_catalogs ( ) . unwrap_or_default ( ) ; bike . filter_and_process ( src , & dest , | map | { map . insert ( " " , & source_dirs ) ; map . insert ( " " , metadata . ios ( ) . frameworks ( ) ) ; map . insert ( " " , metadata . ios ( ) . vendor_frameworks ( ) ) ; map . insert ( " " , metadata . macos ( ) . frameworks ( ) ) ; map . insert ( " " , metadata . macos ( ) . vendor_frameworks ( ) , ) ; map . insert ( " " , asset_catalogs ) ; } , filter . fun ( ) , ) . map_err ( Error :: TemplateProcessingFailed ) ? ; ln :: force_symlink_relative ( config . app ( ) . asset_dir ( ) , & dest , ln :: TargetStyle :: Directory ) . map_err ( Error :: AssetDirSymlinkFailed ) ? ; // Create all asset catalog directories if they don't already exist for dir in asset_catalogs { std :: fs :: create_dir_all ( dir ) . map_err ( | cause | Error :: DirectoryCreationFailed { path : dest . clone ( ) , cause , } ) ? ; } // Note that Xcode doesn't always reload the project nicely; reopening is // often necessary. println ! ( " " ) ; bossy :: Command :: impure ( " " ) . with_args ( & [ " " , " " ] ) . with_arg ( dest . join ( " " ) ) . run_and_wait ( ) . map_err ( Error :: XcodegenFailed ) ? ; Ok ( ( ) ) }
unprefixed app_root seems pretty dangerous!!
unprefixed app_root seems pretty dangerous!!
config
&Config
metadata
&Metadata
submodule_path
Option<&Path>
bike
&bicycle::Bicycle
wrapper
&TextWrapper
non_interactive
opts::NonInteractive
skip_dev_tools
opts::SkipDevTools
reinstall_deps
opts::ReinstallDeps
filter
&templating::Filter
config
&Config
metadata
&Metadata
submodule_path
Option<&Path>
bike
&bicycle::Bicycle
wrapper
&TextWrapper
non_interactive
opts::NonInteractive
skip_dev_tools
opts::SkipDevTools
reinstall_deps
opts::ReinstallDeps
filter
&templating::Filter