-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
92 lines (76 loc) · 2.07 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
#
# Main build script
#
param(
[Parameter(Mandatory = $true)]
[string]$Type,
[string]$Arch,
[switch]$Sdv
)
#
# Script Body
#
Function Build {
param(
[string]$Arch,
[string]$Type
)
$visualstudioversion = $Env:VisualStudioVersion
$solutiondir = @{ "14.0" = "vs2015"; "15.0" = "vs2017"; "16.0" = "vs2019"; }
$configurationbase = @{ "14.0" = "Windows 8"; "15.0" = "Windows 8"; "16.0" = "Windows 8"; }
$params = @{
SolutionDir = $solutiondir[$visualstudioversion];
ConfigurationBase = $configurationbase[$visualstudioversion];
Arch = $Arch;
Type = $Type
}
& ".\msbuild.ps1" @params
}
Function SdvBuild {
$visualstudioversion = $Env:VisualStudioVersion
$solutiondir = @{ "14.0" = "vs2015"; "15.0" = "vs2017"; "16.0" = "vs2019"; }
$configurationbase = @{ "14.0" = "Windows 10"; "15.0" = "Windows 10"; "16.0" = "Windows 10"; }
$arch = "x64"
$params = @{
SolutionDir = $solutiondir[$visualstudioversion];
ConfigurationBase = $configurationbase[$visualstudioversion];
Arch = $arch;
Type = "sdv"
}
& ".\msbuild.ps1" @params
}
if ($Type -ne "free" -and $Type -ne "checked") {
Write-Host "Invalid Type"
Exit -1
}
if ([string]::IsNullOrEmpty($Env:VENDOR_NAME)) {
Set-Item -Path Env:VENDOR_NAME -Value 'Xen Project'
}
if ([string]::IsNullOrEmpty($Env:VENDOR_PREFIX)) {
Set-Item -Path Env:VENDOR_PREFIX -Value 'XP'
}
if ([string]::IsNullOrEmpty($Env:PRODUCT_NAME)) {
Set-Item -Path Env:PRODUCT_NAME -Value 'Xen'
}
if ([string]::IsNullOrEmpty($Env:BUILD_NUMBER)) {
if (Test-Path ".build_number") {
$BuildNum = Get-Content -Path ".build_number"
Set-Content -Path ".build_number" -Value ([int]$BuildNum + 1)
} else {
$BuildNum = '0'
Set-Content -Path ".build_number" -Value '1'
}
Set-Item -Path Env:BUILD_NUMBER -Value $BuildNum
}
Set-Item -Path Env:MAJOR_VERSION -Value '9'
Set-Item -Path Env:MINOR_VERSION -Value '0'
Set-Item -Path Env:MICRO_VERSION -Value '0'
if ([string]::IsNullOrEmpty($Arch) -or $Arch -eq "x86" -or $Arch -eq "Win32") {
Build "x86" $Type
}
if ([string]::IsNullOrEmpty($Arch) -or $Arch -eq "x64") {
Build "x64" $Type
}
if ($Sdv) {
SdvBuild
}