mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 23:19:36 +00:00
refactor: modularize build core engine, update workspaces, cache, and test suite
This commit is contained in:
@@ -45,7 +45,6 @@ pub fn add(args: &[String]) -> i32 {
|
||||
println!(" Adds a dependency to the project.");
|
||||
println!();
|
||||
printc("SOURCES:", BOLD_GREEN);
|
||||
println!(" user/repo GitHub shorthand");
|
||||
println!(" github:user/repo GitHub repository");
|
||||
println!(" gitlab:user/repo GitLab repository");
|
||||
println!(" git:host.com/user/repo Generic git repository");
|
||||
@@ -140,7 +139,6 @@ fn parse_add_args(args: &[String]) -> Result<AddArgs, i32> {
|
||||
if args.is_empty() {
|
||||
error("Usage: dcr add <name> <source> [--branch <branch> | --tag <tag> | --rev <rev>]");
|
||||
error("Sources:");
|
||||
error(" user/repo -> github.com/user/repo");
|
||||
error(" github:user/repo -> github.com/user/repo");
|
||||
error(" gitlab:user/repo -> gitlab.com/user/repo");
|
||||
error(" git:host.com/user/repo -> host.com/user/repo");
|
||||
|
||||
1701
src/cli/build.rs
1701
src/cli/build.rs
File diff suppressed because it is too large
Load Diff
@@ -15,10 +15,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::core::build::builder::BuildContext;
|
||||
use crate::core::build::builder::collect_sources;
|
||||
use crate::core::build::common;
|
||||
use crate::core::build_config::Config;
|
||||
use crate::core::builder::BuildContext;
|
||||
use crate::core::builder::collect_sources;
|
||||
use crate::core::builder::common;
|
||||
use crate::core::workspace::parse_workspace;
|
||||
use crate::utils::build::{
|
||||
get_bool_with_profile, get_config_opt, get_config_str, get_language_with_profile_or_default,
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::core::build::common;
|
||||
use crate::core::build_config::Config;
|
||||
use crate::core::builder::common;
|
||||
use crate::utils::build::{get_bool_with_profile, get_list_with_profile};
|
||||
use crate::utils::fs::find_project_root;
|
||||
use crate::utils::log::error;
|
||||
|
||||
@@ -218,7 +218,14 @@ fn run_project(
|
||||
return Err("Cannot run library build".to_string());
|
||||
}
|
||||
|
||||
let build_status = build(&args_for_build(flags));
|
||||
let build_status = if let Some(wroot) = workspace_root {
|
||||
with_dir(wroot, || {
|
||||
Ok(build(&args_for_workspace_build(flags, project_name)))
|
||||
})
|
||||
.unwrap_or(1)
|
||||
} else {
|
||||
build(&args_for_build(flags))
|
||||
};
|
||||
let bin_path = crate::platform::bin_path(
|
||||
&flags.profile,
|
||||
project_name,
|
||||
@@ -266,6 +273,36 @@ fn args_for_build(flags: &crate::cli::flags::BuildRunFlags) -> Vec<String> {
|
||||
args.push("--workspace".to_string());
|
||||
args.push(name.clone());
|
||||
}
|
||||
if flags.force {
|
||||
args.push("--force".to_string());
|
||||
}
|
||||
if flags.clean {
|
||||
args.push("--clean".to_string());
|
||||
}
|
||||
if flags.verbose {
|
||||
args.push("--verbose".to_string());
|
||||
}
|
||||
args
|
||||
}
|
||||
|
||||
fn args_for_workspace_build(
|
||||
flags: &crate::cli::flags::BuildRunFlags,
|
||||
member_name: &str,
|
||||
) -> Vec<String> {
|
||||
let mut args = Vec::new();
|
||||
args.push(format!("--{}", flags.profile));
|
||||
if let Some(ref target) = flags.target {
|
||||
args.push("--target".to_string());
|
||||
args.push(target.clone());
|
||||
}
|
||||
args.push("--workspace".to_string());
|
||||
args.push(member_name.to_string());
|
||||
if flags.force {
|
||||
args.push("--force".to_string());
|
||||
}
|
||||
if flags.clean {
|
||||
args.push("--clean".to_string());
|
||||
}
|
||||
if flags.verbose {
|
||||
args.push("--verbose".to_string());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user