From 14e20f425cce739a517f6d1312c6f7a4ab68371e Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 11 May 2013 18:32:03 -0700 Subject: [PATCH] updated build.ps1 --- .gitignore | 1 + NzbDrone.sln | 3 +++ build.ps1 | 37 +++++++++++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 714be5559..db0c9967e 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,4 @@ _output/ _rawPackage/ NzbDrone.zip _dotTrace* +_tests/ diff --git a/NzbDrone.sln b/NzbDrone.sln index 461e27c2f..27fcc32d9 100644 --- a/NzbDrone.sln +++ b/NzbDrone.sln @@ -250,6 +250,7 @@ Global {F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Release|Mixed Platforms.Build.0 = Release|Any CPU {F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Release|x86.ActiveCfg = Release|Any CPU + {F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Release|x86.Build.0 = Release|Any CPU {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Any CPU.Build.0 = Debug|Any CPU {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -260,6 +261,7 @@ Global {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|Mixed Platforms.Build.0 = Release|Any CPU {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|x86.ActiveCfg = Release|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|x86.Build.0 = Release|Any CPU {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -270,6 +272,7 @@ Global {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Release|Mixed Platforms.Build.0 = Release|Any CPU {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Release|x86.ActiveCfg = Release|Any CPU + {8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build.ps1 b/build.ps1 index 894c6faf8..0e92be92f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,32 +1,53 @@ $msBuild = 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe' $outputFolder = '.\_output' +$testSearchPattern = '*.Test\bin\x86\Release' +$testPackageFolder = '.\_tests\' Function Build() { - - $clean = $msbuild + " nzbdrone.sln /t:Clean /m" - $build = $msbuild + " nzbdrone.sln /p:Configuration=Release /p:Platform=x86 /t:Build" + $build = $msbuild + " nzbdrone.sln /p:Configuration=Release /p:Platform=x86 /t:Build /m" if(Test-Path $outputFolder) { Remove-Item -Recurse -Force $outputFolder -ErrorAction Continue } - Invoke-Expression $clean Invoke-Expression $build + CleanFolder $outputFolder } -Function Package() +Function CleanFolder($path) { Write-Host Removing XMLDoc files - get-childitem $outputFolder -include *.xml -recurse | foreach ($_) {remove-item $_.fullname} + get-childitem $path -File -Filter *.xml | foreach ($_) {remove-item $_.fullname} - Write-Host Removing FluentValidation.resources - get-childitem $outputFolder -include FluentValidation.resources.dll -recurse | foreach ($_) {remove-item $_.fullname} + Write-Host Removing FluentValidation.Resources files + get-childitem $path -File -Filter FluentValidation.resources.dll -recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host Removing Empty folders + while (Get-ChildItem $path -recurse | where {!@(Get-ChildItem -force $_.fullname)} | Test-Path) { + Get-ChildItem $path -recurse | where {!@(Get-ChildItem -force $_.fullname)} | Remove-Item + } } +Function PackageTests() +{ + Write-Host Packagin Tests + + if(Test-Path $testPackageFolder) + { + Remove-Item -Recurse -Force $testPackageFolder -ErrorAction Continue + } + + + Get-ChildItem -Recurse -Directory | Where-Object {$_.FullName -like $testSearchPattern} | foreach($_){ + Copy-Item -Recurse ($_.FullName + "\*") $testPackageFolder -ErrorAction Ignore + } + + CleanFolder $testPackageFolder +} Build Package \ No newline at end of file