~comcloudway/cabin

5e63d45bca393395120041b64818acf23e4e1b7e — Jakob Meier 1 year, 3 months ago 1cf8c35
Added build progress output (for batch builds)
2 files changed, 8 insertions(+), 4 deletions(-)

M src/cmds/build.rs
M src/main.rs
M src/cmds/build.rs => src/cmds/build.rs +7 -4
@@ 21,8 21,8 @@ fn arch_in(def: &HashSet<String>, arch: &str) -> bool {
}

/// builds a single package without checking the dependencies
fn build_package(name: PackageName, db: &Database, arch: &Option<String>, verbose:bool) {
    let pkg = db.packages.get(&name).expect("Package not found");
fn build_package(name: &str, db: &Database, arch: &Option<String>, verbose:bool) {
    let pkg = db.packages.get(name).expect("Package not found");

    let mut child = Command::new("sh");



@@ 80,7 80,10 @@ fn build_group(name: PackageName, db: &Database, arch: &Option<String>, verbose:
    let tasks = super::tree::topological_sort(&name, &db)
        .expect("Unable to resolve dependencies, as there is a cycle in the graph");

    for task in tasks {
    let num = tasks.len();

    for (i, task) in tasks.iter().enumerate() {
        println!("Building {} ({}/{})", task, i+1, num);
        build_package(task, db, arch, verbose);
    }
}


@@ 94,6 97,6 @@ pub fn build(name: PackageName, db: Option<PathBuf>, arch: Option<String>, build
        // dependency resolution
        build_group(name, &db, &arch, verbose);
    } else {
        build_package(name, &db, &arch, verbose);
        build_package(&name, &db, &arch, verbose);
    }
}

M src/main.rs => src/main.rs +1 -0
@@ 38,6 38,7 @@ enum Commands {
        /// package database path
        #[arg(short='d',long)]
        db: Option<PathBuf>,
        /// allows the build log to be toggled on and off
        #[arg(short='v', default_value="false")]
        verbose: bool
    },