1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/build.ps1

104 lines
2.8 KiB
PowerShell
Raw Normal View History

$msBuild = 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe'
$outputFolder = '.\_output'
Function Build()
{
$clean = $msbuild + " nzbdrone.sln /t:Clean /m"
2013-05-12 04:32:03 +03:00
$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
CheckExitCode
Invoke-Expression $build
CheckExitCode
2013-05-12 04:32:03 +03:00
CleanFolder $outputFolder
AddJsonNet
}
2013-05-12 04:32:03 +03:00
Function CleanFolder($path)
{
Write-Host Removing XMLDoc files
get-childitem $path -File -Filter *.xml -Recurse | foreach ($_) {remove-item $_.fullname}
2013-05-12 04:32:03 +03:00
get-childitem $path -File -Filter *.transform -Recurse | foreach ($_) {remove-item $_.fullname}
get-childitem $path -File -Filter Newtonsoft.Json.* -Recurse | foreach ($_) {remove-item $_.fullname}
2013-05-12 04:32:03 +03:00
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 -Recurse | foreach ($_) {remove-item $_.fullname}
2013-05-12 04:32:03 +03:00
Write-Host Removing Empty folders
2013-05-16 07:55:15 +03:00
while (Get-ChildItem $path -recurse | where {!@(Get-ChildItem -force $_.fullname)} | Test-Path)
{
Get-ChildItem $path -Directory -recurse | where {!@(Get-ChildItem -force $_.fullname)} | Remove-Item
2013-05-12 04:32:03 +03:00
}
}
Function AddJsonNet()
{
Copy-Item .\packages\Newtonsoft.Json.5.*\lib\net35\*.* -Destination $outputFolder
}
2013-05-12 04:32:03 +03:00
Function PackageTests()
{
Write-Host Packaging Tests
2013-05-12 04:32:03 +03:00
$testPackageFolder = '.\_tests\'
.\.nuget\NuGet.exe install NUnit.Runners -Version 2.6.1 -Output $testPackageFolder
if(Test-Path $testPackageFolder)
2013-05-12 04:32:03 +03:00
{
Remove-Item -Recurse -Force $testPackageFolder -ErrorAction Continue
}
Get-ChildItem -Recurse -Directory | Where-Object {$_.FullName -like $testSearchPattern} | foreach($_){
Copy-Item -Recurse ($_.FullName + "\*") $testPackageFolder -ErrorAction Ignore
}
2013-05-12 04:32:03 +03:00
CleanFolder $testPackageFolder
Copy-Item $outputFolder\*.dll -Destination $testPackageFolder -Force
Copy-Item $outputFolder\*.pdb -Destination $testPackageFolder -Force
get-childitem $testPackageFolder -File -Filter *log.config | foreach ($_) {remove-item $_.fullname}
2013-05-12 04:32:03 +03:00
}
2013-05-16 03:33:27 +03:00
2013-05-16 07:55:15 +03:00
Function RunGrunt()
2013-05-16 03:33:27 +03:00
{
2013-05-16 23:49:16 +03:00
$gruntPath = [environment]::getfolderpath("applicationdata") + '\npm\node_modules\grunt-cli\bin\grunt'
2013-05-20 03:30:02 +03:00
Invoke-Expression 'npm install'
CheckExitCode
2013-05-16 23:49:16 +03:00
2013-05-20 03:30:02 +03:00
Invoke-Expression ('node ' + $gruntPath + ' package')
CheckExitCode
}
Function CheckExitCode()
{
if ($lastexitcode -ne 0)
{
Write-Host $errorMessage
exit 1
}
2013-05-16 03:33:27 +03:00
}
Build
2013-08-06 08:59:06 +03:00
RunGrunt
PackageTests