-
Notifications
You must be signed in to change notification settings - Fork 83
/
make.ps1
114 lines (97 loc) · 2.33 KB
/
make.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
[CmdletBinding()]
Param(
[Parameter(Position=1)]
[String] $target = "package"
)
# # refers to the definition of a release target
# BRAND:=./branding/test.mk
# include ${BRAND}
# # refers to the definition of the release process execution environment
# BUILDENV:=./env/test.mk
# include ${BUILDENV}
# # refers to whereabouts of code-signing keys
# CREDENTIAL:=./credentials/test.mk
# include ${CREDENTIAL}
# include ./setup.mk
# PACKAGE_BUILDER_VERSION:=0.1
# #######################################################
# clean:
# rm -rf ${TARGET}
$global:msiDone = $false
$global:chocolateyDone = $false
function Setup() {
Get-ChildItem -Recurse -Include setup.ps1 -File | ForEach-Object {
Push-Location (Split-Path -Parent $_)
try {
& $_
} finally {
Pop-Location
}
}
}
function New-Msi() {
if(-not $global:msiDone) {
Push-Location ./msi/build
try {
& ./build.ps1
$global:msiDone = $true
} finally {
Pop-Location
}
}
}
function Publish-Msi() {
New-Msi
Push-Location ./msi/publish
try {
& ./publish.ps1
} finally {
Pop-Location
}
}
function New-Chocolatey() {
New-Msi
if(-not $global:chocolateyDone) {
Push-Location ./chocolatey/build
try {
& ./build.ps1
$global:chocolateyDone = $true
} finally {
Pop-Location
}
}
}
function Publish-Chocolatey() {
New-Chocolatey
Push-Location ./chocolatey/publish
try {
& ./publish.ps1
} finally {
Pop-Location
}
}
function Publish() {
@(
(Get-Item function:Publish-Msi)
) | ForEach-Object {
& $_
}
}
function New-Package() {
@(
(Get-Item function:New-Msi)
) | ForEach-Object {
Write-Host $_.Name.Replace("New-", "") -BackgroundColor 'White' -ForegroundColor 'Black'
& $_
Write-Host "`n`n"
}
}
Setup
switch -wildcard ($target) {
# release targets
"package" { New-Package }
"msi" { New-Msi }
"chocolatey" { New-Chocolatey }
"clean" { Clean }
default { Write-Error "No target '$target'" ; Exit -1 }
}