mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 21:39:36 +00:00
fix(ci): fix tests
This commit is contained in:
@@ -160,14 +160,12 @@ pub(crate) fn archive_static(
|
||||
return Ok(common::elapsed_secs(start_time));
|
||||
}
|
||||
|
||||
let archiver = ctx.archiver.unwrap_or(if cfg!(target_os = "windows") {
|
||||
"lib"
|
||||
} else {
|
||||
"ar"
|
||||
});
|
||||
let archiver = ctx
|
||||
.archiver
|
||||
.unwrap_or_else(|| default_archiver(ctx.compiler));
|
||||
|
||||
let mut cmd = Command::new(archiver);
|
||||
if cfg!(target_os = "windows") && archiver == "lib" {
|
||||
if cfg!(target_os = "windows") && is_msvc_lib(archiver) {
|
||||
cmd.arg("/nologo").arg(format!("/OUT:{lib_path}"));
|
||||
} else {
|
||||
cmd.arg("rcs").arg(&lib_path);
|
||||
@@ -243,6 +241,26 @@ pub(crate) fn link_binary(
|
||||
run(ctx, cmd, start_time)
|
||||
}
|
||||
|
||||
fn default_archiver(compiler: &str) -> &'static str {
|
||||
let c = compiler.to_lowercase();
|
||||
if cfg!(target_os = "windows") {
|
||||
if c.contains("cl") && !c.contains("clang") {
|
||||
"lib"
|
||||
} else if c.contains("clang") {
|
||||
"llvm-ar"
|
||||
} else {
|
||||
"ar"
|
||||
}
|
||||
} else {
|
||||
"ar"
|
||||
}
|
||||
}
|
||||
|
||||
fn is_msvc_lib(archiver: &str) -> bool {
|
||||
let a = archiver.to_lowercase();
|
||||
a == "lib" || a == "lib.exe" || a.ends_with("\\lib.exe") || a.ends_with("/lib.exe")
|
||||
}
|
||||
|
||||
fn run(ctx: &BuildContext, mut cmd: Command, start_time: Instant) -> Result<f64, String> {
|
||||
if ctx.verbose || std::env::var("DCR_DEBUG").is_ok() {
|
||||
eprintln!("[dcr] {:?}", cmd);
|
||||
|
||||
@@ -60,8 +60,13 @@ pub fn build(ctx: &BuildContext) -> Result<f64, String> {
|
||||
let elapsed = common::elapsed_secs(start_time);
|
||||
return Ok(elapsed);
|
||||
}
|
||||
let mut cmd = Command::new(ctx.archiver.unwrap_or("lib"));
|
||||
cmd.arg("/nologo").arg(format!("/OUT:{lib_path}"));
|
||||
let archiver = ctx.archiver.unwrap_or("lib");
|
||||
let mut cmd = Command::new(archiver);
|
||||
if archiver == "lib" || archiver.eq_ignore_ascii_case("lib.exe") {
|
||||
cmd.arg("/nologo").arg(format!("/OUT:{lib_path}"));
|
||||
} else {
|
||||
cmd.arg("rcs").arg(&lib_path);
|
||||
}
|
||||
for obj in &objects {
|
||||
cmd.arg(obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user