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.
|
||||
/// Note that for some executables, arguments might be platform specific. For C/C++
|
||||
/// 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
|
||||
V: AsRef<[S]>,
|
||||
S: AsRef<::std::ffi::OsStr>,
|
||||
{
|
||||
self.cmd.args(args);
|
||||
self.cmd.args(args.as_ref());
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ pub fn main() {
|
||||
cc().input("test.c")
|
||||
.input(static_lib_name("nonclike"))
|
||||
.out_exe("test")
|
||||
.args(&extra_c_flags())
|
||||
.args(&extra_cxx_flags())
|
||||
.args(extra_c_flags())
|
||||
.args(extra_cxx_flags())
|
||||
.inspect(|cmd| eprintln!("{cmd:?}"))
|
||||
.run();
|
||||
run("test");
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
fn main() {
|
||||
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");
|
||||
remove_file(static_lib_name("foo"));
|
||||
run("bar");
|
||||
|
@ -12,7 +12,7 @@ fn main() {
|
||||
cc().input("test.c")
|
||||
.input(static_lib_name("checkrust"))
|
||||
.out_exe("test")
|
||||
.args(&extra_c_flags())
|
||||
.args(extra_c_flags())
|
||||
.run();
|
||||
run("test");
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ fn main() {
|
||||
cc().input("program.c")
|
||||
.arg(static_lib_name("library"))
|
||||
.out_exe("program")
|
||||
.args(&extra_c_flags())
|
||||
.args(&extra_cxx_flags())
|
||||
.args(extra_c_flags())
|
||||
.args(extra_cxx_flags())
|
||||
.run();
|
||||
run(&bin_name("program"));
|
||||
}
|
||||
|
@ -86,12 +86,8 @@ fn main() {
|
||||
}
|
||||
|
||||
fn check(CheckCfg { args, contains }: CheckCfg) {
|
||||
let output = rustc()
|
||||
.input("lib.rs")
|
||||
.arg("-Zunstable-options")
|
||||
.arg("--print=check-cfg")
|
||||
.args(&*args)
|
||||
.run();
|
||||
let output =
|
||||
rustc().input("lib.rs").arg("-Zunstable-options").arg("--print=check-cfg").args(args).run();
|
||||
|
||||
let stdout = output.stdout_utf8();
|
||||
|
||||
|
@ -11,8 +11,8 @@ fn main() {
|
||||
cc().input("test.c")
|
||||
.arg(&static_lib_name("nonclike"))
|
||||
.out_exe("test")
|
||||
.args(&extra_c_flags())
|
||||
.args(&extra_cxx_flags())
|
||||
.args(extra_c_flags())
|
||||
.args(extra_cxx_flags())
|
||||
.run();
|
||||
run("test");
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ fn main() {
|
||||
.out_exe(&dynamic_lib_name("bar"))
|
||||
.arg("-fPIC")
|
||||
.arg("-shared")
|
||||
.args(&extra_c_flags())
|
||||
.args(&extra_cxx_flags())
|
||||
.args(extra_c_flags())
|
||||
.args(extra_cxx_flags())
|
||||
.run();
|
||||
llvm_readobj()
|
||||
.input(dynamic_lib_name("bar"))
|
||||
|
Loading…
Reference in New Issue
Block a user