Skip to content

Commit

Permalink
Updating build script to regain old CM.NET stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bbyars committed Jun 30, 2012
2 parents d9be7a6 + 319de2e commit a7c244e
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 14 deletions.
2 changes: 1 addition & 1 deletion RestMvc.Example.nuspec
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>RestMvc.Example</id>
<version>1.0.0</version>
<title>Mvc.Example</title>
<title>RestMvc.Example</title>
<description>An example website using RestMvc</description>
<tags>mvc</tags>
<authors>Brandon Byars</authors>
Expand Down
16 changes: 16 additions & 0 deletions RestMvc.FunctionalTests.nuspec
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>RestMvc.FunctionalTests</id>
<version>1.0.0</version>
<title>RestMvc.FunctionalTests</title>
<description>Functional test suite for RestMvc</description>
<tags>mvc</tags>
<authors>Brandon Byars</authors>
<projectUrl>https://github.com/bbyars/RestMvc</projectUrl>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
</metadata>
<files>
<file src="RestMvc.FunctionalTests\bin\Release\*.dll" target="content" />
</files>
</package>
17 changes: 17 additions & 0 deletions RestMvc.nuspec
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>RestMvc</id>
<version>1.0.0</version>
<title>RestMvc</title>
<description>Restful awesomeness for ASP.NET MVC</description>
<tags>mvc</tags>
<authors>Brandon Byars</authors>
<projectUrl>https://github.com/bbyars/RestMvc</projectUrl>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
</metadata>
<files>
<file src="RestMvc\bin\Release\*.dll" target="content" />
<file src="RestMvc\bin\Release\*.xml" target="" />
</files>
</package>
49 changes: 36 additions & 13 deletions build.ps1
@@ -1,37 +1,60 @@
properties {
$solutionFile = (Resolve-Path $rootDir\*.sln)
$rootDir = $pwd
$solutionFile = (Resolve-Path $rootDir\*.sln)
$buildDir = "$rootDir\build"
$version = '1.0.0'

if (Test-Path Env:\GO_PIPELINE_LABEL) {
$version = $($Env:GO_PIPELINE_LABEL)
}
}

task default -Depends Clean, Compile
task default -Depends Clean, Compile, UnitTest, Package

task Clean {
if (Test-Path $buildDir) {
Remove-Item $buildDir -Recurse -Force
Remove-Item $buildDir -Recurse -Force
}
Exec { msbuild $solutionFile /t:clean } "Could not clean the project"
}

task Compile {
task SetVersion {
Get-ChildItem $rootDir -Recurse | ? { $_.Name -eq "AssemblyInfo.cs" } | % {
$tmpFile = "$($_.FullName).tmp"

Get-Content $_.FullName |
%{ $_ -Replace '\(Assembly\(File\)?Version\)\("[^"]*"\)', '$1("$version")' } |
Out-File $tmpFile -Encoding UTF8

Move-Item $tmpFile $_.FullName -Force
}
}

task Compile -Depends SetVersion {
Exec { msbuild $solutionFile /p:Configuration=Release } "Build Failed - Compilation"
}

task Package {
task MakeBuildDir {
if (-not (Test-Path $buildDir)) {
New-Item $buildDir -ItemType Container
}
}

$version = '1.0.0'
if (Test-Path Env:\GO_PIPELINE_LABEL) {
$version = $($Env:GO_PIPELINE_LABEL)
}
Dependencies\nuget\nuget.exe pack RestMvc.Example.nuspec -Version $version -OutputDirectory $buildDir -NoPackageAnalysis
task UnitTest -Depends Compile, MakeBuildDir {
$targetDll = Resolve-Path $rootDir\RestMvc.UnitTests\bin\Release\RestMvc.UnitTests.dll
$xmlFile = "$buildDir\UnitTest-Results.xml"
Exec { Dependencies\NUnit\nunit-console.exe "$targetDll" /xml="$xmlFile" } "Unit Tests Failed"
}

task Package -Depends MakeBuildDir, Compile {
Exec { Dependencies\nuget\nuget.exe pack RestMvc.nuspec -Version $version -OutputDirectory $buildDir -NoPackageAnalysis }
Exec { Dependencies\nuget\nuget.exe pack RestMvc.FunctionalTests.nuspec -Version $version -OutputDirectory $buildDir -NoPackageAnalysis }
Exec { Dependencies\nuget\nuget.exe pack RestMvc.Example.nuspec -Version $version -OutputDirectory $buildDir -NoPackageAnalysis }
}

task TestPackage {
if (Test-Path "shower") {
Remove-Item "shower" -Recurse -Force
Remove-Item "shower" -Recurse -Force
}

New-Item "shower" -ItemType Container
Expand All @@ -40,5 +63,5 @@ task TestPackage {
}

task ? -Description "Helper to display task info" {
Write-Documentation
}
Write-Documentation
}

0 comments on commit a7c244e

Please sign in to comment.