Improve run-make-support
library args
API
This commit is contained in:
parent
716752ebe6
commit
4b516f599b
@ -525,11 +525,12 @@ pub fn arg<S>(&mut self, arg: S) -> &mut Self
|
|||||||
/// Generic command arguments provider. Prefer specific helper methods if possible.
|
/// Generic command arguments provider. Prefer specific helper methods if possible.
|
||||||
/// Note that for some executables, arguments might be platform specific. For C/C++
|
/// Note that for some executables, arguments might be platform specific. For C/C++
|
||||||
/// compilers, arguments might be platform *and* compiler specific.
|
/// compilers, arguments might be platform *and* compiler specific.
|
||||||
pub fn args<S>(&mut self, args: &[S]) -> &mut Self
|
pub fn args<V, S>(&mut self, args: V) -> &mut Self
|
||||||
where
|
where
|
||||||
|
V: AsRef<[S]>,
|
||||||
S: AsRef<::std::ffi::OsStr>,
|
S: AsRef<::std::ffi::OsStr>,
|
||||||
{
|
{
|
||||||
self.cmd.args(args);
|
self.cmd.args(args.as_ref());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ pub fn main() {
|
|||||||
cc().input("test.c")
|
cc().input("test.c")
|
||||||
.input(static_lib_name("nonclike"))
|
.input(static_lib_name("nonclike"))
|
||||||
.out_exe("test")
|
.out_exe("test")
|
||||||
.args(&extra_c_flags())
|
.args(extra_c_flags())
|
||||||
.args(&extra_cxx_flags())
|
.args(extra_cxx_flags())
|
||||||
.inspect(|cmd| eprintln!("{cmd:?}"))
|
.inspect(|cmd| eprintln!("{cmd:?}"))
|
||||||
.run();
|
.run();
|
||||||
run("test");
|
run("test");
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rustc().input("foo.rs").run();
|
rustc().input("foo.rs").run();
|
||||||
cc().input("bar.c").input(static_lib_name("foo")).out_exe("bar").args(&extra_c_flags()).run();
|
cc().input("bar.c").input(static_lib_name("foo")).out_exe("bar").args(extra_c_flags()).run();
|
||||||
run("bar");
|
run("bar");
|
||||||
remove_file(static_lib_name("foo"));
|
remove_file(static_lib_name("foo"));
|
||||||
run("bar");
|
run("bar");
|
||||||
|
@ -12,7 +12,7 @@ fn main() {
|
|||||||
cc().input("test.c")
|
cc().input("test.c")
|
||||||
.input(static_lib_name("checkrust"))
|
.input(static_lib_name("checkrust"))
|
||||||
.out_exe("test")
|
.out_exe("test")
|
||||||
.args(&extra_c_flags())
|
.args(extra_c_flags())
|
||||||
.run();
|
.run();
|
||||||
run("test");
|
run("test");
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ fn main() {
|
|||||||
cc().input("program.c")
|
cc().input("program.c")
|
||||||
.arg(static_lib_name("library"))
|
.arg(static_lib_name("library"))
|
||||||
.out_exe("program")
|
.out_exe("program")
|
||||||
.args(&extra_c_flags())
|
.args(extra_c_flags())
|
||||||
.args(&extra_cxx_flags())
|
.args(extra_cxx_flags())
|
||||||
.run();
|
.run();
|
||||||
run(&bin_name("program"));
|
run(&bin_name("program"));
|
||||||
}
|
}
|
||||||
|
@ -86,12 +86,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check(CheckCfg { args, contains }: CheckCfg) {
|
fn check(CheckCfg { args, contains }: CheckCfg) {
|
||||||
let output = rustc()
|
let output =
|
||||||
.input("lib.rs")
|
rustc().input("lib.rs").arg("-Zunstable-options").arg("--print=check-cfg").args(args).run();
|
||||||
.arg("-Zunstable-options")
|
|
||||||
.arg("--print=check-cfg")
|
|
||||||
.args(&*args)
|
|
||||||
.run();
|
|
||||||
|
|
||||||
let stdout = output.stdout_utf8();
|
let stdout = output.stdout_utf8();
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ fn main() {
|
|||||||
cc().input("test.c")
|
cc().input("test.c")
|
||||||
.arg(&static_lib_name("nonclike"))
|
.arg(&static_lib_name("nonclike"))
|
||||||
.out_exe("test")
|
.out_exe("test")
|
||||||
.args(&extra_c_flags())
|
.args(extra_c_flags())
|
||||||
.args(&extra_cxx_flags())
|
.args(extra_cxx_flags())
|
||||||
.run();
|
.run();
|
||||||
run("test");
|
run("test");
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ fn main() {
|
|||||||
.out_exe(&dynamic_lib_name("bar"))
|
.out_exe(&dynamic_lib_name("bar"))
|
||||||
.arg("-fPIC")
|
.arg("-fPIC")
|
||||||
.arg("-shared")
|
.arg("-shared")
|
||||||
.args(&extra_c_flags())
|
.args(extra_c_flags())
|
||||||
.args(&extra_cxx_flags())
|
.args(extra_cxx_flags())
|
||||||
.run();
|
.run();
|
||||||
llvm_readobj()
|
llvm_readobj()
|
||||||
.input(dynamic_lib_name("bar"))
|
.input(dynamic_lib_name("bar"))
|
||||||
|
Loading…
Reference in New Issue
Block a user