forked from netchx/netch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
80 lines (66 loc) · 1.9 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
param (
[Parameter()]
[ValidateSet('Debug', 'Release')]
[string]
$Configuration = 'Release',
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]
$OutputPath = 'release',
[Parameter()]
[bool]
$SelfContained = $True,
[Parameter()]
[bool]
$PublishReadyToRun = $False,
[Parameter()]
[bool]
$PublishSingleFile = $True
)
Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
if ( Test-Path -Path "$OutputPath" ) {
rm -Recurse -Force "$OutputPath"
}
New-Item -ItemType Directory -Name "$OutputPath" | Out-Null
.\deps.ps1 "$OutputPath"
if ( -Not $? ) { exit $lastExitCode }
.\other\build.ps1
if ( -Not $? ) { exit $lastExitCode }
Write-Host
Write-Host 'Building Netch'
dotnet publish `
-c "$Configuration" `
-r 'win-x64' `
-p:Platform='x64' `
-p:SelfContained="$SelfContained" `
-p:PublishTrimmed="$SelfContained" `
-p:PublishReadyToRun="$PublishReadyToRun" `
-p:PublishSingleFile="$PublishSingleFile" `
-p:IncludeNativeLibrariesForSelfExtract="$SelfContained" `
-o "$OutputPath" `
'.\Netch\Netch.csproj'
if ( -Not $? ) { exit $lastExitCode }
Write-Host
Write-Host 'Building Redirector'
msbuild `
-property:Configuration="$Configuration" `
-property:Platform=x64 `
'.\Redirector\Redirector.vcxproj'
if ( -Not $? ) { exit $lastExitCode }
Write-Host
Write-Host 'Building RouteHelper'
msbuild `
-property:Configuration="$Configuration" `
-property:Platform=x64 `
'.\RouteHelper\RouteHelper.vcxproj'
if ( -Not $? ) { exit $lastExitCode }
cp -Force '.\other\release\*.bin' "$OutputPath\bin"
cp -Force '.\other\release\*.exe' "$OutputPath\bin"
cp -Force '.\Redirector\bin\Redirector.bin' "$OutputPath\bin"
cp -Force '.\RouteHelper\bin\RouteHelper.bin' "$OutputPath\bin"
if ( $Configuration.Equals('Release') ) {
rm -Force "$OutputPath\*.pdb"
rm -Force "$OutputPath\*.xml"
}
Pop-Location
exit 0