Skip to content

Commit eefedeb

Browse files
committed
Merge pull request #35 from jordangray/master
Issue #18: added psake build script
2 parents 2fc3bf8 + 7be1a4e commit eefedeb

File tree

4 files changed

+901
-0
lines changed

4 files changed

+901
-0
lines changed

build.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
echo off
2+
.\tools\psake\psake.bat %*

tools/psake/default.ps1

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Properties {
2+
$base_dir = resolve-path .\..\..\
3+
$packages_dir = "$base_dir\packages"
4+
$build_artifacts_dir = "$base_dir\build"
5+
$solution_name = "$base_dir\WebApiContrib.Formatting.Xlsx.sln"
6+
$test_dll = "$build_artifacts_dir\WebApiContrib.Formatting.Xlsx.Tests.dll"
7+
$nuget_exe = "$base_dir\.nuget\Nuget.exe"
8+
$test_result_path = "$base_dir\TestResults\"
9+
$test_result_file = [System.IO.Path]::Combine($test_result_path, "TestResults.trx")
10+
$vscomntools_path = VSCommonToolsPath
11+
$mstest_path = (Get-Item $vscomntools_path).Parent.FullName
12+
$mstest_exe = [System.IO.Path]::Combine($mstest_path, "IDE\MSTest.exe")
13+
}
14+
15+
Task Default -Depends BuildWebApiContrib, RunUnitTests, NuGetBuild
16+
17+
Task BuildWebApiContrib -Depends Clean, Build
18+
19+
Task Clean {
20+
Exec { msbuild $solution_name /v:Quiet /t:Clean /p:Configuration=Release }
21+
}
22+
23+
Task Build -depends Clean {
24+
Exec { msbuild $solution_name /v:Quiet /t:Build /p:Configuration=Release /p:OutDir=$build_artifacts_dir\ }
25+
}
26+
27+
Task NuGetBuild -depends Clean {
28+
& $nuget_exe pack "$base_dir/src/WebApiContrib.Formatting.Xlsx/WebApiContrib.Formatting.Xlsx.csproj" -Build -OutputDirectory $build_artifacts_dir -Verbose -Properties Configuration=Release
29+
}
30+
31+
Task RunUnitTests -depends Build {
32+
$test_arguments = @("/resultsFile:$test_result_file")
33+
$test_arguments += "/testcontainer:$test_dll"
34+
35+
If (Test-Path $test_result_file) { Remove-Item $test_result_file }
36+
37+
# psake will terminate the execution if mstest throws an exception.
38+
Exec { & $mstest_exe $test_arguments }
39+
}
40+
41+
# Find VS Common Tools directory path for the most recent version of Visual Studio.
42+
Function VSCommonToolsPath {
43+
If (Test-Path Env:VS150COMNTOOLS) { Return (Get-ChildItem env:VS150COMNTOOLS).Value }
44+
If (Test-Path Env:VS140COMNTOOLS) { Return (Get-ChildItem env:VS140COMNTOOLS).Value }
45+
If (Test-Path Env:VS130COMNTOOLS) { Return (Get-ChildItem env:VS130COMNTOOLS).Value }
46+
If (Test-Path Env:VS120COMNTOOLS) { Return (Get-ChildItem env:VS120COMNTOOLS).Value }
47+
If (Test-Path Env:VS110COMNTOOLS) { Return (Get-ChildItem env:VS110COMNTOOLS).Value }
48+
If (Test-Path Env:VS100COMNTOOLS) { Return (Get-ChildItem env:VS100COMNTOOLS).Value }
49+
If (Test-Path Env:VS90COMNTOOLS ) { Return (Get-ChildItem env:VS90COMNTOOLS).Value }
50+
If (Test-Path Env:VS80COMNTOOLS ) { Return (Get-ChildItem env:VS80COMNTOOLS).Value }
51+
}

tools/psake/psake.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "& {Import-Module '.\tools\psake\psake.psm1'; invoke-psake .\tools\psake\default.ps1 %1 -parameters @{"version"="'%2'";"appPrefix"="'%3'";"filePath"="'%4'"}; if ($lastexitcode -ne 0) {write-host "ERROR: $lastexitcode" -fore RED; exit $lastexitcode} }"

0 commit comments

Comments
 (0)