Permalink
Browse files

Updated build scripts to use psake. Added CI feed for the event store

  • Loading branch information...
1 parent 3d5a3e9 commit 8cf731ff2f31b9a85481e189f1be6e9243e3bc47 @kblooie kblooie committed Sep 17, 2012
View
@@ -10,4 +10,5 @@ _ReSharper.*
*.Cache
*.cache
~$*
-src/packages
+src/packages
+publish-*
View
@@ -0,0 +1,2 @@
+@echo off
+powershell -NoProfile -ExecutionPolicy unrestricted -Command "& .\build\Build.RunTask.ps1 %*"
@@ -0,0 +1,11 @@
+Param(
+ [string]$task,
+ [string]$version = "0.0.0.0")
+
+if($task -eq $null) {
+ $task = read-host "Enter Task"
+}
+
+$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path)
+
+. .\build\psake.ps1 -scriptPath $scriptPath -t $task -properties @{ version=$version }
@@ -0,0 +1,37 @@
+$script:ilMergeModule = @{}
+$script:ilMergeModule.ilMergePath = $null
+
+function Merge-Assemblies {
+ Param(
+ $files,
+ $outputFile,
+ $exclude,
+ $keyfile,
+ $targetPlatform="v4,C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319"
+ )
+
+ $exclude | out-file ".\exclude.txt"
+
+ $args = @(
+ "/keyfile:$keyfile",
+ "/internalize:exclude.txt",
+ "/xmldocs",
+ "/wildcards",
+ "/targetplatform:$targetPlatform",
+ "/out:$outputFile") + $files
+
+ if($ilMergeModule.ilMergePath -eq $null)
+ {
+ write-error "IlMerge Path is not defined. Please set variable `$ilMergeModule.ilMergePath"
+ }
+
+ & $ilMergeModule.ilMergePath $args
+
+ if($LastExitCode -ne 0) {
+ write-error "Merge Failed"
+ }
+
+ remove-item ".\exclude.txt"
+}
+
+Export-ModuleMember -Variable "ilMergeModule" -Function "Merge-Assemblies"
View
@@ -0,0 +1,64 @@
+function Clean-Item {
+ Param(
+ [parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
+ [string] $path
+ )
+ Process
+ {
+ if(($path -ne $null) -and (test-path $path))
+ {
+ write-verbose ("Removing {0}" -f $path)
+ remove-item -force -recurse $path | Out-Null
+ }
+ }
+}
+
+function Remove-Directory {
+ Param(
+ [parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
+ [string] $path
+ )
+ rd $path -recurse -force -ErrorAction SilentlyContinue | out-null
+}
+
+function New-Directory
+{
+ Param(
+ [parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
+ [string] $path
+ )
+
+ mkdir $path -ErrorAction SilentlyContinue | out-null
+}
+
+function Copy-Files {
+ Param(
+ [parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
+ [string] $source,
+ [string] $destination,
+ [alias("exclude")]
+ [string[]] $excludeFiles=@(),
+ [string[]] $excludeDirectories=@()
+ )
+
+ New-Directory $destination
+
+ #Get-ChildItem $source -Recurse -Exclude $exclude | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
+
+
+ $arguments = @($source, $destination, "*.*", "/e")
+
+ if(($excludeFiles -ne $null) -and ($excludeFiles.Length -gt 0)) {
+ $arguments += "/xf"
+ $arguments += $excludeFiles
+ }
+
+ if(($excludeDirectories -ne $null) -and ($excludeFiles.Length -gt 0)) {
+ $arguments += "/xd"
+ $arguments += $excludeDirectories
+ }
+
+ robocopy.exe $arguments | out-null
+
+ Expect-ExitCode -expectedExitCode 0,1 -formatMessage { param($taskName) "Copy was not successful" }
+}
View
@@ -0,0 +1,63 @@
+properties {
+ $base_directory = Resolve-Path ..
+ $publish_directory = "$base_directory\publish-net40"
+ $build_directory = "$base_directory\build"
+ $src_directory = "$base_directory\src"
+ $output_directory = "$base_directory\output"
+ $packages_directory = "$src_directory\packages"
+
+ $sln_file = "$src_directory\CommonDomain.sln"
+ $keyfile = "$src_directory/CommonDomain.snk"
+ $target_config = "Release"
+ $framework_version = "v4.0"
+ $version = "0.0.0.0"
+
+ $ilMergeModule.ilMergePath = "$base_directory\bin\ilmerge-bin\ILMerge.exe"
+ $nuget_dir = "$src_directory\.nuget"
+}
+
+task default -depends Build
+
+task Build -depends Clean, UpdateVersion, Compile
+
+task UpdateVersion {
+ $versionAssemblyInfoFile = "$src_directory/proj/VersionAssemblyInfo.cs"
+ "using System.Reflection;" > $versionAssemblyInfoFile
+ "" >> $versionAssemblyInfoFile
+ "[assembly: AssemblyVersion(""$version"")]" >> $versionAssemblyInfoFile
+ "[assembly: AssemblyFileVersion(""$version"")]" >> $versionAssemblyInfoFile
+}
+
+task Compile {
+ exec { msbuild /nologo /verbosity:quiet $sln_file /p:Configuration=$target_config /t:Clean }
+
+ exec { msbuild /nologo /verbosity:quiet $sln_file /p:Configuration=$target_config /p:TargetFrameworkVersion=v4.0 }
+}
+
+task Package -depends Build, PackageCommonDomain, PackageDocs {
+ move $output_directory $publish_directory
+}
+
+task PackageCommonDomain -depends Clean, Compile {
+ mkdir "$output_directory\bin" | out-null
+ Merge-Assemblies -outputFile "$output_directory\bin\CommonDomain.dll" -keyfile $keyFile -files @(
+ "$src_directory\proj\CommonDomain\bin\$target_config\CommonDomain.dll"
+ "$src_directory\proj\CommonDomain.Core\bin\$target_config\CommonDomain.Core.dll"
+ "$src_directory\proj\CommonDomain.Persistence\bin\$target_config\CommonDomain.Persistence.dll"
+ "$src_directory\proj\CommonDomain.Persistence.EventStore\bin\$target_config\CommonDomain.Persistence.EventStore.dll"
+ )
+}
+
+task PackageDocs {
+ mkdir "$output_directory\doc"
+ copy "$base_directory\doc\*.*" "$output_directory\doc"
+}
+
+task Clean {
+ Clean-Item $publish_directory -ea SilentlyContinue
+ Clean-Item $output_directory -ea SilentlyContinue
+}
+
+task NuGetPack -depends Package {
+ gci -r -i *.nuspec "$nuget_dir" |% { .$nuget_dir\nuget.exe pack $_ -basepath $base_directory -o $publish_directory -version $version }
+}
@@ -0,0 +1,2 @@
+$config.modules=(".\build\modules\*.psm1")
+$config.moduleScope="global"
View
@@ -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 }"
+goto :eof
+
+:help
+powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' -help"
View
@@ -0,0 +1,47 @@
+# 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)
+)
+
+# '[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
+ }
+}
+
+$psake.use_exit_on_error = $true
+invoke-psake $buildFile $taskList $framework $docs $parameters $properties $initialization $nologo
Oops, something went wrong.

0 comments on commit 8cf731f

Please sign in to comment.