mercur 0.1.5

mercur - junolang package manager
use std::fs::File;
use std::path::Path;

use anyhow::anyhow;

use crate::build::build::build_bins;
use crate::build::manifest::MercurLock;
use crate::build::parse_juno_toml;
use crate::build::parse_mercur_lock;

pub fn build_proj(path: &Path) -> anyhow::Result<()> {
    let juno_toml_path = path.join("juno.toml");
    if !juno_toml_path.exists() {
        return Err(anyhow!("No juno.toml found"));
    }
    let juno_toml = parse_juno_toml(&juno_toml_path)?;

    let mercur_lock_path = path.join("mercur.lock");
    let mut mercur_lock = MercurLock { packages: vec![] };
    if mercur_lock_path.exists() {
        mercur_lock = parse_mercur_lock(&mercur_lock_path)?;
    }
    build_bins(path, juno_toml)?;
    Ok(())
}