This repository has been archived by the owner on Jul 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
55 lines (52 loc) · 1.57 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
48
49
50
51
52
53
54
55
use std::env::{current_dir, var};
use std::fs;
use std::path::Path;
use std::process::Command;
use winres;
fn main() {
if var("PROFILE").unwrap() == "release" {
let mut res = winres::WindowsResource::new();
res.set_manifest(
r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
"#,
); // require administrator to run
res.compile().unwrap();
}
// integrate rectify11.phase2 into final result
if !Path::new(
"Rectify11.Phase2/Rectify11Installer/Rectify11.Phase2/obj/Release/Rectify11.Phase2.exe",
)
.exists()
{
Command::new("git")
.current_dir(current_dir().unwrap().as_path())
.args(["submodule", "update", "--init"])
.output()
.unwrap();
Command::new("msbuild")
.args([
"Rectify11.Phase2.sln",
"/p:Configuration=Release",
"/p:platform=x64",
])
.current_dir(Path::new("Rectify11.Phase2"))
.output()
.unwrap();
}
fs::copy(
Path::new(
"Rectify11.Phase2/Rectify11Installer/Rectify11.Phase2/obj/Release/Rectify11.Phase2.exe",
),
Path::new("src/Rectify11.Phase2.exe"),
)
.expect("Failed to copy Rectify11.Phase2.exe");
}