-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.rs
47 lines (40 loc) · 1.32 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use std::env;
use std::path::Path;
use std::process::Command;
fn main() {
let base_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
println!("Base dir {}", base_dir);
let profile = env::var("PROFILE").unwrap();
println!("Profile {}", profile);
let release_dir = Path::new(&base_dir).join("target").join(profile);
println!("Release dir {}", release_dir.to_str().unwrap());
let template_dir = release_dir.join("assets");
println!("Create output dir {}", template_dir.to_str().unwrap());
// create output directory for build
Command::new("mkdir")
.args(&["-p", template_dir.to_str().unwrap()])
.status()
.unwrap();
// copy container assets to output directory
Command::new("cp")
.args(&["-r", "assets/templates", template_dir.to_str().unwrap()])
.status()
.unwrap();
// Copy README for package
Command::new("cp")
.args(&[
"package-readme.txt",
release_dir.join("README.txt").to_str().unwrap(),
])
.status()
.unwrap();
// Copy licenses
Command::new("cp")
.args(&["LICENSE-MIT", release_dir.to_str().unwrap()])
.status()
.unwrap();
Command::new("cp")
.args(&["LICENSE-APACHE", release_dir.to_str().unwrap()])
.status()
.unwrap();
}