From 9bed29861153571ee187716ac64ba5bc1eb008d7 Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 17 Jun 2014 14:20:00 +0200 Subject: [PATCH] Changed build to generate UNSTABLE files when the build in major.minor.build.revision is odd. Currently we are building 1.2.0 which will result in an unstable. When we change the version to 1.2.1 in AppVeyor we get releases. --- .../additional_files/readme.txt.template | 2 +- Greenshot/releases/appinfo.ini.template | 6 +++--- .../releases/innosetup/setup.iss.template | 4 ++-- build.ps1 | 18 ++++++++++++++---- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Greenshot/releases/additional_files/readme.txt.template b/Greenshot/releases/additional_files/readme.txt.template index cac8301f7..e0c6055a8 100644 --- a/Greenshot/releases/additional_files/readme.txt.template +++ b/Greenshot/releases/additional_files/readme.txt.template @@ -5,7 +5,7 @@ Apply text and shapes to the screenshot. Offers capture of window, region or ful CHANGE LOG: -@DETAILVERSION@ UNSTABLE +@DETAILVERSION@ Features: * Feature #184,#282,#486: Image editor now has a Speech bubble diff --git a/Greenshot/releases/appinfo.ini.template b/Greenshot/releases/appinfo.ini.template index e280f0f74..f72728add 100644 --- a/Greenshot/releases/appinfo.ini.template +++ b/Greenshot/releases/appinfo.ini.template @@ -1,6 +1,6 @@ [Format] Type=PortableApps.comFormat -Version=@VERSION@ +Version=2.0 [Details] Name=Greenshot Portable @@ -22,14 +22,14 @@ EULAVersion=true [Version] PackageVersion=@DETAILVERSION@ -DisplayVersion=@VERSION@ +DisplayVersion=@FILEVERSION@ [SpecialPaths] Plugins=NONE [Dependencies] UsesJava=false -UsesDotNetVersion=4.5 +UsesDotNetVersion=3.5 [Control] Icons=1 diff --git a/Greenshot/releases/innosetup/setup.iss.template b/Greenshot/releases/innosetup/setup.iss.template index 5218a878d..46b8b8e62 100644 --- a/Greenshot/releases/innosetup/setup.iss.template +++ b/Greenshot/releases/innosetup/setup.iss.template @@ -1,6 +1,6 @@ #define ExeName "Greenshot" #define Version "@VERSION@" -#define DetailVersion "@DETAILVERSION@" +#define FileVersion "@FILEVERSION@" ; Include the scripts to install .NET Framework ; See http://www.codeproject.com/KB/install/dotnetfx_innosetup_instal.aspx @@ -122,7 +122,7 @@ InfoBeforeFile=..\additional_files\readme.txt LicenseFile=..\additional_files\license.txt LanguageDetectionMethod=uilanguage MinVersion=0,5.01.2600 -OutputBaseFilename={#ExeName}-INSTALLER-{#Version} +OutputBaseFilename={#ExeName}-INSTALLER-{#FileVersion} OutputDir=..\ PrivilegesRequired=none SetupIconFile=..\..\icons\applicationIcon\icon.ico diff --git a/build.ps1 b/build.ps1 index c05959df9..56d2bb05a 100644 --- a/build.ps1 +++ b/build.ps1 @@ -24,7 +24,17 @@ $version=$env:APPVEYOR_BUILD_VERSION $gitcommit=$env:APPVEYOR_REPO_COMMIT +$gitcommit=$gitcommit.SubString(0, [math]::Min($gitcommit.Length, 6)) $detailversion=$version + '-' + $gitcommit +$release=(([version]$version).build) % 2 -eq 1 +$fileversion=$version +# Add the UNSTABLE, if we aren't a release -> the build is even. (major.minor.build.revision) +if ( ! $release) { + $fileversion=$version + "-UNSTABLE" + $detailversion=$detailversion + " UNSTABLE" +} else { + $detailversion=$detailversion + " Release" +} Write-Host "Building Greenshot $detailversion" # Create a MD5 string for the supplied filename @@ -49,7 +59,7 @@ Function FillTemplates { # Create an empty array, this will contain the replaced lines $newtext = @() foreach ($line in $template) { - $newtext += $line -replace "\@VERSION\@", $version -replace "\@DETAILVERSION\@", $detailversion + $newtext += $line -replace "\@VERSION\@", $version -replace "\@DETAILVERSION\@", $detailversion -replace "\@FILEVERSION\@", $fileversion } # Write the new information to the file $newtext | Set-Content $newfile -encoding UTF8 @@ -132,8 +142,8 @@ Function PackageZip { $destinstaller = "$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-$version.zip")) { - Remove-Item "$destbase\Greenshot-NO-INSTALLER-$version.zip" -Confirm:$false + 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")) { @@ -170,7 +180,7 @@ Function PackageZip { $zipOutput = "$(get-location)\zip" $zip7 = "$(get-location)\greenshot\tools\7zip\7za.exe" - $arguments = @('a', '-mx9', '-tzip', '-r', "$destbase\Greenshot-NO-INSTALLER-$version.zip", "$destinstaller\*") + $arguments = @('a', '-mx9', '-tzip', '-r', "$destbase\Greenshot-NO-INSTALLER-$fileversion.zip", "$destinstaller\*") Write-Host "Starting $zip7 $arguments" $zipResult = Start-Process -wait -PassThru "$zip7" -ArgumentList $arguments -NoNewWindow -RedirectStandardOutput "$zipOutput.log" -RedirectStandardError "$zipOutput.error" Write-Host "Log output:"