forked from DSharpPlus/DSharpPlus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rebuild-all.ps1
executable file
·96 lines (82 loc) · 2.43 KB
/
rebuild-all.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
93
94
95
96
#!/usr/bin/env pwsh
# Rebuild-all
#
# Rebuilds the DSharpPlus project and its documentation, and places artifacts in specified directories.
# Not specifying documentation options will skip documentation build.
#
# Author: Emzi0767
# Version: 2018-08-30 14:41
#
# Arguments:
# .\rebuild-all.ps1 <output path> <configuration> [version suffix] [build-number] [docs output path] [docs package name]
#
# Run as:
# .\rebuild-all.ps1 .\path\to\artifact\location Debug/Release version-suffix build-number .\path\to\docs\output project-docs
param
(
[parameter(Mandatory = $true)]
[string] $ArtifactLocation,
[parameter(Mandatory = $true)]
[string] $Configuration,
[parameter(Mandatory = $false)]
[string] $VersionSuffix,
[parameter(Mandatory = $false)]
[int] $BuildNumber = -1,
[parameter(Mandatory = $false)]
[string] $DocsPath,
[parameter(Mandatory = $false)]
[string] $DocsPackageName
)
# Check if configuration is valid
if ($Configuration -ne "Debug" -and $Configuration -ne "Release")
{
Write-Host "Invalid configuration specified. Must be Release or Debug."
Exit 1
}
# Check if we have a version prefix
if (-not $VersionSuffix)
{
# Nope
Write-Host "Building production packages"
# Invoke the build script
& .\rebuild-lib.ps1 -ArtifactLocation "$ArtifactLocation" -Configuration "$Configuration" | Out-Host
}
else
{
# Yup
Write-Host "Building pre-production packages"
# Check if numeric suffix
if (-not $BuildNumber -or $BuildNumber -lt 0)
{
$BuildNumber = -1
}
# Invoke the build script
& .\rebuild-lib.ps1 -ArtifactLocation "$ArtifactLocation" -Configuration "$Configuration" -VersionSuffix "$VersionSuffix" -BuildNumber $BuildNumber | Out-Host
}
# Check if it failed
if ($LastExitCode -ne 0)
{
Write-Host "Build failed with code $LastExitCode"
$host.SetShouldExit($LastExitCode)
Exit $LastExitCode
}
# Check if we're building docs
if ($DocsPath -and $DocsPackageName)
{
# Yup
Write-Host "Building documentation"
& .\rebuild-docs.ps1 -DocsPath "$DocsPath" -OutputPath "$ArtifactLocation" -PackageName "$DocsPackageName"
# Check if it failed
if ($LastExitCode -ne 0)
{
Write-Host "Documentation build failed with code $LastExitCode"
$host.SetShouldExit($LastExitCode)
Exit $LastExitCode
}
}
else
{
# Nope
Write-Host "Not building documentation"
}
Exit 0