diff --git a/CommonProject.properties b/CommonProject.properties index 4a0e80af2..db6e37df8 100644 --- a/CommonProject.properties +++ b/CommonProject.properties @@ -27,7 +27,7 @@ bin\Release\ true 4096 - None + pdbonly AnyCPU Off diff --git a/GreenshotPlugin/Core/NetworkHelper.cs b/GreenshotPlugin/Core/NetworkHelper.cs index 77bcee596..0f4da8b6a 100644 --- a/GreenshotPlugin/Core/NetworkHelper.cs +++ b/GreenshotPlugin/Core/NetworkHelper.cs @@ -363,9 +363,8 @@ namespace GreenshotPlugin.Core { /// Uri /// DateTime public static DateTime GetLastModified(Uri uri) { - HttpWebRequest webRequest; try { - webRequest = (HttpWebRequest)CreateWebRequest(uri); + HttpWebRequest webRequest = CreateWebRequest(uri); webRequest.Method = "HEAD"; HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); LOG.DebugFormat("RSS feed was updated at {0}", webResponse.LastModified); diff --git a/build.ps1 b/build.ps1 index e32be3eb9..5327248e2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -134,36 +134,36 @@ Function PackagePortable { Function PackageZip { $sourcebase = "$(get-location)\Greenshot\bin\Release" $destbase = "$(get-location)\Greenshot\releases" - $destinstaller = "$destbase\NO-INSTALLER" + $destzip = "$destbase\NO-INSTALLER" # Only remove the zip we are going to create, to prevent adding but keeping the history if (Test-Path ("$destbase\Greenshot-NO-INSTALLER-$fileversion.zip")) { Remove-Item "$destbase\Greenshot-NO-INSTALLER-$fileversion.zip" -Confirm:$false } # Remove the directory to create the files in - if (Test-Path ("$destinstaller")) { - Remove-Item "$destinstaller" -recurse -Confirm:$false + if (Test-Path ("$destzip")) { + Remove-Item "$destzip" -recurse -Confirm:$false } - New-Item -ItemType directory -Path "$destinstaller" | Out-Null + New-Item -ItemType directory -Path "$destzip" | Out-Null - echo ";dummy config, used to make greenshot store the configuration in this directory" | Set-Content "$destinstaller\greenshot.ini" -encoding UTF8 - echo ";In this file you should add your default settings" | Set-Content "$destinstaller\greenshot-defaults.ini" -encoding UTF8 - echo ";In this file you should add your fixed settings" | Set-Content "$destinstaller\greenshot-fixed.ini" -encoding UTF8 + echo ";dummy config, used to make greenshot store the configuration in this directory" | Set-Content "$destzip\greenshot.ini" -encoding UTF8 + echo ";In this file you should add your default settings" | Set-Content "$destzip\greenshot-defaults.ini" -encoding UTF8 + echo ";In this file you should add your fixed settings" | Set-Content "$destzip\greenshot-fixed.ini" -encoding UTF8 $INCLUDE=@("*.gsp", "*.dll", "*.exe", "*.config") Get-ChildItem -Path "$sourcebase\Plugins\" -Recurse -Include $INCLUDE | foreach { - $path = $_.fullname -replace ".*\\Plugins\\", "$destinstaller\Plugins\" + $path = $_.fullname -replace ".*\\Plugins\\", "$destzip\Plugins\" New-Item -ItemType File -Path "$path" -Force | Out-Null Copy-Item -Path $_ -Destination "$path" -Force } $INCLUDE=@("help-*.html","language-*.xml") Get-ChildItem -Path "$(get-location)\Greenshot\Languages\" -Recurse -Include $INCLUDE -Exclude "*installer*","*website*" | foreach { - $path = $_.fullname -replace ".*\\Languages\\", "$destinstaller\Languages\" + $path = $_.fullname -replace ".*\\Languages\\", "$destzip\Languages\" New-Item -ItemType File -Path "$path" -Force | Out-Null Copy-Item -Path $_ -Destination "$path" -Force } - Copy-Item -Path "$sourcebase\Languages\Plugins\" -Destination "$destinstaller\Languages\Plugins\" -Recurse + Copy-Item -Path "$sourcebase\Languages\Plugins\" -Destination "$destzip\Languages\Plugins\" -Recurse @( "$sourcebase\checksum.MD5", "$sourcebase\Greenshot.exe", @@ -171,11 +171,11 @@ Function PackageZip { "$sourcebase\GreenshotPlugin.dll", "$sourcebase\log4net.dll", "$sourcebase\log4net.xml", - "$destbase\additional_files\*.txt" ) | foreach { Copy-Item $_ "$destinstaller\" } + "$destbase\additional_files\*.txt" ) | foreach { Copy-Item $_ "$destzip\" } $zipOutput = "$(get-location)\zip" $zip7 = "$(get-location)\greenshot\tools\7zip\7za.exe" - $arguments = @('a', '-mx9', '-tzip', '-r', "$destbase\Greenshot-NO-INSTALLER-$fileversion.zip", "$destinstaller\*") + $arguments = @('a', '-mx9', '-tzip', '-r', "$destbase\Greenshot-NO-INSTALLER-$fileversion.zip", "$destzip\*") Write-Host "Starting $zip7 $arguments" $zipResult = Start-Process -wait -PassThru "$zip7" -ArgumentList $arguments -NoNewWindow -RedirectStandardOutput "$zipOutput.log" -RedirectStandardError "$zipOutput.error" Write-Host "Log output:" @@ -186,7 +186,49 @@ Function PackageZip { exit -1 } Start-Sleep -m 1500 - Remove-Item "$destinstaller" -Recurse -Confirm:$false + Remove-Item "$destzip" -Recurse -Confirm:$false + return +} + +# This function creates the debug symbols .zip +Function PackageDbgSymbolsZip { + $sourcebase = "$(get-location)\Greenshot\bin\Release" + $destbase = "$(get-location)\Greenshot\releases" + $destdbgzip = "$destbase\DEBUGSYMBOLS" + + # Only remove the zip we are going to create, to prevent adding but keeping the history + if (Test-Path ("$destbase\Greenshot-DEBUGSYMBOLS-$fileversion.zip")) { + Remove-Item "$destbase\Greenshot-DEBUGSYMBOLS-$fileversion.zip" -Confirm:$false + } + # Remove the directory to create the files in + if (Test-Path ("$destdbgzip")) { + Remove-Item "$destdbgzip" -recurse -Confirm:$false + } + New-Item -ItemType directory -Path "$destdbgzip" | Out-Null + + $INCLUDE=@("*.pdb") + Get-ChildItem -Path "$sourcebase\Plugins\" -Recurse -Include $INCLUDE | foreach { + $path = $_.fullname -replace ".*\\Plugins\\", "$destdbgzip\Plugins\" + New-Item -ItemType File -Path "$path" -Force | Out-Null + Copy-Item -Path $_ -Destination "$path" -Force + } + + @( "$sourcebase\*.pdb") | foreach { Copy-Item $_ "$destdbgzip\" } + + $zipOutput = "$(get-location)\dbgzip" + $zip7 = "$(get-location)\greenshot\tools\7zip\7za.exe" + $arguments = @('a', '-mx9', '-tzip', '-r', "$destbase\Greenshot-DEBUGSYMBOLS-$fileversion.zip", "$destdbgzip\*") + Write-Host "Starting $zip7 $arguments" + $zipResult = Start-Process -wait -PassThru "$zip7" -ArgumentList $arguments -NoNewWindow -RedirectStandardOutput "$zipOutput.log" -RedirectStandardError "$zipOutput.error" + Write-Host "Log output:" + Get-Content "$zipOutput.log"| Write-Host + if ($zipResult.ExitCode -ne 0) { + Write-Host "Error output:" + Get-Content "$zipOutput.error"| Write-Host + exit -1 + } + Start-Sleep -m 1500 + Remove-Item "$destdbgzip" -Recurse -Confirm:$false return } @@ -245,5 +287,8 @@ PackageZip echo "Generating Portable" PackagePortable +echo "Generating Debug Symbols ZIP" +PackageDbgSymbolsZip + echo "build successful, tagging with $fileversion" TagCode \ No newline at end of file