2015-04-16 04:59:33 +00:00
|
|
|
#![feature(exit_status)]
|
2015-02-06 13:48:07 +00:00
|
|
|
use std::env;
|
2015-04-16 04:59:33 +00:00
|
|
|
use std::io::Write;
|
|
|
|
use std::fs::File;
|
2014-06-25 16:47:34 +00:00
|
|
|
|
2014-07-19 21:25:28 +00:00
|
|
|
static TEMPLATE: &'static str = "\
|
2015-03-08 18:09:41 +00:00
|
|
|
#![feature(exit_status)]
|
2015-04-16 04:59:33 +00:00
|
|
|
extern crate @UTIL_CRATE@ as uu@UTIL_CRATE@;
|
2014-06-25 16:47:34 +00:00
|
|
|
|
2015-02-06 13:48:07 +00:00
|
|
|
use std::env;
|
2015-01-10 21:00:15 +00:00
|
|
|
use uu@UTIL_CRATE@::uumain;
|
2014-06-25 16:47:34 +00:00
|
|
|
|
|
|
|
fn main() {
|
2015-02-13 19:57:47 +00:00
|
|
|
env::set_exit_status(uumain(env::args().collect()));
|
2014-06-25 16:47:34 +00:00
|
|
|
}
|
|
|
|
";
|
|
|
|
|
|
|
|
fn main() {
|
2015-02-13 19:57:47 +00:00
|
|
|
let args : Vec<String> = env::args().collect();
|
2014-06-25 16:47:34 +00:00
|
|
|
if args.len() != 3 {
|
|
|
|
println!("usage: mkbuild <crate> <outfile>");
|
2015-02-06 13:48:07 +00:00
|
|
|
env::set_exit_status(1);
|
2014-06-25 16:47:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-16 04:59:33 +00:00
|
|
|
let crat = &args[1][..];
|
|
|
|
let outfile = &args[2][..];
|
2014-06-25 16:47:34 +00:00
|
|
|
|
2014-12-25 18:55:32 +00:00
|
|
|
let main = TEMPLATE.replace("@UTIL_CRATE@", crat);
|
2015-04-16 04:59:33 +00:00
|
|
|
match File::create(outfile) {
|
|
|
|
Ok(mut out) => match out.write_all(main.as_bytes()) {
|
|
|
|
Err(e) => panic!("{}", e),
|
|
|
|
_ => (),
|
|
|
|
},
|
2014-10-30 09:06:47 +00:00
|
|
|
Err(e) => panic!("{}", e),
|
2014-06-25 16:47:34 +00:00
|
|
|
}
|
|
|
|
}
|