forked from dotless/dotless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.ps1
193 lines (170 loc) · 6.62 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
# 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 {
Write-Host $version
Generate-Assembly-Info `
-file "$source_dir\dotless.Core\Properties\AssemblyInfo.cs" `
-title "dotless $version" `
-description "Dynamic CSS for .net" `
-company "dotless project" `
-product "dotless" `
-version $version `
-copyright "Copyright © dotless project 2010" `
-partial $True
Generate-Assembly-Info `
-file "$source_dir\dotless.Test\Properties\AssemblyInfo.cs" `
-title "dotless Tests $version" `
-description "Dynamic CSS for .net" `
-company "dotless project" `
-product "dotless" `
-version $version `
-copyright "Copyright © dotless project 2010"
Generate-Assembly-Info `
-file "$source_dir\dotless.Compiler\Properties\AssemblyInfo.cs" `
-title "dotless Compiler $version" `
-description "Dynamic CSS for .net" `
-company "dotless project" `
-product "dotless" `
-version $version `
-copyright "Copyright © dotless project 2010"
new-item $build_dir -itemType directory
new-item $release_dir -itemType directory
}
task Build -depends Init {
msbuild $source_dir\dotless.Compiler\dotless.Compiler.csproj /p:OutDir=$build_dir /p:Configuration=$config
if ($lastExitCode -ne 0) {
throw "Error: compile failed"
}
}
task Test -depends Build {
msbuild $source_dir\dotless.Test\dotless.Test.csproj /p:OutDir=$build_dir /p:Configuration=$config
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
& $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"
& $lib_dir\ilmerge\ILMerge.exe $filename-partial.dll `
Pandora.dll `
Microsoft.Practices.ServiceLocation.dll `
/out:$filename `
/internalize `
/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, 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 `
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!"
}