forked from qtproject/installer-framework
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.ps1
92 lines (78 loc) · 2.54 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
param
(
[switch]$DeepClean,
[String]$ToolsPrefix = "C:",
[String]$WinSdk = "10.0.17763.0",
[String]$BuildToolsPrefix = "",
[switch]$Verbose,
[switch]$SkipCleaning,
[switch]$SkipPreClean,
[switch]$SkipPostClean
)
if ($Verbose) {
$DebugPreference = 'Continue'
}
$DeepCleanSwitch = ""
if ($DeepClean) { $DeepCleanSwitch = "-DeepClean" }
$VerboseSwitch = ""
if ($Verbose) { $VerboseSwitch = "-Verbose" }
$jom = "$ToolsPrefix\jom\jom.exe"
$qmake = "$ToolsPrefix\static\qt\v5.12.7\bin\qmake.exe"
$varsall = "C:\$BuildToolsPrefix\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
Write-Output "Start building installer framework"
Write-Output "---"
if (!(Test-Path $jom)) {
Write-Output "Jom was not found at '$jom'! Exiting..."
Return
} else {
Write-Debug "Jom was found at '$jom'."
}
if (!(Test-Path $qmake)) {
Write-Output "Qmake was not found at '$qmake'! Exiting..."
} else {
Write-Debug "Qmake was found at '$qmake'."
}
if (!(Test-Path $varsall)) {
Write-Output "vcvarsall not found at '$varsall'! Exiting..."
} else {
Write-Debug "vcvarsall was found at '$varsall'."
}
$buildDir = "$PSScriptRoot\build"
if ($SkipCleaning -Or $SkipPreClean) {
Write-Debug "Skipping pre cleaning"
if (Test-Path $buildDir) {
Remove-Item $buildDir -Force -Recurse
Write-Debug "Build dir removed"
}
} else {
Invoke-Expression -Command "$PSScriptRoot\clean.ps1 $DeepCleanSwitch $VerboseSwitch"
}
# Create the build folder
if ($Verbose) {
New-Item -Path $buildDir -ItemType "directory"
} else {
$null = New-Item -Path $buildDir -ItemType "directory"
}
Write-Debug "Build dir created"
# Build the framework (this is done via bat because of vcvarsall)
$buildHelper = """$PSScriptRoot\build_helper.bat"" ""$varsall"" $WinSdk ""$qmake"" ""$jom"""
Write-Debug "Start creating the framework: $buildHelper"
if ($Verbose) {
cmd.exe /c $buildHelper
} else {
$null = cmd.exe /c $buildHelper
}
Write-Debug "Framework created"
# Copy the output to the build folder
Copy-Item "$PSScriptRoot\bin\binarycreator.*" $buildDir
Copy-Item "$PSScriptRoot\bin\installerbase.*" $buildDir
Copy-Item "$PSScriptRoot\tools\repocompare\release\repocompare.*" $buildDir
Write-Debug "Framework output to build"
if ($SkipCleaning -Or $SkipPostClean) {
Write-Debug "Skipping post cleaning"
} else {
Invoke-Expression -Command "$PSScriptRoot\clean.ps1 $DeepCleanSwitch $VerboseSwitch -SkipBuildDir"
}
Write-Output "---"
Write-Output "Framework built successfully. You'll find it under \build"
$DebugPreference = 'SilentlyContinue'