forked from dotless/dotless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.ps1
289 lines (253 loc) · 10.1 KB
/
default.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# This script was derived from the Rhino.Mocks buildscript written by Ayende Rahien.
include .\psake_ext.ps1
properties {
$config = 'debug'
$showtestresult = $FALSE
$base_dir = resolve-path .
$lib_dir = "$base_dir\lib\"
$build_dir = "$base_dir\build\"
$release_dir = "$base_dir\release\"
$source_dir = "$base_dir\src"
$version = Get-Git-Version
}
task default -depends Release
task Clean {
remove-item -force -recurse $build_dir -ErrorAction SilentlyContinue
remove-item -force -recurse $release_dir -ErrorAction SilentlyContinue
}
task Init -depends Clean {
$product = "dotless"
$title = "$product $version"
$description = "Dynamic CSS for .net"
$company = "$product project"
$copyright = "Copyright © $product 2010-2012"
$authors = "Daniel Hölbling, James Foster, Luke Page"
$nugetDescription = "This is a project to port the hugely useful Less libary to the .NET world. It give variables, nested rules and operators to CSS.
For more information about the original Less project see http://lesscss.org/ or http://github.com/dotless/dotless. For more information about how to get started with the .NET version see http://www.dotlesscss.org/.";
$nugetDotless = $nugetDescription + "
For the client only dll on its own, see the DotlessClientOnly package.";
$nugetDotlessClientOnly = "This package only contains the dot net client only dll. You should only use this package if you do not want any ASP.net functionality.
" + $nugetDescription;
Write-Host $version
new-item $build_dir -itemType directory
Generate-NuGet `
-file "$build_dir\Dotless.nuspec" `
-id "dotless" `
-version $version `
-authors $authors `
-description $nugetDotless
Generate-NuGet `
-file "$build_dir\DotlessClientOnly.nuspec" `
-id "DotlessClientOnly" `
-version $version `
-authors $authors `
-description $nugetDotlessClientOnly
Generate-Assembly-Info `
-file "$source_dir\dotless.Core\Properties\AssemblyInfo.cs" `
-title $title `
-description $description `
-company $company `
-product $product `
-version $version `
-copyright $copyright `
-partial $True
Generate-Assembly-Info `
-file "$source_dir\dotless.Test\Properties\AssemblyInfo.cs" `
-title $title `
-description $description `
-company $company `
-product $product `
-version $version `
-copyright $copyright
Generate-Assembly-Info `
-file "$source_dir\dotless.Compiler\Properties\AssemblyInfo.cs" `
-title $title `
-description $description `
-company $company `
-product $product `
-version $version `
-copyright $copyright
Generate-Assembly-Info `
-file "$source_dir\dotless.AspNet\Properties\AssemblyInfo.cs" `
-title $title `
-description $description `
-company $company `
-product $product `
-version $version `
-copyright $copyright
new-item $release_dir -itemType directory
}
task Build -depends Init {
$buildSettings = (
($source_dir + '\dotless.Compiler\dotless.Compiler.csproj'),
('/p:Configuration=' + $config),
('/p:OutDir=' + $build_dir + '\')
)
msbuild $buildSettings
if ($lastExitCode -ne 0) {
throw "Error: compile failed"
}
}
task Test -depends Build {
$buildSettings = (
($source_dir + '\dotless.Test\dotless.Test.csproj'),
('/p:Configuration=' + $config),
('/p:OutDir=' + $build_dir + '\')
)
msbuild $buildSettings
if ($lastExitCode -ne 0) {
throw "Error: Test compile failed"
}
$old = pwd
cd $build_dir
& $lib_dir\NUnit\nunit-console-x86.exe $build_dir\dotless.Test.dll
if ($lastExitCode -ne 0) {
throw "Error: Failed to execute tests"
if ($showtestresult)
{
start $build_dir\TestResult.xml
}
}
cd $old
}
task Merge -depends Build {
$old = pwd
cd $build_dir
$filename = "dotless.Compiler.exe"
Remove-Item $filename-partial.exe -ErrorAction SilentlyContinue
Rename-Item $filename $filename-partial.exe
write-host "Executing ILMerge - Creating Exe"
& $lib_dir\ilmerge\ILMerge.exe $filename-partial.exe `
Pandora.dll `
dotless.Core.dll `
Microsoft.Practices.ServiceLocation.dll `
/out:$filename `
/internalize `
/keyfile:../src/dotless-open-source.snk `
/t:exe
if ($lastExitCode -ne 0) {
throw "Error: Failed to merge compiler assemblies"
}
Remove-Item $filename-partial.exe -ErrorAction SilentlyContinue
$filename = "dotless.Core.dll"
Remove-Item $filename-partial.dll -ErrorAction SilentlyContinue
Rename-Item $filename $filename-partial.dll
write-host "Executing ILMerge - Creating Core including AspNet"
& $lib_dir\ilmerge\ILMerge.exe $filename-partial.dll `
Pandora.dll `
Microsoft.Practices.ServiceLocation.dll `
dotless.AspNet.dll `
/out:$filename `
/internalize:../src/internalize-exclusion-list.txt `
/keyfile:../src/dotless-open-source.snk `
/t:library
if ($lastExitCode -ne 0) {
throw "Error: Failed to merge assemblies"
}
$compilerfilename = "dotless.ClientOnly.dll"
write-host "Executing ILMerge - Creating Client Only Dll"
& $lib_dir\ilmerge\ILMerge.exe $filename-partial.dll `
Pandora.dll `
Microsoft.Practices.ServiceLocation.dll `
/out:$compilerfilename `
/internalize:../src/internalize-exclusion-list.txt `
/keyfile:../src/dotless-open-source.snk `
/t:library
if ($lastExitCode -ne 0) {
throw "Error: Failed to merge assemblies"
}
Remove-Item $filename-partial.dll -ErrorAction SilentlyContinue
cd $old
}
task Release-NoTest -depends Merge {
$commit = Get-Git-Commit
$filename = "dotless.core"
& $lib_dir\7zip\7za.exe a $release_dir\dotless-$commit.zip `
$build_dir\$filename.dll `
$build_dir\$filename.pdb `
$build_dir\dotless.compiler.exe `
acknowledgements.txt `
license.txt `
#$build_dir\Testresult.xml `
Write-Host -ForegroundColor Yellow "Please note that no tests where run during release process!"
Write-host "-----------------------------"
Write-Host "dotless $version was successfully compiled and packaged."
Write-Host "The release bits can be found in ""$release_dir"""
Write-Host -ForegroundColor Cyan "Thank you for using dotless!"
}
task t4css -depends Merge {
$commit = Get-Git-Commit
$dir = pwd
$target = "$build_dir\t4css"
echo "bla"
mkdir $build_dir\t4css -ErrorAction silentlycontinue
mkdir $build_dir\t4css\T4CssWeb -ErrorAction silentlycontinue
mkdir $build_dir\t4css\T4CssWeb\Css -ErrorAction silentlycontinue
cp $build_dir\dotless.Core.dll $target\dotless.Core.dll
cp $dir\t4less\T4Css.sln $target\T4Css.sln
cp $dir\t4less\T4CssWeb\T4CssWeb.csproj $target\T4CssWeb\T4CssWeb.csproj
cp $dir\t4less\T4CssWeb\Css\T4CSS.tt $target\T4CssWeb\Css\T4CSS.tt
cp $dir\t4less\T4CssWeb\Css\*.less $target\T4CssWeb\Css\
cp $dir\t4less\T4CssWeb\Css\*.css $target\T4CssWeb\Css\
cp $dir\t4less\T4CssWeb\Css\*.log $target\T4CssWeb\Css\
& $lib_dir\7zip\7za.exe a $release_dir\t4css-$commit.zip `
$build_dir\t4css\
}
task Gem -depends Merge {
$target = "$base_dir\gems"
remove-item -force -recurse $target\lib -ErrorAction SilentlyContinue
new-item $target\lib -itemType directory
remove-item -force -recurse $target\bin\ -ErrorAction SilentlyContinue
new-item $target\bin -itemType directory
remove-item $target\VERSION -ErrorAction SilentlyContinue
cp $build_dir\dotless.Core.dll $target\lib\dotless.Core.dll
cp $build_dir\dotless.Compiler.exe $target\bin\dotless.Compiler.exe
$fileContent = "result = system(File.dirname(__FILE__) + ""/dotless.Compiler.exe "" + ARGV.join(' '))
exit 1 unless result"
out-file -filePath $target\bin\dotless -encoding ascii -inputObject $fileContent
out-file -filePath $target\VERSION -encoding ascii -inputObject $version
cd $target
gem build dotless.gemspec
}
task Release -depends Test, Merge, NuGetPackage, NuGetClientOnlyPackage, t4css {
$commit = Get-Git-Commit
$filename = "dotless.core"
& $lib_dir\7zip\7za.exe a $release_dir\dotless-$commit.zip `
$build_dir\$filename.dll `
$build_dir\$filename.pdb `
$build_dir\Testresult.xml `
$build_dir\dotless.compiler.exe `
acknowledgements.txt `
license.txt `
Move-Item $build_dir\*.nupkg $release_dir\
Write-host "-----------------------------"
Write-Host "dotless $version was successfully compiled and packaged."
Write-Host "The release bits can be found in ""$release_dir"""
Write-Host -ForegroundColor Cyan "Thank you for using dotless!"
}
task NuGetPackage -depends Merge {
$target = "$build_dir\NuGet\"
remove-item -force -recurse $target -ErrorAction SilentlyContinue
New-Item $target -ItemType directory
New-Item $target\lib -ItemType directory
New-Item $target\tool -ItemType directory
New-Item $target\content -ItemType directory
Copy-Item $build_dir\Dotless.nuspec $target
Copy-Item $source_dir\web.config.transform $target\content\
Copy-Item $build_dir\dotless.Core.dll $target\lib\
Copy-Item $build_dir\dotless.compiler.exe $target\tool\
Copy-Item acknowledgements.txt $target
Copy-Item license.txt $target
.\lib\NuGet.exe pack $target\Dotless.nuspec -o $build_dir
}
task NuGetClientOnlyPackage -depends Merge {
$target = "$build_dir\NuGetClientOnly\"
remove-item -force -recurse $target -ErrorAction SilentlyContinue
New-Item $target -ItemType directory
New-Item $target\lib -ItemType directory
Copy-Item $build_dir\DotlessClientOnly.nuspec $target
Copy-Item $build_dir\dotless.ClientOnly.dll $target\lib\
Copy-Item acknowledgements.txt $target
Copy-Item license.txt $target
.\lib\NuGet.exe pack $target\DotlessClientOnly.nuspec -o $build_dir
}