2015-01-10 19:31:55 +00:00
|
|
|
#![allow(unstable)]
|
|
|
|
|
2014-06-25 16:47:34 +00:00
|
|
|
use std::io::{File, Truncate, ReadWrite};
|
|
|
|
use std::os;
|
|
|
|
use std::path::Path;
|
|
|
|
|
2014-07-19 21:25:28 +00:00
|
|
|
static TEMPLATE: &'static str = "\
|
2015-01-10 19:31:55 +00:00
|
|
|
#![allow(unstable)]
|
2015-01-10 21:00:15 +00:00
|
|
|
extern crate \"@UTIL_CRATE@\" as uu@UTIL_CRATE@;
|
2014-06-25 16:47:34 +00:00
|
|
|
|
|
|
|
use std::os;
|
2015-01-10 21:00:15 +00:00
|
|
|
use uu@UTIL_CRATE@::uumain;
|
2014-06-25 16:47:34 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
os::set_exit_status(uumain(os::args()));
|
|
|
|
}
|
|
|
|
";
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let args = os::args();
|
|
|
|
if args.len() != 3 {
|
|
|
|
println!("usage: mkbuild <crate> <outfile>");
|
|
|
|
os::set_exit_status(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-10 21:00:15 +00:00
|
|
|
let crat = args[1].as_slice();
|
|
|
|
let outfile = args[2].as_slice();
|
2014-06-25 16:47:34 +00:00
|
|
|
|
2014-12-25 18:55:32 +00:00
|
|
|
let main = TEMPLATE.replace("@UTIL_CRATE@", crat);
|
2014-06-25 16:47:34 +00:00
|
|
|
let mut out = File::open_mode(&Path::new(outfile), Truncate, ReadWrite);
|
|
|
|
|
|
|
|
match out.write(main.as_bytes()) {
|
2014-10-30 09:06:47 +00:00
|
|
|
Err(e) => panic!("{}", e),
|
2014-06-25 16:47:34 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|