forked from fixie/fixie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.ps1
55 lines (45 loc) · 2.07 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
Framework '4.0'
properties {
$project = "Fixie"
$birthYear = 2013
$maintainers = "Patrick Lioi"
$description = "A convention-based test framework."
$configuration = 'Release'
$src = resolve-path '.\src'
$build = if ($env:build_number -ne $NULL) { $env:build_number } else { '0' }
$version = [IO.File]::ReadAllText('.\VERSION.txt') + '.' + $build
}
task default -depends Test
task Package -depends Test {
rd .\package -recurse -force -ErrorAction SilentlyContinue | out-null
mkdir .\package -ErrorAction SilentlyContinue | out-null
exec { & $src\.nuget\NuGet.exe pack $src\$project\$project.csproj -Symbols -Prop Configuration=$configuration -OutputDirectory .\package }
write-host
write-host "To publish these packages, issue the following command:"
write-host " nuget push .\package\$project.$version.nupkg"
}
task Test -depends Compile {
$fixieRunner = resolve-path ".\build\$project.Console.exe"
exec { & $fixieRunner $src\$project.Tests\bin\$configuration\$project.Tests.dll $src\$project.Samples\bin\$configuration\$project.Samples.dll }
}
task Compile -depends CommonAssemblyInfo {
rd .\build -recurse -force -ErrorAction SilentlyContinue | out-null
exec { msbuild /t:clean /v:q /nologo /p:Configuration=$configuration $src\$project.sln }
exec { msbuild /t:build /v:q /nologo /p:Configuration=$configuration $src\$project.sln }
}
task CommonAssemblyInfo {
$date = Get-Date
$year = $date.Year
$copyrightSpan = if ($year -eq $birthYear) { $year } else { "$birthYear-$year" }
$copyright = "Copyright (c) $copyrightSpan $maintainers"
"using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: AssemblyProduct(""$project"")]
[assembly: AssemblyVersion(""$version"")]
[assembly: AssemblyFileVersion(""$version"")]
[assembly: AssemblyCopyright(""$copyright"")]
[assembly: AssemblyCompany(""$maintainers"")]
[assembly: AssemblyDescription(""$description"")]
[assembly: AssemblyConfiguration(""$configuration"")]" | out-file "$src\CommonAssemblyInfo.cs" -encoding "ASCII"
}