PageRenderTime 355ms CodeModel.GetById 131ms app.highlight 77ms RepoModel.GetById 73ms app.codeStats 1ms

/default.ps1

http://github.com/ayende/rhino-etl
Powershell | 197 lines | 173 code | 20 blank | 4 comment | 17 complexity | 0dc2e83eda8712ceeca1be9d6713b9e7 MD5 | raw file
  1properties { 
  2  $base_dir  = resolve-path .
  3  $lib_dir = "$base_dir\SharedLibs"
  4  $sln_file = "$base_dir\Rhino.Etl.sln" 
  5  $version = "1.3.1.0"
  6  $humanReadableversion = "1.3"
  7  $tools_dir = "$base_dir\Tools"
  8  $release_dir = "$base_dir\Release"
  9  $uploadCategory = "Rhino-ETL"
 10  $uploader = "..\Uploader\S3Uploader.exe"
 11} 
 12
 13task default -depends Release
 14
 15task Clean { 
 16  remove-item -force -recurse $release_dir -ErrorAction SilentlyContinue 
 17} 
 18
 19task Init -depends Clean { 
 20	. .\psake_ext.ps1
 21	
 22	$infos = (
 23    "$base_dir\Rhino.Etl.Core\Properties\AssemblyInfo.cs",
 24    "$base_dir\Rhino.Etl.Dsl\Properties\AssemblyInfo.cs",
 25    "$base_dir\Rhino.Etl.Tests\Properties\AssemblyInfo.cs",
 26    "$base_dir\Rhino.Etl.Cmd\Properties\AssemblyInfo.cs"
 27	);
 28	
 29	$infos | foreach { Generate-Assembly-Info `
 30		-file $_ `
 31		-title "Rhino ETL $version" `
 32		-description "Developer freindly ETL Library for .NET" `
 33		-company "Hibernating Rhinos" `
 34		-product "Developer freindly ETL Library for .NET $version" `
 35		-version $version `
 36		-clsCompliant "false" `
 37		-copyright "Hibernating Rhinos, Ayende Rahien & Nathan Palmer 2007 - 2015"
 38	}		
 39		
 40	new-item $release_dir -itemType directory 
 41} 
 42
 43task Compile -depends Init { 
 44  & msbuild "$sln_file" /p:Configuration=Release /v:Minimal
 45  if ($lastExitCode -ne 0) {
 46        throw "Error: Failed to execute msbuild"
 47  }
 48} 
 49
 50task Test -depends Compile {
 51  $old = pwd
 52  cd $tools_dir\XUnit\
 53  &.\xunit.console.exe "$base_dir\Rhino.Etl.Tests\bin\Release\Rhino.Etl.Tests.dll"
 54  if ($lastExitCode -ne 0) {
 55        throw "Error: Failed to execute tests"
 56    }
 57  cd $old
 58}
 59
 60task Release -depends Test,DoRelease {
 61
 62}
 63
 64task Nuget {
 65  . .\psake_ext.ps1
 66  
 67  Generate-Nuget-Spec `
 68    -title "Rhino-Etl" `
 69    -version $version `
 70    -authors "Ayende Rahien, Nathan Palmer" `
 71    -description "Rhino Etl is a developer friendly Extract, transform and load (ETL) library for .NET" `
 72    -language "en-GB" `
 73    -projectURL "https://github.com/hibernating-rhinos/rhino-etl" `
 74    -licenceUrl "https://github.com/hibernating-rhinos/rhino-etl/blob/master/license.txt" `
 75    -iconUrl "https://raw.github.com/wiki/hibernating-rhinos/rhino-esb/images/rhino-icon.jpg" `
 76    -dependencies @( `
 77      @("Boo", "0.9.4"), `
 78      @("RhinoDSL", "1.0.0"), `
 79      @("Common.Logging", "3.0.0"), `
 80      @("Common.Logging.Core", "3.0.0"), `
 81      @("FileHelpers", "2.0.0.0") `
 82     ) `
 83    -files @( `
 84      @("$base_dir\Rhino.Etl.Dsl\bin\Release\Rhino.Etl.Core.dll","lib\net35"), `
 85      @("$base_dir\Rhino.Etl.Dsl\bin\Release\Rhino.Etl.Core.xml","lib\net35"), `
 86      @("$base_dir\Rhino.Etl.Dsl\bin\Release\Rhino.Etl.Core.pdb","lib\net35"), `
 87      @("$base_dir\Rhino.Etl.Dsl\bin\Release\Rhino.Etl.Dsl.dll","lib\net35"), `
 88      @("$base_dir\Rhino.Etl.Dsl\bin\Release\Rhino.Etl.Dsl.xml","lib\net35"), `
 89      @("$base_dir\Rhino.Etl.Dsl\bin\Release\Rhino.Etl.Dsl.pdb","lib\net35"), `
 90      @("$base_dir\Rhino.Etl.Dsl\**\*.cs","src\Rhino.Etl.Dsl"), `
 91      @("$base_dir\Rhino.Etl.Core\**\*.cs","src\Rhino.Etl.Core"), `
 92      @("license.txt",""), `
 93      @("acknowledgements.txt","") `
 94    ) `
 95    -file "$base_dir\Rhino.Etl.nuspec"
 96    .\Tools\NuGet.exe pack .\Rhino.Etl.nuspec -Symbols
 97    
 98    # Regular
 99    if (test-path ".\Release\Rhino-Etl.$version.nupkg") {
100      del ".\Release\Rhino-Etl.$version.nupkg"
101    }
102    move "Rhino-Etl.$version.nupkg" .\Release
103    
104    # Symbol
105    if (test-path ".\Release\Rhino-Etl.$version.symbols.nupkg") {
106      del ".\Release\Rhino-Etl.$version.symbols.nupkg"
107    }
108    move "Rhino-Etl.$version.symbols.nupkg" .\Release
109
110  Generate-Nuget-Spec `
111    -title "Rhino-Etl-Cmd" `
112    -version $version `
113    -authors "Ayende Rahien, Nathan Palmer" `
114    -description "Rhino Etl is a developer friendly Extract, transform and load (ETL) library for .NET" `
115    -language "en-GB" `
116    -projectURL "https://github.com/hibernating-rhinos/rhino-etl" `
117    -licenceUrl "https://github.com/hibernating-rhinos/rhino-etl/blob/master/license.txt" `
118    -iconUrl "https://raw.github.com/wiki/hibernating-rhinos/rhino-esb/images/rhino-icon.jpg" `
119    -dependencies @( `
120      @("Boo", "0.9.4"), `
121      @("RhinoDSL", "1.0.0"), `
122      @("Common.Logging", "3.0.0"), `
123      @("Common.Logging.Core", "3.0.0"), `
124      @("Common.Logging.Log4Net1210", "3.0.0"), `
125      @("log4net", "1.2.10"), `
126      @("FileHelpers", "2.0.0.0") `
127     ) `
128    -files @( `
129      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Core.dll","lib\net35"), `
130      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Core.xml","lib\net35"), `
131      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Core.pdb","lib\net35"), `
132      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Dsl.dll","lib\net35"), `
133      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Dsl.xml","lib\net35"), `
134      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Dsl.pdb","lib\net35"), `
135      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Cmd.exe","lib\net35"), `
136      @("$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Cmd.pdb","lib\net35"), `
137      @("$base_dir\Rhino.Etl.Dsl\**\*.cs","src\Rhino.Etl.Dsl"), `
138      @("$base_dir\Rhino.Etl.Core\**\*.cs","src\Rhino.Etl.Core"), `
139      @("$base_dir\Rhino.Etl.Cmd\**\*.cs","src\Rhino.Etl.Cmd"), `
140      @("license.txt",""), `
141      @("acknowledgements.txt","") `
142    ) `
143    -file "$base_dir\Rhino-Etl-Cmd.nuspec"
144    .\Tools\NuGet.exe pack .\Rhino-Etl-Cmd.nuspec -Symbols
145    
146    # Regular
147    if (test-path ".\Release\Rhino-Etl-Cmd.$version.nupkg") {
148      del ".\Release\Rhino-Etl-Cmd.$version.nupkg"
149    }
150    move "Rhino-Etl-Cmd.$version.nupkg" .\Release
151    
152    # Symbol
153    if (test-path ".\Release\Rhino-Etl-Cmd.$version.symbols.nupkg") {
154      del ".\Release\Rhino-Etl-Cmd.$version.symbols.nupkg"
155    }
156    move "Rhino-Etl-Cmd.$version.symbols.nupkg" .\Release
157}
158
159task DoRelease -depends Compile,NuGet {
160	& $tools_dir\zip.exe -9 -A -j $release_dir\Rhino.Etl-$humanReadableversion-Build-$env:ccnetnumericlabel.zip `
161		$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Core.dll `
162		$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Core.xml `
163		$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Dsl.dll `
164		$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Dsl.xml `
165		$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.Etl.Cmd.exe `
166		$base_dir\Rhino.Etl.Cmd\bin\Release\Rhino.DSL.dll `
167		$base_dir\Rhino.Etl.Cmd\bin\Release\log4net.dll `
168		$base_dir\Rhino.Etl.Cmd\bin\Release\Common.Logging.dll `
169		$base_dir\Rhino.Etl.Cmd\bin\Release\Common.Logging.Core.dll `
170		$base_dir\Rhino.Etl.Cmd\bin\Release\Common.Logging.Log4Net1210.dll `
171		$base_dir\Rhino.Etl.Cmd\bin\Release\Boo.* `
172		$base_dir\Rhino.Etl.Cmd\bin\Release\FileHelpers.dll `
173		license.txt `
174		acknowledgements.txt
175	if ($lastExitCode -ne 0) {
176        throw "Error: Failed to execute ZIP command"
177    }
178}
179
180task Upload -depends DoRelease {
181	Write-Host "Starting upload"
182	if (Test-Path $uploader) {
183		$log = $env:push_msg 
184    if($log -eq $null -or $log.Length -eq 0) {
185      $log = git log -n 1 --oneline		
186    }
187		&$uploader "$uploadCategory" "$release_dir\Rhino.Etl-$humanReadableversion-Build-$env:ccnetnumericlabel.zip" "$log"
188		
189		if ($lastExitCode -ne 0) {
190      write-host "Failed to upload to S3: $lastExitCode"
191			throw "Error: Failed to publish build"
192		}
193	}
194	else {
195		Write-Host "could not find upload script $uploadScript, skipping upload"
196	}
197}