Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Commit

Permalink
Add psake build script that builds and runs tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed Feb 26, 2013
1 parent 6fd2b05 commit 70f4bd8
Show file tree
Hide file tree
Showing 13 changed files with 916 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -15,4 +15,4 @@ _ReSharper.*

# ignore NUnit output
tests/Logos.Utility.VisualState.xml
tests/TestResult.xml
TestResult.xml
9 changes: 9 additions & 0 deletions build.ps1
@@ -0,0 +1,9 @@
Task Default -depends Tests

Task Build {
Exec { msbuild /m:4 /property:Configuration=Release Logos.Utility.sln }
}

Task Tests -depends Build {
Exec { tools\NUnit\nunit-console.exe /nologo /framework=4.0 tests\Logos.Utility.nunit }
}
Binary file added tools/NUnit/lib/nunit-console-runner.dll
Binary file not shown.
Binary file added tools/NUnit/lib/nunit.core.dll
Binary file not shown.
Binary file added tools/NUnit/lib/nunit.core.interfaces.dll
Binary file not shown.
Binary file added tools/NUnit/lib/nunit.util.dll
Binary file not shown.
Binary file added tools/NUnit/nunit-agent.exe
Binary file not shown.
37 changes: 37 additions & 0 deletions tools/NUnit/nunit-agent.exe.config
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
The .NET 2.0 build of nunit-agent only
runs under .NET 2.0 or higher. The setting
useLegacyV2RuntimeActivationPolicy only applies
under .NET 4.0 and permits use of mixed mode
assemblies, which would otherwise not load
correctly.
-->
<startup useLegacyV2RuntimeActivationPolicy="true">
<!--
Nunit-agent is normally run by the console or gui
runners and not independently. In normal usage,
the runner specifies which runtime should be used.
Do NOT add any supportedRuntime elements here,
since they may prevent the runner from controlling
the runtime that is used!
-->
</startup>

<runtime>
<!-- Ensure that test exceptions don't crash NUnit -->
<legacyUnhandledExceptionPolicy enabled="1" />

<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
<loadFromRemoteSources enabled="true" />

<!-- Look for addins in the addins directory for now -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins"/>
</assemblyBinding>

</runtime>

</configuration>
Binary file added tools/NUnit/nunit-console.exe
Binary file not shown.
24 changes: 24 additions & 0 deletions tools/NUnit/nunit-console.exe.config
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
The .NET 2.0 build of the console runner only
runs under .NET 2.0 or higher. The setting
useLegacyV2RuntimeActivationPolicy only applies
under .NET 4.0 and permits use of mixed mode
assemblies, which would otherwise not load
correctly.
-->
<startup useLegacyV2RuntimeActivationPolicy="true">
<!-- Comment out the next line to force use of .NET 4.0 -->
</startup>
<runtime>
<!-- Ensure that test exceptions don't crash NUnit -->
<legacyUnhandledExceptionPolicy enabled="1"/>
<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
<loadFromRemoteSources enabled="true"/>
<!-- Look for addins in the addins directory for now -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins"/>
</assemblyBinding>
</runtime>
</configuration>
11 changes: 11 additions & 0 deletions tools/psake/psake.cmd
@@ -0,0 +1,11 @@
@echo off

if '%1'=='/?' goto help
if '%1'=='-help' goto help
if '%1'=='-h' goto help

powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' %*; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }"
exit /B %errorlevel%

:help
powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' -help"
51 changes: 51 additions & 0 deletions tools/psake/psake.ps1
@@ -0,0 +1,51 @@
# Helper script for those who want to run psake without importing the module.
# Example:
# .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0"

# Must match parameter definitions for psake.psm1/invoke-psake
# otherwise named parameter binding fails
param(
[Parameter(Position=0,Mandatory=0)]
[string]$buildFile = 'default.ps1',
[Parameter(Position=1,Mandatory=0)]
[string[]]$taskList = @(),
[Parameter(Position=2,Mandatory=0)]
[string]$framework,
[Parameter(Position=3,Mandatory=0)]
[switch]$docs = $false,
[Parameter(Position=4,Mandatory=0)]
[System.Collections.Hashtable]$parameters = @{},
[Parameter(Position=5, Mandatory=0)]
[System.Collections.Hashtable]$properties = @{},
[Parameter(Position=6, Mandatory=0)]
[alias("init")]
[scriptblock]$initialization = {},
[Parameter(Position=7, Mandatory=0)]
[switch]$nologo = $false,
[Parameter(Position=8, Mandatory=0)]
[switch]$help = $false,
[Parameter(Position=9, Mandatory=0)]
[string]$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path)
)

$currentThread = [System.Threading.Thread]::CurrentThread
$invariantCulture = [System.Globalization.CultureInfo]::InvariantCulture
$currentThread.CurrentCulture = $invariantCulture
$currentThread.CurrentUICulture = $invariantCulture

# '[p]sake' is the same as 'psake' but $Error is not polluted
remove-module [p]sake
import-module (join-path $scriptPath psake.psm1)
if ($help) {
Get-Help Invoke-psake -full
return
}

if (-not(test-path $buildFile)) {
$absoluteBuildFile = (join-path $scriptPath $buildFile)
if (test-path $absoluteBuildFile) {
$buildFile = $absoluteBuildFile
}
}

invoke-psake $buildFile $taskList $framework $docs $parameters $properties $initialization $nologo

0 comments on commit 70f4bd8

Please sign in to comment.