|
Framework 4.5.1 |
|
|
|
properties { |
|
$base_dir = (Get-Item (Resolve-Path .)).Parent.FullName |
|
$bin_dir = "$base_dir\bin" |
|
$sln_path = "$base_dir\XXX.sln" |
|
$config = "Release" |
|
# $tests_path = "$base_dir\src\log4net.ElasticSearch.Tests\bin\$config\log4net.ElasticSearch.Tests.dll" |
|
# $xunit_path = "$base_dir\src\packages\xunit.runners.1.9.2\tools\xunit.console.clr4.exe" |
|
$dirs = @($bin_dir) |
|
# $artefacts = @("$base_dir\LICENSE", "$base_dir\readme.txt") |
|
$nuget_path = "$base_dir\tools\nuget\NuGet.exe" |
|
$nuspec_path = "$base_dir\scripts\XXX.nuspec" |
|
$sharedAssemblyInfo = "$base_dir\bin\lib\net40\xxx.dll" |
|
} |
|
|
|
#Include "packages\Hangfire.Build.0.1.3\tools\psake-common.ps1" |
|
|
|
task default -depends Clean, Compile |
|
task Package -depends default, CreateNugetPackage |
|
|
|
task Clean { |
|
$dirs | % { Recreate-Directory $_ } |
|
} |
|
|
|
task Compile { |
|
echo "config: $config" |
|
exec { |
|
msbuild $sln_path /p:Configuration=$config /t:"Clean,Build" /v:Quiet /nologo |
|
} |
|
} |
|
|
|
task Test { |
|
exec { |
|
& $xunit_path $tests_path |
|
} |
|
} |
|
|
|
task CopyArtefactsToBinDirectory { |
|
$artefacts | % { CopyTo-BinDirectory $_ } |
|
} |
|
|
|
task CreateNugetPackage { |
|
|
|
#$version = Get-SharedVersion |
|
|
|
# Now load the assembly |
|
#$Myasm = [System.Reflection.Assembly]::Loadfile($sharedAssemblyInfo) |
|
|
|
# Get name, version and display the results |
|
#$Aname = $Myasm.GetName() |
|
#$version = $Aname.version |
|
|
|
$version =(Get-Item $sharedAssemblyInfo).VersionInfo.ProductVersion |
|
|
|
exec { |
|
& $nuget_path pack $nuspec_path -Basepath $bin_dir -OutputDirectory $bin_dir -Version $version |
|
} |
|
} |
|
|
|
task ? -Description "Helper to display task info" { |
|
Write-Documentation |
|
} |
|
|
|
function Recreate-Directory($directory) { |
|
if (Test-Path $directory) { |
|
Write-Host -NoNewline "`tDeleting $directory" |
|
Remove-Item $directory -Recurse -Force | out-null |
|
Write-Host "...Done" |
|
} |
|
|
|
Write-Host -NoNewline "`tCreating $directory" |
|
New-Item $directory -Type Directory | out-null |
|
Write-Host "...Done" |
|
} |
|
|
|
function CopyTo-BinDirectory($artefact) { |
|
Write-Host -NoNewline "`tCopying $artefact to $bin_dir" |
|
Copy-Item $artefact $bin_dir |
|
Write-Host "...Done" |
|
} |
|
|
|
#function Get-SharedVersion { |
|
# $line = Get-Content "$sharedAssemblyInfo" | where {$_.Contains("AssemblyVersion")} |
|
# $line.Split('"')[1] |
|
#} |
set properties: http://psake.readthedocs.io/en/latest/property-overrides/