You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/build.ps1

76 lines
2.1 KiB

param (
[switch]$runTests = $false
)
$msBuild = 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe'
$outputFolder = '.\_output'
12 years ago
$testSearchPattern = '*.Test\bin\x86\Release'
$testPackageFolder = '.\_tests\'
Function Build()
{
$clean = $msbuild + " nzbdrone.sln /t:Clean /m"
12 years ago
$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
12 years ago
CleanFolder $outputFolder
}
12 years ago
Function CleanFolder($path)
{
Write-Host Removing XMLDoc files
12 years ago
get-childitem $path -File -Filter *.xml | foreach ($_) {remove-item $_.fullname}
Write-Host Removing FluentValidation.Resources files
get-childitem $path -File -Filter FluentValidation.resources.dll -recurse | foreach ($_) {remove-item $_.fullname}
get-childitem $path -File -Filter app.config | foreach ($_) {remove-item $_.fullname}
12 years ago
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
}
}
12 years ago
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
get-childitem $testPackageFolder -File -Filter *log.config | foreach ($_) {remove-item $_.fullname}
12 years ago
}
Build
PackageTests
if($runTests)
{
$testFiles
get-childitem $testPackageFolder -File -Filter *test.dll | foreach ($_) {
$testFiles = $testFiles + $_.FullName + " "
}
$nunitExe = '.\Libraries\nunit\nunit-console-x86.exe ' + $testFiles + ' /process:multiple /noxml'
Invoke-Expression $nunitExe
}