-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.ps1
55 lines (45 loc) · 1.16 KB
/
build.ps1
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
$WINMD_PARAMS = ""
function DownloadJSON {
mkdir json
git clone -v --depth 1 https://github.com/marlersoft/win32json .\json\win32json
}
function CleanUpJSON {
Remove-Item -Path json -Force -Recurse
}
function PrepJSON {
if ($env:JSON_CACHE) {
if (!(Test-Path -Path .\json\win32json)) { DownloadJSON }
} else {
if (Test-Path -Path .\json\win32json) { CleanUpJSON }
DownloadJSON
}
}
function PrepSrcDir {
if (Test-Path -Path .\src\win32cr.cr) { Remove-Item -Path src/win32cr.cr }
if (Test-Path -Path .\src\win32cr) { Remove-Item -Path src/win32cr -Force -Recurse }
}
function CleanUp {
if (!($env:JSON_CACHE)) {
CleanUpJSON
}
}
function Run {
if ($env:WINMD_DEBUG) {
$WINMD_PARAMS = $WINMD_PARAMS + "-d"
}
if ($env:WINMD_TRACE) {
$WINMD_PARAMS = $WINMD_PARAMS + " -t"
}
mkdir src/win32cr
Start-Process -Wait -NoNewWindow -FilePath .\bin\winmd.exe -ArgumentList "generate","${WINMD_PARAMS}","json\\win32json\\api","."
}
function BuildWinMD {
if (!(Test-Path .\bin\winmd.exe)) {
& .\scripts\build_winmd.ps1
}
}
PrepSrcDir
PrepJSON
BuildWinMD
Run
CleanUp