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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
use std::env::{current_dir, set_current_dir};
use std::fs::{create_dir_all, metadata, read_to_string};
use std::path::Path;
use std::process::Command;
mod parse;
const TARGET_TAG: &str = "v3.1.5";
fn main() {
assert_eq!(
current_dir().unwrap(),
Path::new(env!("CARGO_MANIFEST_DIR")),
"running in the wrong place"
);
create_dir_all("out").unwrap();
set_current_dir("out").unwrap();
if metadata("orig").is_err() {
println!("cloning wxWidgets source...");
let git_clone = Command::new("git")
.args(&[
"clone",
"--quiet",
"https://github.com/wxWidgets/wxWidgets.git",
"orig",
])
.status()
.unwrap();
assert!(git_clone.success());
let git_config = Command::new("git")
.args(&[
"-C",
"orig",
"config",
"--local",
"advice.detachedHead",
"false",
])
.status()
.unwrap();
assert!(git_config.success());
}
let git_tag = Command::new("git")
.args(&["-C", "orig", "describe"])
.output()
.unwrap();
if String::from_utf8(git_tag.stdout).unwrap().trim() != TARGET_TAG {
let git_checkout = Command::new("git")
.args(&["-C", "orig", "checkout", "--quiet", TARGET_TAG])
.status()
.unwrap();
assert!(git_checkout.success());
}
if metadata("new").is_err() {
println!("creating wx crate...");
let cargo_new = Command::new("cargo")
.args(&[
"new", "--quiet", "--vcs", "none", "--lib", "--name", "wx", "new",
])
.status()
.unwrap();
assert!(cargo_new.success());
}
let wx_h_text = read_to_string("orig/include/wx/wx.h").unwrap();
let lib_root_h = parse::parse(&wx_h_text);
dbg!(lib_root_h);
}
|