Add ar
command in run-make-support
This commit is contained in:
parent
449cde32ad
commit
3394fe89d8
@ -228,6 +228,12 @@ dependencies = [
|
||||
"backtrace",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ar"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69"
|
||||
|
||||
[[package]]
|
||||
name = "ar_archive_writer"
|
||||
version = "0.2.0"
|
||||
@ -3394,6 +3400,7 @@ dependencies = [
|
||||
name = "run_make_support"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"ar",
|
||||
"gimli 0.28.1",
|
||||
"object 0.34.0",
|
||||
"regex",
|
||||
|
@ -9,3 +9,4 @@ similar = "2.5.0"
|
||||
wasmparser = "0.118.2"
|
||||
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
|
||||
gimli = "0.28.1"
|
||||
ar = "0.9.0"
|
||||
|
@ -63,10 +63,15 @@ pub fn target() -> String {
|
||||
|
||||
/// `AR`
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
pub fn ar_command() -> Command {
|
||||
let ar_path = env_var("AR");
|
||||
Command::new(ar_path)
|
||||
pub fn ar(inputs: &[impl AsRef<Path>], output_path: impl AsRef<Path>) {
|
||||
let output = fs::File::create(&output_path).expect(&format!(
|
||||
"the file in path \"{}\" could not be created",
|
||||
output_path.as_ref().display()
|
||||
));
|
||||
let mut builder = ar::Builder::new(output);
|
||||
for input in inputs {
|
||||
builder.append_path(input).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if target is windows-like.
|
||||
|
@ -1,8 +1,8 @@
|
||||
use run_make_support::fs_wrapper::create_file;
|
||||
use run_make_support::{ar_command, rustc};
|
||||
use run_make_support::{ar, rustc};
|
||||
|
||||
fn main() {
|
||||
create_file("lib.rmeta");
|
||||
ar_command().arg("crus").arg("libfoo-ffffffff-1.0.rlib").arg("lib.rmeta").run();
|
||||
ar(&["lib.rmeta"], "libfoo-ffffffff-1.0.rlib");
|
||||
rustc().input("foo.rs").run_fail().assert_stderr_contains("found invalid metadata");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user