2013-03-29 00:12:40 +00:00
|
|
|
$msBuild = 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe'
|
|
|
|
$outputFolder = '.\_output'
|
2013-08-24 00:15:23 +00:00
|
|
|
$outputFolderMono = '.\_output_mono'
|
2013-08-18 23:31:13 +00:00
|
|
|
$testPackageFolder = '.\_tests\'
|
2013-08-19 00:04:48 +00:00
|
|
|
$testSearchPattern = '*.Test\bin\x86\Release'
|
2013-03-29 00:12:40 +00:00
|
|
|
|
|
|
|
Function Build()
|
|
|
|
{
|
2013-11-13 20:38:57 +00:00
|
|
|
Write-Host "##teamcity[progressStart 'Build']"
|
|
|
|
|
2013-10-03 01:01:32 +00:00
|
|
|
$clean = $msbuild + " src\nzbdrone.sln /t:Clean /m"
|
|
|
|
$build = $msbuild + " src\nzbdrone.sln /p:Configuration=Release /p:Platform=x86 /t:Build /m"
|
2013-07-05 23:12:52 +00:00
|
|
|
|
2013-03-29 00:12:40 +00:00
|
|
|
if(Test-Path $outputFolder)
|
|
|
|
{
|
|
|
|
Remove-Item -Recurse -Force $outputFolder -ErrorAction Continue
|
|
|
|
}
|
|
|
|
|
|
|
|
Invoke-Expression $clean
|
2013-07-05 23:12:52 +00:00
|
|
|
CheckExitCode
|
|
|
|
|
2013-03-29 00:12:40 +00:00
|
|
|
Invoke-Expression $build
|
2013-07-05 23:12:52 +00:00
|
|
|
CheckExitCode
|
|
|
|
|
2013-05-12 01:32:03 +00:00
|
|
|
CleanFolder $outputFolder
|
2013-08-05 22:49:41 +00:00
|
|
|
|
|
|
|
AddJsonNet
|
2013-11-13 20:38:57 +00:00
|
|
|
|
|
|
|
Write-Host "##teamcity[progressFinish 'Build']"
|
2013-03-29 00:12:40 +00:00
|
|
|
}
|
|
|
|
|
2013-05-12 01:32:03 +00:00
|
|
|
Function CleanFolder($path)
|
2013-03-29 00:12:40 +00:00
|
|
|
{
|
|
|
|
Write-Host Removing XMLDoc files
|
2013-05-20 00:01:20 +00:00
|
|
|
get-childitem $path -File -Filter *.xml -Recurse | foreach ($_) {remove-item $_.fullname}
|
2013-05-12 01:32:03 +00:00
|
|
|
|
2013-07-25 19:18:14 +00:00
|
|
|
get-childitem $path -File -Filter *.transform -Recurse | foreach ($_) {remove-item $_.fullname}
|
|
|
|
|
2013-08-24 00:15:23 +00:00
|
|
|
|
|
|
|
get-childitem $path -File -Filter *.dll.config -Recurse | foreach ($_) {remove-item $_.fullname}
|
2013-08-05 22:49:41 +00:00
|
|
|
|
2013-05-12 01:32:03 +00:00
|
|
|
Write-Host Removing FluentValidation.Resources files
|
|
|
|
get-childitem $path -File -Filter FluentValidation.resources.dll -recurse | foreach ($_) {remove-item $_.fullname}
|
2013-05-12 05:38:00 +00:00
|
|
|
|
2013-05-20 00:01:20 +00:00
|
|
|
get-childitem $path -File -Filter app.config -Recurse | foreach ($_) {remove-item $_.fullname}
|
2013-11-24 01:42:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
Write-Host Removing .less files
|
|
|
|
get-childitem $path -File -Filter *.less -Recurse | foreach ($_) {remove-item $_.fullname}
|
2013-08-24 00:15:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
Write-Host Removing NuGet
|
|
|
|
Remove-Item -Recurse -Force "$path\NuGet"
|
2013-05-12 01:32:03 +00:00
|
|
|
|
|
|
|
Write-Host Removing Empty folders
|
2013-05-16 04:55:15 +00: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 01:32:03 +00:00
|
|
|
}
|
2013-03-29 00:12:40 +00:00
|
|
|
}
|
|
|
|
|
2013-08-24 00:15:23 +00:00
|
|
|
Function PackageMono()
|
|
|
|
{
|
2013-11-13 20:38:57 +00:00
|
|
|
Write-Host "##teamcity[progressStart 'Creating Mono Package']"
|
|
|
|
|
2013-08-24 00:15:23 +00:00
|
|
|
if(Test-Path $outputFolderMono)
|
|
|
|
{
|
|
|
|
Remove-Item -Recurse -Force $outputFolderMono -ErrorAction Continue
|
|
|
|
}
|
|
|
|
|
|
|
|
Copy-Item $outputFolder $outputFolderMono -recurse
|
|
|
|
|
|
|
|
Write-Host Removing Update Client
|
|
|
|
Remove-Item -Recurse -Force "$outputFolderMono\NzbDrone.Update"
|
|
|
|
|
|
|
|
Write-Host Removing PDBs
|
|
|
|
get-childitem $outputFolderMono -File -Filter *.pdb -Recurse | foreach ($_) {remove-item $_.fullname}
|
|
|
|
|
|
|
|
Write-Host Removing Service helpers
|
|
|
|
get-childitem $outputFolderMono -File -Filter ServiceUninstall.* -Recurse | foreach ($_) {remove-item $_.fullname}
|
|
|
|
get-childitem $outputFolderMono -File -Filter ServiceInstall.* -Recurse | foreach ($_) {remove-item $_.fullname}
|
|
|
|
|
2013-10-03 01:01:32 +00:00
|
|
|
Write-Host Removing native windows binaries Sqlite, MediaInfo
|
2013-08-24 00:15:23 +00:00
|
|
|
get-childitem $outputFolderMono -File -Filter sqlite3.* -Recurse | foreach ($_) {remove-item $_.fullname}
|
|
|
|
get-childitem $outputFolderMono -File -Filter MediaInfo.* -Recurse | foreach ($_) {remove-item $_.fullname}
|
|
|
|
|
|
|
|
Write-Host Renaming NzbDrone.Console.exe to NzbDrone.exe
|
|
|
|
get-childitem $outputFolderMono -File -Filter NzbDrone.exe -Recurse | foreach ($_) {remove-item $_.fullname}
|
|
|
|
Rename-Item "$outputFolderMono\NzbDrone.Console.exe" "NzbDrone.exe"
|
2013-11-13 20:38:57 +00:00
|
|
|
|
|
|
|
Write-Host "##teamcity[progressFinish 'Creating Mono Package']"
|
2013-08-24 00:15:23 +00:00
|
|
|
}
|
|
|
|
|
2013-08-05 22:49:41 +00:00
|
|
|
|
|
|
|
Function AddJsonNet()
|
|
|
|
{
|
2013-09-19 00:51:49 +00:00
|
|
|
get-childitem $outputFolder -File -Filter Newtonsoft.Json.* -Recurse | foreach ($_) {remove-item $_.fullname}
|
2013-10-03 01:01:32 +00:00
|
|
|
Copy-Item .\src\packages\Newtonsoft.Json.5.*\lib\net35\*.dll -Destination $outputFolder
|
|
|
|
Copy-Item .\src\packages\Newtonsoft.Json.5.*\lib\net35\*.dll -Destination $outputFolder\NzbDrone.Update
|
2013-08-05 22:49:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-12 01:32:03 +00:00
|
|
|
Function PackageTests()
|
|
|
|
{
|
2013-11-13 20:38:57 +00:00
|
|
|
|
2013-07-05 23:12:52 +00:00
|
|
|
Write-Host Packaging Tests
|
2013-11-13 20:38:57 +00:00
|
|
|
Write-Host "##teamcity[progressStart 'Creating Mono Package']"
|
2013-08-18 23:31:13 +00:00
|
|
|
|
2013-08-05 23:11:37 +00:00
|
|
|
if(Test-Path $testPackageFolder)
|
2013-05-12 01:32:03 +00: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-10-03 01:01:32 +00:00
|
|
|
.\src\.nuget\NuGet.exe install NUnit.Runners -Version 2.6.1 -Output $testPackageFolder
|
2013-05-12 05:38:00 +00:00
|
|
|
|
2013-08-05 23:11:37 +00:00
|
|
|
Copy-Item $outputFolder\*.dll -Destination $testPackageFolder -Force
|
|
|
|
Copy-Item $outputFolder\*.pdb -Destination $testPackageFolder -Force
|
2013-05-12 05:38:00 +00:00
|
|
|
|
2013-08-18 23:41:34 +00:00
|
|
|
Copy-Item .\*.sh -Destination $testPackageFolder -Force
|
|
|
|
|
2013-08-05 23:11:37 +00:00
|
|
|
get-childitem $testPackageFolder -File -Filter *log.config | foreach ($_) {remove-item $_.fullname}
|
2013-08-19 00:04:48 +00:00
|
|
|
|
|
|
|
CleanFolder $testPackageFolder
|
2013-11-13 20:38:57 +00:00
|
|
|
|
|
|
|
Write-Host "##teamcity[progressFinish 'Creating Mono Package']"
|
2013-05-12 01:32:03 +00:00
|
|
|
}
|
2013-03-29 00:12:40 +00:00
|
|
|
|
2013-05-16 00:33:27 +00:00
|
|
|
|
2013-05-16 04:55:15 +00:00
|
|
|
Function RunGrunt()
|
2013-05-16 00:33:27 +00:00
|
|
|
{
|
2013-11-13 20:38:57 +00:00
|
|
|
Write-Host "##teamcity[progressStart 'Running Grunt']"
|
2013-05-16 20:49:16 +00:00
|
|
|
$gruntPath = [environment]::getfolderpath("applicationdata") + '\npm\node_modules\grunt-cli\bin\grunt'
|
2013-05-20 00:30:02 +00:00
|
|
|
Invoke-Expression 'npm install'
|
2013-07-05 23:12:52 +00:00
|
|
|
CheckExitCode
|
2013-05-16 20:49:16 +00:00
|
|
|
|
2013-11-21 06:26:18 +00:00
|
|
|
Invoke-Expression ('node ' + $gruntPath + ' packagerjs') -ErrorAction Continue -Verbose
|
2013-07-05 23:12:52 +00:00
|
|
|
CheckExitCode
|
2013-11-13 20:38:57 +00:00
|
|
|
|
2013-11-21 06:26:18 +00:00
|
|
|
Remove-Item $outputFolder\UI\build.txt -ErrorAction Continue
|
|
|
|
|
2013-11-13 20:38:57 +00:00
|
|
|
Write-Host "##teamcity[progressFinish 'Running Grunt']"
|
2013-07-05 23:12:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Function CheckExitCode()
|
|
|
|
{
|
|
|
|
if ($lastexitcode -ne 0)
|
|
|
|
{
|
|
|
|
Write-Host $errorMessage
|
|
|
|
exit 1
|
|
|
|
}
|
2013-05-16 00:33:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Build
|
2013-08-06 05:59:06 +00:00
|
|
|
RunGrunt
|
2013-08-24 00:20:10 +00:00
|
|
|
PackageMono
|
2013-08-24 00:15:23 +00:00
|
|
|
PackageTests
|