forked from MindscapeHQ/raygun4net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.ps1
216 lines (203 loc) · 11.6 KB
/
package.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
properties {
$root = $psake.build_script_dir
$nuspec_net35 = "$root\Mindscape.Raygun4Net.nuspec"
$nuspec_net35_signed = "$root\Mindscape.Raygun4Net.signed.nuspec"
$nuspec_core = "$root\Mindscape.Raygun4Net.Core.nuspec"
$nuspec_core_signed = "$root\Mindscape.Raygun4Net.Core.Signed.nuspec"
$nuspec_mvc = "$root\Mindscape.Raygun4Net.Mvc.nuspec"
$nuspec_mvc_signed = "$root\Mindscape.Raygun4Net.Mvc.Signed.nuspec"
$nuspec_webapi = "$root\Mindscape.Raygun4Net.WebApi.nuspec"
$nuspec_webapi_signed = "$root\Mindscape.Raygun4Net.WebApi.Signed.nuspec"
$nuspec_webjob = "$root\Mindscape.Raygun4Net.Azure.WebJob.nuspec"
$build_dir = "$root\build\"
$build_dir_net2 = "$build_dir\net20"
$build_dir_net35 = "$build_dir\net35"
$build_dir_net35_client = "$build_dir\net35-client"
$build_dir_net4 = "$build_dir\net40"
$build_dir_net4_client = "$build_dir\net40-client"
$build_dir_mvc = "$build_dir\mvc"
$build_dir_webapi = "$build_dir\webapi"
$build_dir_webjob = "$build_dir\webjob"
$build_dir_winrt = "$build_dir\winrt"
$build_dir_uwp = "$build_dir\uwp"
$build_dir_windowsphone = "$build_dir\windowsphone"
$build_dir_signed = "$build_dir\signed"
$build_dir_net2_signed = "$build_dir_signed\net20"
$build_dir_net35_signed = "$build_dir_signed\net35"
$build_dir_net35_client_signed = "$build_dir_signed\net35-client"
$build_dir_net4_signed = "$build_dir_signed\net40"
$build_dir_net4_client_signed = "$build_dir_signed\net40-client"
$build_dir_mvc_signed = "$build_dir_signed\mvc"
$build_dir_webapi_signed = "$build_dir_signed\webapi"
$build_dir_winrt_signed = "$build_dir_signed\winrt"
$build_dir_uwp_signed = "$build_dir_signed\uwp"
$release_dir = "$root\release\"
$nuget_dir = "$root\.nuget"
$env:Path += ";$nuget_dir"
}
task default -depends Zip
task Clean {
remove-item -force -recurse $release_dir -ErrorAction SilentlyContinue | Out-Null
}
task Init -depends Clean {
new-item $release_dir -itemType directory | Out-Null
}
task Package -depends Init {
exec { nuget pack $nuspec_net35 -OutputDirectory $release_dir }
exec { nuget pack $nuspec_net35_signed -OutputDirectory $release_dir }
exec { nuget pack $nuspec_core -OutputDirectory $release_dir }
exec { nuget pack $nuspec_core_signed -OutputDirectory $release_dir }
exec { nuget pack $nuspec_mvc -OutputDirectory $release_dir }
exec { nuget pack $nuspec_mvc_signed -OutputDirectory $release_dir }
exec { nuget pack $nuspec_webapi -OutputDirectory $release_dir }
exec { nuget pack $nuspec_webapi_signed -OutputDirectory $release_dir }
exec { nuget pack $nuspec_webjob -OutputDirectory $release_dir }
}
task Zip -depends Package {
$release = Get-ChildItem $release_dir | Select-Object -f 1
$nupkg_name = $release.Name
$nupkg_name = $nupkg_name -replace "Mindscape.Raygun4Net.", "v"
$version = $nupkg_name -replace ".nupkg", ""
$outerfolder = $release_dir + $version
$versionfolder = $outerfolder + "\" + $version
$versionfolder2 = $versionfolder + "\net20"
$versionfolder35 = $versionfolder + "\net35"
$versionfolder35client = $versionfolder + "\net35-client"
$versionfolder4 = $versionfolder + "\net40"
$versionfolder4client = $versionfolder + "\net40-client"
$versionfoldermvc = $versionfolder + "\mvc"
$versionfolderwebapi = $versionfolder + "\webapi"
$versionfolderwebjob = $versionfolder + "\webjob"
$versionfolderwinrt = $versionfolder + "\winrt"
$versionfolderuwp = $versionfolder + "\uwp"
$versionfolderwindowsphone = $versionfolder + "\windowsphone"
$signedfolder = $versionfolder + "\signed"
$signedfolder2 = $signedfolder + "\net20"
$signedfolder35 = $signedfolder + "\net35"
$signedfolder35client = $signedfolder + "\net35-client"
$signedfolder4 = $signedfolder + "\net40"
$signedfolder4client = $signedfolder + "\net40-client"
$signedfoldermvc = $signedfolder + "\mvc"
$signedfolderwebapi = $signedfolder + "\webapi"
$signedfolderwinrt = $signedfolder + "\winrt"
$signedfolderuwp = $signedfolder + "\uwp"
new-item $versionfolder -itemType directory | Out-Null
new-item $versionfolder2 -itemType directory | Out-Null
new-item $versionfolder35 -itemType directory | Out-Null
new-item $versionfolder35client -itemType directory | Out-Null
new-item $versionfolder4 -itemType directory | Out-Null
new-item $versionfolder4client -itemType directory | Out-Null
new-item $versionfoldermvc -itemType directory | Out-Null
new-item $versionfolderwebapi -itemType directory | Out-Null
new-item $versionfolderwebjob -itemType directory | Out-Null
new-item $versionfolderwinrt -itemType directory | Out-Null
new-item $versionfolderuwp -itemType directory | Out-Null
new-item $versionfolderwindowsphone -itemType directory | Out-Null
new-item $signedfolder -itemType directory | Out-Null
new-item $signedfolder2 -itemType directory | Out-Null
new-item $signedfolder35 -itemType directory | Out-Null
new-item $signedfolder35client -itemType directory | Out-Null
new-item $signedfolder4 -itemType directory | Out-Null
new-item $signedfolder4client -itemType directory | Out-Null
new-item $signedfoldermvc -itemType directory | Out-Null
new-item $signedfolderwebapi -itemType directory | Out-Null
new-item $signedfolderwinrt -itemType directory | Out-Null
new-item $signedfolderuwp -itemType directory | Out-Null
# .NET 2.0
copy-item $build_dir_net2/Mindscape.Raygun4Net.dll $versionfolder2
copy-item $build_dir_net2/Mindscape.Raygun4Net.pdb $versionfolder2
# .NET 3.5
copy-item $build_dir_net35/Mindscape.Raygun4Net.dll $versionfolder35
copy-item $build_dir_net35/Mindscape.Raygun4Net.pdb $versionfolder35
# .NET 3.5 Client Profile
copy-item $build_dir_net35_client/Mindscape.Raygun4Net.dll $versionfolder35client
copy-item $build_dir_net35_client/Mindscape.Raygun4Net.pdb $versionfolder35client
# .NET 4.0
copy-item $build_dir_net4/Mindscape.Raygun4Net.dll $versionfolder4
copy-item $build_dir_net4/Mindscape.Raygun4Net.pdb $versionfolder4
copy-item $build_dir_net4/Mindscape.Raygun4Net4.dll $versionfolder4
copy-item $build_dir_net4/Mindscape.Raygun4Net4.pdb $versionfolder4
# .NET 4.0 Client Profile
copy-item $build_dir_net4_client/Mindscape.Raygun4Net.dll $versionfolder4client
copy-item $build_dir_net4_client/Mindscape.Raygun4Net.pdb $versionfolder4client
# .NET MVC
copy-item $build_dir_mvc/Mindscape.Raygun4Net.dll $versionfoldermvc
copy-item $build_dir_mvc/Mindscape.Raygun4Net.pdb $versionfoldermvc
copy-item $build_dir_mvc/Mindscape.Raygun4Net.Mvc.dll $versionfoldermvc
copy-item $build_dir_mvc/Mindscape.Raygun4Net.Mvc.pdb $versionfoldermvc
copy-item $build_dir_mvc/Mindscape.Raygun4Net4.dll $versionfoldermvc
copy-item $build_dir_mvc/Mindscape.Raygun4Net4.pdb $versionfoldermvc
# .NET WebApi
copy-item $build_dir_webapi/Mindscape.Raygun4Net.WebApi.dll $versionfolderwebapi
copy-item $build_dir_webapi/Mindscape.Raygun4Net.WebApi.pdb $versionfolderwebapi
copy-item $build_dir_webapi/Mindscape.Raygun4Net.dll $versionfolderwebapi
copy-item $build_dir_webapi/Mindscape.Raygun4Net.pdb $versionfolderwebapi
# Azure WebJob
copy-item $build_dir_webjob/Mindscape.Raygun4Net.dll $versionfolderwebjob
copy-item $build_dir_webjob/Mindscape.Raygun4Net.pdb $versionfolderwebjob
copy-item $build_dir_webjob/Mindscape.Raygun4Net.Azure.WebJob.dll $versionfolderwebjob
copy-item $build_dir_webjob/Mindscape.Raygun4Net.Azure.WebJob.pdb $versionfolderwebjob
# WinRT
copy-item $build_dir_winrt/Mindscape.Raygun4Net.WinRT.dll $versionfolderwinrt
copy-item $build_dir_winrt/Mindscape.Raygun4Net.WinRT.pdb $versionfolderwinrt
# Windows Store
copy-item $build_dir_uwp/Mindscape.Raygun4Net.WindowsStore.dll $versionfolderuwp
copy-item $build_dir_uwp/Mindscape.Raygun4Net.WindowsStore.pdb $versionfolderuwp
# Windows Phone
copy-item $build_dir_windowsphone/Mindscape.Raygun4Net.WindowsPhone.dll $versionfolderwindowsphone
copy-item $build_dir_windowsphone/Mindscape.Raygun4Net.WindowsPhone.pdb $versionfolderwindowsphone
# Signed .NET 2
copy-item $build_dir_net2_signed/Mindscape.Raygun4Net.dll $signedfolder2
copy-item $build_dir_net2_signed/Mindscape.Raygun4Net.pdb $signedfolder2
# Signed .NET 3.5
copy-item $build_dir_net35_signed/Mindscape.Raygun4Net.dll $signedfolder35
copy-item $build_dir_net35_signed/Mindscape.Raygun4Net.pdb $signedfolder35
# Signed .NET 3.5 Client Profile
copy-item $build_dir_net35_client_signed/Mindscape.Raygun4Net.dll $signedfolder35client
copy-item $build_dir_net35_client_signed/Mindscape.Raygun4Net.pdb $signedfolder35client
# Signed .NET 4
copy-item $build_dir_net4_signed/Mindscape.Raygun4Net.dll $signedfolder4
copy-item $build_dir_net4_signed/Mindscape.Raygun4Net.pdb $signedfolder4
copy-item $build_dir_net4_signed/Mindscape.Raygun4Net4.dll $signedfolder4
copy-item $build_dir_net4_signed/Mindscape.Raygun4Net4.pdb $signedfolder4
# Signed .NET 4 Client Profile
copy-item $build_dir_net4_client_signed/Mindscape.Raygun4Net.dll $signedfolder4client
copy-item $build_dir_net4_client_signed/Mindscape.Raygun4Net.pdb $signedfolder4client
# Signed MVC
copy-item $build_dir_mvc_signed/Mindscape.Raygun4Net.dll $signedfoldermvc
copy-item $build_dir_mvc_signed/Mindscape.Raygun4Net.pdb $signedfoldermvc
copy-item $build_dir_mvc_signed/Mindscape.Raygun4Net.Mvc.dll $signedfoldermvc
copy-item $build_dir_mvc_signed/Mindscape.Raygun4Net.Mvc.pdb $signedfoldermvc
copy-item $build_dir_mvc_signed/Mindscape.Raygun4Net4.dll $signedfoldermvc
copy-item $build_dir_mvc_signed/Mindscape.Raygun4Net4.pdb $signedfoldermvc
#Signed WebApi
copy-item $build_dir_webapi_signed/Mindscape.Raygun4Net.WebApi.dll $signedfolderwebapi
copy-item $build_dir_webapi_signed/Mindscape.Raygun4Net.WebApi.pdb $signedfolderwebapi
copy-item $build_dir_webapi_signed/Mindscape.Raygun4Net.dll $signedfolderwebapi
copy-item $build_dir_webapi_signed/Mindscape.Raygun4Net.pdb $signedfolderwebapi
# Signed WinRT
copy-item $build_dir_winrt_signed/Mindscape.Raygun4Net.WinRT.dll $signedfolderwinrt
copy-item $build_dir_winrt_signed/Mindscape.Raygun4Net.WinRT.pdb $signedfolderwinrt
# Signed UWP
copy-item $build_dir_uwp_signed/Mindscape.Raygun4Net.WindowsStore.dll $signedfolderuwp
$zipFullName = $release_dir + $version + ".zip"
Get-ChildItem $outerfolder | Add-Zip $zipFullName
}
function Add-Zip # usage: Get-ChildItem $folder | Add-Zip $zipFullName
{
param([string]$zipfilename)
if(!(test-path($zipfilename)))
{
set-content $zipfilename ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
(dir $zipfilename).IsReadOnly = $false
}
$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($zipfilename)
foreach($file in $input)
{
$zipPackage.CopyHere($file.FullName)
do {
Start-sleep 2
} until ( $zipPackage.Items() | select {$_.Name -eq $file.Name} )
}
}