forked from ayende/rhino-licensing
-
Notifications
You must be signed in to change notification settings - Fork 15
/
BuildAll.ps1
133 lines (115 loc) · 5.33 KB
/
BuildAll.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#requires -runasadministrator
$baseDir = Resolve-Path "$PSScriptRoot/.."
$ErrorActionPreference = 'Stop'
Write-Warning "BE AWARE THAT THIS SCRIPT IS CURRENTLY VERY SPECIFIC TO THE VERSIONS IT'S TARGETTING."
Write-Warning "IF YOU ARE TARGETING NEWER CHOCOLATEY COMPONENTS IT LIKELY NEEDS TO BE MODIFIED"
Write-Warning "PLEASE CANCEL WITH CTRL+C IF YOU DO NOT KNOW WHAT THIS WARNING MEANS"
Pause
$reposMissing = @(
'choco'
'choco-licensed'
'licensing-services'
'chocolatey-pro-server-simple'
'choco-licensed-management-ui'
'choco-licensed-services'
'ChocolateyGUI'
'chocolateygui-licensed'
) | Where-Object { -not (Test-Path -Path "$baseDir/$_" -PathType Container) }
if ($reposMissing.Count -gt 0) {
throw "Missing repositories: $reposMissing"
}
function check {
if ($LASTEXITCODE -ne 0) {
throw "Something didn't work building $args"
}
}
function copyNupkg {
param(
$Package,
[switch]
$CakeBuild,
$Base = $baseDir
)
$splat = @{
Path = if ($CakeBuild) {
"$Base/$Package/code_drop/Packages/Chocolatey/*.nupkg"
} else {
"$Base/$Package/code_drop/nuget/*.nupkg"
}
Destination = "C:\CodeDrops"
}
New-Item $splat.Destination -ErrorAction Ignore -ItemType Directory
Copy-Item @splat
}
$RhinoLicensingSource = "$baseDir/rhino-licensing"
$RhinoLicensingFiles = "$RhinoLicensingSource/code_drop/temp/_PublishedLibs/Rhino.Licensing"
$RhinoLicensingPackage = "$RhinoLicensingSource/code_drop/Packages/NuGet"
$ChocolateyFiles = "$baseDir/choco/code_drop/chocolatey/lib"
$ChocolateyLicensedFiles = "$baseDir/choco-licensed/code_drop/chocolateypro"
$ChocolateyGUIFiles = "$baseDir/ChocolateyGUI/code_drop/temp/_PublishedLibs"
try {
Push-Location $RhinoLicensingSource
./build.ps1
check Rhino.Licensing
Write-Host Chocolatey
Set-Location $baseDir/choco
Copy-Item "$RhinoLicensingFiles/net40/Rhino.Licensing.dll" "$baseDir/choco/lib/Rhino.Licensing.1.4.1/lib/net40/Rhino.Licensing.dll"
./build.bat
check Chocolatey CLI
copyNupkg -Package choco
Write-Host Chocolatey Licensed Extension
Set-Location $baseDir/choco-licensed
nuget restore src/chocolateypro.sln
Copy-Item "$RhinoLicensingFiles/net40/Rhino.Licensing.dll" "$baseDir/choco-licensed/lib/Rhino.Licensing.1.4.1/lib/net40/Rhino.Licensing.dll"
Copy-Item $ChocolateyFiles/chocolatey.dll "$baseDir/choco-licensed/src/packages/chocolatey.lib.1.0.0/lib/chocolatey.dll"
./build.bat
check Chocolatey Licensed Extension
copyNupkg -Package choco-licensed
Write-Host Licensing Services
Set-Location $baseDir/licensing-services
dotnet add source/LicensingServices.Core package Rhino.Licensing -v 1.6.0-cleanup -s $RhinoLicensingPackage
./build.ps1
check Licensing Services
copyNupkg -Package licensing-services -CakeBuild
Write-Host Simple Server Pro
Set-Location $baseDir/chocolatey-pro-server-simple
nuget restore src
Copy-Item $RhinoLicensingFiles "$baseDir/chocolatey-pro-server-simple/src/packages/Rhino.Licensing.1.5.0/lib" -Recurse -Force
./build.ps1
check Simple Server Pro
copyNupkg -Package chocolatey-pro-server-simple -CakeBuild
Write-Host Chocolatey Central Management
Set-Location $baseDir/choco-licensed-management-ui
dotnet restore ChocolateySoftware.ChocolateyManagement.sln
Copy-Item $RhinoLicensingFiles "$baseDir/choco-licensed-management-ui/src/packages/rhino.licensing/1.4.0/lib/" -Recurse -Force
./build.ps1
check Chocolatey Central Management
copyNupkg -Package .\choco-licensed-management-ui -CakeBuild
Write-Host Chocolatey Agent
Set-Location $baseDir/choco-licensed-services
nuget restore src
Copy-Item $ChocolateyFiles/chocolatey.dll "$baseDir/choco-licensed-services/src/packages/chocolatey.lib.1.0.0/lib/chocolatey.dll" -Recurse -Force
Copy-Item $ChocolateyLicensedFiles/chocolatey.licensed.dll "$baseDir/choco-licensed-services/src/packages/chocolatey-licensed.lib.4.0.0/lib/chocolatey.licensed.dll" -Recurse -Force
./build.bat
check Chocolatey Agent
copyNupkg -Package choco-licensed-services
Write-Host Chocolatey GUI
Set-Location $baseDir/ChocolateyGUI
nuget restore Source
Copy-Item $ChocolateyFiles/chocolatey.dll "$baseDir/ChocolateyGUI/Source/packages/chocolatey.lib.1.0.0/lib/chocolatey.dll" -Recurse -Force
./build.ps1
check Chocolatey GUI
copyNupkg -Package ChocolateyGUI -CakeBuild
Write-Host Chocolatey GUI - Licensed Extension
Set-Location $baseDir/chocolateygui-licensed
nuget restore Source
Copy-Item $ChocolateyFiles/chocolatey.dll "$baseDir/chocolateygui-licensed/Source/packages/chocolatey.lib.1.0.0/lib/chocolatey.dll" -Recurse -Force
Copy-Item $ChocolateyGUIFiles/ChocolateyGui.Common/ChocolateyGui.Common.dll "$baseDir/chocolateygui-licensed/Source/packages/ChocolateyGui.Common.1.0.0/lib/net48"
Copy-Item $ChocolateyGUIFiles/ChocolateyGui.Common.Windows/ChocolateyGui.Common.Windows.dll "$baseDir/chocolateygui-licensed/Source/packages/ChocolateyGui.Common.Windows.1.0.0/lib/net48"
./build.ps1
check Chocolatey GUI - Licensed Extension
copyNupkg -Package chocolateygui-licensed -CakeBuild
}
finally {
Pop-Location
}