forked from DSharpPlus/DSharpPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rebuild-all.ps1
72 lines (63 loc) · 1.73 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
# 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: 2017-09-11 14:20
#
# Arguments:
# .\rebuild-docs.ps1 <output path> <version suffix> [path to docfx] [output path] [docs project path]
#
# Run as:
# .\rebuild-lib.ps1 .\path\to\artifact\location version-suffix .\path\to\docfx\project .\path\to\output project-docs
param
(
[parameter(Mandatory = $true)]
[string] $ArtifactLocation,
[parameter(Mandatory = $false)]
[string] $VersionSuffix,
[parameter(Mandatory = $false)]
[string] $DocsPath,
[parameter(Mandatory = $false)]
[string] $DocsPackageName
)
# Check if we have a version prefix
if (-not $VersionSuffix)
{
# Nope
Write-Host "Building production packages"
}
else
{
# Yup
Write-Host "Building beta packages"
}
# Invoke the build script
& .\rebuild-lib.ps1 -artifactlocation "$ArtifactLocation" -versionsuffix "$VersionSuffix" | 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"
}