From c4f927eb3aefb18eae15af3fba4e921374ff2fed Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 22 Aug 2016 00:09:45 +0100 Subject: [PATCH 01/32] Add a new msbuild project with a g2 target --- openrct2.proj | 15 +++++++++++++++ openrct2.vcxproj | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 openrct2.proj diff --git a/openrct2.proj b/openrct2.proj new file mode 100644 index 0000000000..ccaa0482b6 --- /dev/null +++ b/openrct2.proj @@ -0,0 +1,15 @@ + + + + + + + + + + + $(TargetDir)openrct2.exe + + + + diff --git a/openrct2.vcxproj b/openrct2.vcxproj index aa570a658c..362a44cd55 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -1,5 +1,5 @@  - + From 5cb50f69252a7ceacc82aa96d8108f64dd210d96 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 22 Aug 2016 13:11:57 +0100 Subject: [PATCH 02/32] Add install and publish targets to msbuild project --- openrct2.proj | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/openrct2.proj b/openrct2.proj index ccaa0482b6..a5a912d22d 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -3,6 +3,15 @@ + + $(MsBuildThisFileDirectory) + $(RootDir)distribution\ + + + + + + @@ -12,4 +21,42 @@ + + + + + $(RootDir)artifacts\ + $(ArtifactsDir)temp + $(ArtifactsDir)openrct2.zip + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 8c00ad0e4fb0eff75d33cf9aedd42c239c82c590 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 22 Aug 2016 18:31:52 +0100 Subject: [PATCH 03/32] Create custom task for 7z --- openrct2.proj | 7 +++- openrct2.props | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 openrct2.props diff --git a/openrct2.proj b/openrct2.proj index a5a912d22d..58150f5e74 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -1,5 +1,9 @@ + + + + @@ -53,10 +57,9 @@ - + <_7z Output="$(OutZip)" Inputs="$(TempDir)\*" /> - diff --git a/openrct2.props b/openrct2.props new file mode 100644 index 0000000000..e5065fc6e5 --- /dev/null +++ b/openrct2.props @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + From a60643e3ca8976d56df0f42e26255e704c361f6c Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 22 Aug 2016 20:39:06 +0100 Subject: [PATCH 04/32] Add sign target to build and improve g2 target --- openrct2.proj | 52 +++++++++++++++++++++++++++++++++++++++++++++----- openrct2.props | 10 +++++++++- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 58150f5e74..b8f662a925 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -10,26 +10,50 @@ $(MsBuildThisFileDirectory) $(RootDir)distribution\ + $(RootDir)artifacts\ + + $(TargetDir)data\g2.dat + + $(DistDir)windows\code-sign-key-openrct2.org.pfx + http://timestamp.comodoca.com/authenticode - + + + + + + + + + + + - + $(TargetDir)openrct2.exe - + + + + + + + - + - $(RootDir)artifacts\ $(ArtifactsDir)temp $(ArtifactsDir)openrct2.zip @@ -62,4 +86,22 @@ + + + + $(ArtifactsDir)openrct2-symbols + $(ArtifactsDir)openrct2-symbols-$(GitSha1Short).zip + + + + + + + + + + + <_7z Output="$(OutZip)" Inputs="@(SymbolItems)" /> + + diff --git a/openrct2.props b/openrct2.props index e5065fc6e5..b6d141c4fb 100644 --- a/openrct2.props +++ b/openrct2.props @@ -23,7 +23,15 @@ return false; } - string args = "a -tzip -mx9 -mtc=off \"" + Output + "\" \"" + Inputs + "\""; + var argsSB = new StringBuilder(); + argsSB.Append("a -tzip -mx9 -mtc=off "); + argsSB.Append("\"" + Output + "\" "); + foreach (string input in Inputs.Split(';')) + { + argsSB.Append("\"" + input + "\" "); + } + string args = argsSB.ToString(); + Log.LogMessage(MessageImportance.Normal, "7z " + args); var psi = new ProcessStartInfo(appPath, args); From bc698fdc4cd842ebd83ee0b39ce9b47fbf53ba86 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 22 Aug 2016 21:45:36 +0100 Subject: [PATCH 05/32] Refactor msbuild targets --- openrct2.proj | 78 +++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index b8f662a925..2f961de628 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -12,16 +12,41 @@ $(RootDir)distribution\ $(RootDir)artifacts\ + $(TargetDir)openrct2.dll + $(TargetDir)openrct2.exe + $(TargetPath) $(TargetDir)data\g2.dat $(DistDir)windows\code-sign-key-openrct2.org.pfx http://timestamp.comodoca.com/authenticode + + $(ArtifactsDir)openrct2.zip + $(ArtifactsDir)openrct2-symbols.zip + $(ArtifactsDir)openrct2-symbols-$(GitSha1Short).zip - - + + + + + + + + + + + + + + + + + + + + @@ -30,20 +55,21 @@ + + - - - $(TargetDir)openrct2.exe - - + + - + - + $(ArtifactsDir)temp - $(ArtifactsDir)openrct2.zip - - - - - - - - - - - - @@ -81,27 +94,20 @@ - <_7z Output="$(OutZip)" Inputs="$(TempDir)\*" /> + <_7z Output="$(PublishZip)" Inputs="$(TempDir)\*" /> - - - $(ArtifactsDir)openrct2-symbols - $(ArtifactsDir)openrct2-symbols-$(GitSha1Short).zip - - - - - - + + - - - <_7z Output="$(OutZip)" Inputs="@(SymbolItems)" /> + <_7z Output="$(PublishSymbolsZip)" Inputs="@(SymbolItems)" /> + + From 6f27156abf0b9614d0a9d2bc44246d412ff8bf64 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 22 Aug 2016 21:46:09 +0100 Subject: [PATCH 06/32] Rename openrct2.props to openrct2.targets --- openrct2.proj | 2 +- openrct2.props => openrct2.targets | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename openrct2.props => openrct2.targets (100%) diff --git a/openrct2.proj b/openrct2.proj index 2f961de628..3fa87e2da6 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -2,7 +2,7 @@ - + diff --git a/openrct2.props b/openrct2.targets similarity index 100% rename from openrct2.props rename to openrct2.targets From e18eb5d8b0042f06b279327f1aa8a6fdb3951843 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 22 Aug 2016 22:30:47 +0100 Subject: [PATCH 07/32] Add NSIS installer target --- openrct2.proj | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/openrct2.proj b/openrct2.proj index 3fa87e2da6..9128dbc75a 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -12,6 +12,8 @@ $(RootDir)distribution\ $(RootDir)artifacts\ + $(DistDir)windows\install.nsi + $(TargetDir)openrct2.dll $(TargetDir)openrct2.exe $(TargetPath) @@ -23,6 +25,7 @@ $(ArtifactsDir)openrct2.zip $(ArtifactsDir)openrct2-symbols.zip $(ArtifactsDir)openrct2-symbols-$(GitSha1Short).zip + $(ArtifactsDir)openrct2-install.exe @@ -57,6 +60,7 @@ + @@ -107,7 +111,33 @@ <_7z Output="$(PublishSymbolsZip)" Inputs="@(SymbolItems)" /> + + + + -$(GitBranch)-$(GitCommitSha1Short) + $(GitTag) + -$(GitTag) + $([System.IO.Path]::GetFilename($(PublishInstallerExe))) + + + + + + + + + + + + + DependsOnTargets="PublishSymbols;PublishPortable;PublishInstaller" /> From 8c1aeb8f1f2182cc8a41fff522e13768c25bb768 Mon Sep 17 00:00:00 2001 From: Ted John Date: Tue, 23 Aug 2016 18:13:45 +0100 Subject: [PATCH 08/32] Add upload target to msbuild project --- openrct2.proj | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/openrct2.proj b/openrct2.proj index 9128dbc75a..ee2536cfe0 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -8,6 +8,8 @@ + 0.0.5 + $(MsBuildThisFileDirectory) $(RootDir)distribution\ $(RootDir)artifacts\ @@ -26,6 +28,8 @@ $(ArtifactsDir)openrct2-symbols.zip $(ArtifactsDir)openrct2-symbols-$(GitSha1Short).zip $(ArtifactsDir)openrct2-install.exe + + OpenRCT2-$(Version)$(VersionExtension)-windows @@ -52,6 +56,21 @@ + + + $(UploadFilename).zip + 1 + + + $(UploadFilename).exe + 2 + + + $(UploadFilename)-symbols.zip + 5 + + + @@ -140,4 +159,26 @@ + + + + https://openrct2.org/altapi/?command=push-build + %(UploadArtifacts.Filename)%(UploadArtifacts.Extension) + + + + + + + + From 04bf27e2c56009d475b0a04be5fb6a1e7f55b08d Mon Sep 17 00:00:00 2001 From: Ted John Date: Tue, 23 Aug 2016 18:22:06 +0100 Subject: [PATCH 09/32] Refactor msbuild property inputs --- openrct2.proj | 52 +++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index ee2536cfe0..ce31f166a1 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -1,5 +1,13 @@ + @@ -25,8 +33,8 @@ http://timestamp.comodoca.com/authenticode $(ArtifactsDir)openrct2.zip - $(ArtifactsDir)openrct2-symbols.zip - $(ArtifactsDir)openrct2-symbols-$(GitSha1Short).zip + $(ArtifactsDir)openrct2-symbols.zip + $(ArtifactsDir)openrct2-symbols-$(GIT_COMMIT_SHA1_SHORT).zip $(ArtifactsDir)openrct2-install.exe OpenRCT2-$(Version)$(VersionExtension)-windows @@ -90,13 +98,13 @@ + This requires the project parameter SIGN_PASSWORD to be set --> - - + - @@ -136,9 +144,9 @@ Inputs="@(PublishItems);$(NsisScript)" Outputs="$(PublishInstallerExe)"> - -$(GitBranch)-$(GitCommitSha1Short) - $(GitTag) - -$(GitTag) + -$(GIT_BRANCH)-$(GIT_COMMIT_SHA1_SHORT) + $(GIT_TAG) + -$(GIT_TAG) $([System.IO.Path]::GetFilename($(PublishInstallerExe))) @@ -148,11 +156,11 @@ StandardOutputImportance="normal" /> - - + - @@ -167,16 +175,16 @@ - - + + From 75095bf9e59bbe817f0beb0ce5a6113882351875 Mon Sep 17 00:00:00 2001 From: Ted John Date: Tue, 23 Aug 2016 19:24:07 +0100 Subject: [PATCH 10/32] Setup dynamic defines for build --- openrct2.proj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openrct2.proj b/openrct2.proj index ce31f166a1..2d75f6bf30 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -1,6 +1,7 @@ + OPENRCT2_BUILD_SERVER="$(BUILD_SERVER)";$(OPENRCT2_DEFINES) + OPENRCT2_BRANCH="$(GIT_BRANCH)";$(OPENRCT2_DEFINES) + OPENRCT2_COMMIT_SHA1="$(GIT_COMMIT_SHA1)";$(OPENRCT2_DEFINES) + OPENRCT2_COMMIT_SHA1_SHORT="$(GIT_COMMIT_SHA1_SHORT)";$(OPENRCT2_DEFINES) + $(MsBuildThisFileDirectory) $(RootDir)distribution\ $(RootDir)artifacts\ From 538ac7b09168f4b115eed37bfcddcac6135c877c Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 18:29:23 +0100 Subject: [PATCH 11/32] Use variables for publish items --- openrct2.proj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 2d75f6bf30..d162040469 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -62,9 +62,9 @@ + + - - From 4a759838ac6fca3ab25834396206159e263269f0 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 19:18:45 +0100 Subject: [PATCH 12/32] Prepare msbuild project for AppVeyor --- appveyor.yml | 19 ++++++++++++------- openrct2.proj | 17 +++++++++++++++-- openrct2.vcxproj | 8 ++++---- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3fb469b0eb..96850fe377 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,18 +7,23 @@ cache: environment: ENCKEY: secure: saYAIpqXzpq0U+JH+MNi/isRQ6Y51PZhm4BrnePDiAPptFO5htxFOLegrYqxdy67 - CODE-SIGN-KEY-OPENRCT2.ORG.PFX.PASSWORD: + SIGN_PASSWORD: secure: bzYmf0ElxisSGyZnIjUOYQ== - OPENRCT2.ORG_TOKEN: + OPENRCT2_ORG_TOKEN: secure: leQX3xCQpmBLGuMqrxjFlzexDt96ypNRMM5TTRVHbGE8PwVg9crgeykLc2BIZU6HDHveJCHqh2cGMdHtHYJYcw== + BUILD_SERVER: AppVeyor + GIT_TAG: ($APPVEYOR_REPO_TAG_NAME) + GIT_BRANCH: $(APPVEYOR_REPO_BRANCH) + GIT_COMMIT_SHA1: $(APPVEYOR_REPO_COMMIT) install: - ps: >- .\scripts\ps\appveyor_install.ps1 -build_script: -- ps: >- - .\setenv.ps1 - - appveyor_build +platform: + - Win32 + - x64 +configuration: Release +build: + project: openrct2.proj artifacts: - path: .\artifacts\openrct2.zip name: OpenRCT2-portable diff --git a/openrct2.proj b/openrct2.proj index d162040469..e5f5ddfff1 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -5,11 +5,10 @@ - GIT_TAG - GIT_BRANCH - GIT_COMMIT_SHA1 - - GIT_COMMIT_SHA1_SHORT - SIGN_PASSWORD - OPENRCT2_ORG_TOKEN --> - + @@ -20,6 +19,7 @@ 0.0.5 $(COMPUTERNAME) + $(GIT_COMMIT_SHA1.Substring(0, 7)) OPENRCT2_BUILD_SERVER="$(BUILD_SERVER)";$(OPENRCT2_DEFINES) @@ -99,6 +99,14 @@ + + + $(GIT_COMMIT_SHA1_SHORT) + $(BuildString) ($(GIT_BRANCH)) + + + + @@ -198,4 +206,9 @@ CustomErrorRegularExpression=""error":1" /> + + + + + diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 362a44cd55..d448e7315a 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -1,8 +1,8 @@  - - - - + + + + From 5759ab0f9dda5897640f3fb00bc3d7e2966fd5ad Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 20:17:40 +0100 Subject: [PATCH 13/32] Fix copying of data files --- openrct2.proj | 29 ++++++++++++----------------- openrct2.vcxproj | 6 +----- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index e5f5ddfff1..156fb87542 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -64,8 +64,8 @@ - - + + @@ -99,16 +99,23 @@ - + $(GIT_COMMIT_SHA1_SHORT) $(BuildString) ($(GIT_BRANCH)) + + + + + + + - + @@ -127,25 +134,13 @@ - - $(ArtifactsDir)temp - - - - - - - - <_7z Output="$(PublishZip)" Inputs="$(TempDir)\*" /> - - - + <_7z Output="$(PublishZip)" Inputs="@(PublishItems)" /> diff --git a/openrct2.vcxproj b/openrct2.vcxproj index d448e7315a..bf2b6d596d 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -1,9 +1,5 @@  - - - - - + Debug From 10deda6385d4311a5ccefacc8a5ef0391161ed34 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 20:22:09 +0100 Subject: [PATCH 14/32] Download libraries before building --- openrct2.proj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 156fb87542..546a9e0936 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -88,8 +88,9 @@ - - + + + @@ -99,7 +100,7 @@ - + $(GIT_COMMIT_SHA1_SHORT) $(BuildString) ($(GIT_BRANCH)) From 72169f681b1c748ce19be59ee9dc95f52bdf7ff5 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 20:28:30 +0100 Subject: [PATCH 15/32] Fix environment variable rename --- scripts/ps/appveyor_install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 index 92a1dcd9ef..cb304542d4 100644 --- a/scripts/ps/appveyor_install.ps1 +++ b/scripts/ps/appveyor_install.ps1 @@ -23,7 +23,7 @@ if ($env:ENCKEY) Check-ExitCode } -if (${env:OPENRCT2.ORG_TOKEN}) +if (${env:OPENRCT2_ORG_TOKEN}) { if (-not (Test-Path "C:\ProgramData\chocolatey\lib\nsis.portable")) { From ad8eb641d5cdfd23368dca5a68249a451c87c000 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 20:39:20 +0100 Subject: [PATCH 16/32] Fix error in appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 96850fe377..0508b7813a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,7 @@ environment: OPENRCT2_ORG_TOKEN: secure: leQX3xCQpmBLGuMqrxjFlzexDt96ypNRMM5TTRVHbGE8PwVg9crgeykLc2BIZU6HDHveJCHqh2cGMdHtHYJYcw== BUILD_SERVER: AppVeyor - GIT_TAG: ($APPVEYOR_REPO_TAG_NAME) + GIT_TAG: $(APPVEYOR_REPO_TAG_NAME) GIT_BRANCH: $(APPVEYOR_REPO_BRANCH) GIT_COMMIT_SHA1: $(APPVEYOR_REPO_COMMIT) install: From 2e31288b6b99f6e9f1f5a9ed0cc1fe298232c265 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 21:29:38 +0100 Subject: [PATCH 17/32] Convert tabs to spaces in install.nsi --- distribution/windows/install.nsi | 148 +++++++++++++++---------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index 3c91d2b454..70bef26323 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -41,7 +41,7 @@ Name "${APPNAMEANDVERSION} ${APPBITS}-bit for Windows ${EXTRA_VERSION}" ; NOTE: Keep trailing backslash! InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "Install Folder" !ifndef OUTFILE - !define OUTFILE "openrct2-install.exe" + !define OUTFILE "openrct2-install.exe" !endif OutFile "${OUTFILE}" CRCCheck force @@ -118,8 +118,8 @@ Section "!OpenRCT2" Section1 ; Copy the rest of the stuff SetOutPath "$INSTDIR\" - ; Copy curl ca file - File ..\..\curl-ca-bundle.crt + ; Copy curl ca file + File ..\..\curl-ca-bundle.crt ; Copy text files File ..\changelog.txt @@ -363,88 +363,88 @@ FunctionEnd ; $var=1 Version1 is newer ; $var=2 Version2 is newer Function VersionCompare - !define VersionCompare `!insertmacro VersionCompareCall` + !define VersionCompare `!insertmacro VersionCompareCall` - !macro VersionCompareCall _VER1 _VER2 _RESULT - Push `${_VER1}` - Push `${_VER2}` - Call VersionCompare - Pop ${_RESULT} - !macroend + !macro VersionCompareCall _VER1 _VER2 _RESULT + Push `${_VER1}` + Push `${_VER2}` + Call VersionCompare + Pop ${_RESULT} + !macroend - Exch $1 - Exch - Exch $0 - Exch - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - Push $7 + Exch $1 + Exch + Exch $0 + Exch + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + Push $7 - begin: - StrCpy $2 -1 - IntOp $2 $2 + 1 - StrCpy $3 $0 1 $2 - StrCmp $3 '' +2 - StrCmp $3 '.' 0 -3 - StrCpy $4 $0 $2 - IntOp $2 $2 + 1 - StrCpy $0 $0 '' $2 + begin: + StrCpy $2 -1 + IntOp $2 $2 + 1 + StrCpy $3 $0 1 $2 + StrCmp $3 '' +2 + StrCmp $3 '.' 0 -3 + StrCpy $4 $0 $2 + IntOp $2 $2 + 1 + StrCpy $0 $0 '' $2 - StrCpy $2 -1 - IntOp $2 $2 + 1 - StrCpy $3 $1 1 $2 - StrCmp $3 '' +2 - StrCmp $3 '.' 0 -3 - StrCpy $5 $1 $2 - IntOp $2 $2 + 1 - StrCpy $1 $1 '' $2 + StrCpy $2 -1 + IntOp $2 $2 + 1 + StrCpy $3 $1 1 $2 + StrCmp $3 '' +2 + StrCmp $3 '.' 0 -3 + StrCpy $5 $1 $2 + IntOp $2 $2 + 1 + StrCpy $1 $1 '' $2 - StrCmp $4$5 '' equal + StrCmp $4$5 '' equal - StrCpy $6 -1 - IntOp $6 $6 + 1 - StrCpy $3 $4 1 $6 - StrCmp $3 '0' -2 - StrCmp $3 '' 0 +2 - StrCpy $4 0 + StrCpy $6 -1 + IntOp $6 $6 + 1 + StrCpy $3 $4 1 $6 + StrCmp $3 '0' -2 + StrCmp $3 '' 0 +2 + StrCpy $4 0 - StrCpy $7 -1 - IntOp $7 $7 + 1 - StrCpy $3 $5 1 $7 - StrCmp $3 '0' -2 - StrCmp $3 '' 0 +2 - StrCpy $5 0 + StrCpy $7 -1 + IntOp $7 $7 + 1 + StrCpy $3 $5 1 $7 + StrCmp $3 '0' -2 + StrCmp $3 '' 0 +2 + StrCpy $5 0 - StrCmp $4 0 0 +2 - StrCmp $5 0 begin newer2 - StrCmp $5 0 newer1 - IntCmp $6 $7 0 newer1 newer2 + StrCmp $4 0 0 +2 + StrCmp $5 0 begin newer2 + StrCmp $5 0 newer1 + IntCmp $6 $7 0 newer1 newer2 - StrCpy $4 '1$4' - StrCpy $5 '1$5' - IntCmp $4 $5 begin newer2 newer1 + StrCpy $4 '1$4' + StrCpy $5 '1$5' + IntCmp $4 $5 begin newer2 newer1 - equal: - StrCpy $0 0 - goto end - newer1: - StrCpy $0 1 - goto end - newer2: - StrCpy $0 2 + equal: + StrCpy $0 0 + goto end + newer1: + StrCpy $0 1 + goto end + newer2: + StrCpy $0 2 - end: - Pop $7 - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Exch $0 + end: + Pop $7 + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Exch $0 FunctionEnd From 7df67e3a2967a92929810337ce1c9edd1bf4bc15 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 22:17:15 +0100 Subject: [PATCH 18/32] Improve NSIS installer and add x64 logic --- distribution/windows/install.nsi | 66 ++++++++++++++++++++------------ distribution/windows/win32.txt | 5 --- openrct2.proj | 5 ++- 3 files changed, 46 insertions(+), 30 deletions(-) delete mode 100644 distribution/windows/win32.txt diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index 70bef26323..120d2b99f3 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -3,18 +3,34 @@ !define /ifndef APPV_MINOR 0 !define /ifndef APPV_MAINT 5 !define /ifndef APPV_BUILD 0 -!define /ifndef APPV_EXTRA "-beta" -!define APPNAME "OpenRCT2" ; Define application name -!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version -!define APPVERSIONINTERNAL "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}.${APPV_BUILD}" ; Define application version in X.X.X.X -!include ${VERSION_INCLUDE} +!define APPNAME "OpenRCT2" +!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" +!define APPVERSIONINTERNAL "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}.${APPV_BUILD}" !define /ifndef APPURLLINK "https://github.com/OpenRCT2/OpenRCT2" !define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}" +!if "${PLATFORM}" == "Win32" + !define OPENRCT2_EXE "openrct2.exe" + !define OPENRCT2_DLL "openrct2.dll" + !define APPBITS 32 + !define APPARCH "win32" + + InstallDir "$PROGRAMFILES32\OpenRCT2\" +!else + !define OPENRCT2_EXE "openrct2_x64.exe" + !define APPBITS 64 + !define APPARCH "win64" + + InstallDir "$PROGRAMFILES64\OpenRCT2\" +!endif + +!define SUPPORTED_OS "Windows Vista, 7, 8.1 and 10" + ; Define root variable relative to installer !define PATH_ROOT "..\..\" +!define BINARY_DIR "${PATH_ROOT}bin" !define MUI_ICON "${PATH_ROOT}resources\logo\icon.ico" !define MUI_UNICON "${PATH_ROOT}resources\logo\icon.ico" @@ -27,7 +43,7 @@ SetCompressor LZMA ; Version Info VIProductVersion "${APPVERSIONINTERNAL}" -VIAddVersionKey "ProductName" "OpenRCT2 ${APPBITS}-bit Installer for Windows ${EXTRA_VERSION}" +VIAddVersionKey "ProductName" "OpenRCT2 ${APPBITS}-bit Installer for ${SUPPORTED_OS}" VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}" VIAddVersionKey "CompanyName" "OpenRCT2 Developers" VIAddVersionKey "FileDescription" "Installs ${APPNAMEANDVERSION}" @@ -36,7 +52,7 @@ VIAddVersionKey "InternalName" "InstOpenRCT2-${APPARCH}" VIAddVersionKey "FileVersion" "${APPVERSION}-${APPARCH}" VIAddVersionKey "LegalCopyright" " " ; Main Install settings -Name "${APPNAMEANDVERSION} ${APPBITS}-bit for Windows ${EXTRA_VERSION}" +Name "${APPNAMEANDVERSION} ${APPBITS}-bit for ${SUPPORTED_OS}" ; NOTE: Keep trailing backslash! InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "Install Folder" @@ -83,7 +99,7 @@ ManifestDPIAware true !define MUI_FINISHPAGE_TITLE_3LINES !define MUI_FINISHPAGE_RUN_TEXT "Run ${APPNAMEANDVERSION} now!" -!define MUI_FINISHPAGE_RUN "$INSTDIR\openrct2.exe" +!define MUI_FINISHPAGE_RUN "$INSTDIR\${OPENRCT2_EXE}" !define MUI_FINISHPAGE_LINK "Visit the OpenRCT2 site for more information" !define MUI_FINISHPAGE_LINK_LOCATION "${APPURLLINK}" !define MUI_FINISHPAGE_NOREBOOTSUPPORT @@ -139,12 +155,14 @@ Section "!OpenRCT2" Section1 Call unix2dos ; Copy executable - File /oname=openrct2.exe ${BINARY_DIR}\openrct2.exe - File /oname=openrct2.dll ${BINARY_DIR}\openrct2.dll + File /oname=${OPENRCT2_EXE} ${BINARY_DIR}\${OPENRCT2_EXE} +!ifdef OPENRCT2_DLL + File /oname=${OPENRCT2_DLL} ${BINARY_DIR}\${OPENRCT2_DLL} +!endif ; Create the Registry Entries WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "Comments" "Visit ${APPURLLINK}" - WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "DisplayIcon" "$INSTDIR\openrct2.exe,0" + WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "DisplayIcon" "$INSTDIR\${OPENRCT2_EXE},0" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "DisplayName" "OpenRCT2 ${APPVERSION}" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "DisplayVersion" "${APPVERSION}" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "HelpLink" "${APPURLLINK}" @@ -157,9 +175,9 @@ Section "!OpenRCT2" Section1 WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "Version" "${APPVERSIONINTERNAL}" !insertmacro MUI_STARTMENU_WRITE_BEGIN "OpenRCT2" - CreateShortCut "$DESKTOP\OpenRCT2.lnk" "$INSTDIR\openrct2.exe" + CreateShortCut "$DESKTOP\OpenRCT2.lnk" "$INSTDIR\${OPENRCT2_EXE}" CreateDirectory "$SMPROGRAMS\$SHORTCUTS" - CreateShortCut "$SMPROGRAMS\$SHORTCUTS\OpenRCT2.lnk" "$INSTDIR\openrct2.exe" + CreateShortCut "$SMPROGRAMS\$SHORTCUTS\OpenRCT2.lnk" "$INSTDIR\${OPENRCT2_EXE}" CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Uninstall.lnk" "$INSTDIR\uninstall.exe" CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Readme.lnk" "$INSTDIR\Readme.txt" CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Changelog.lnk" "$INSTDIR\Changelog.txt" @@ -201,23 +219,23 @@ Section "Uninstall" Delete "$SMPROGRAMS\$SHORTCUTS\Contributors.lnk" ; Clean up OpenRCT2 dir + Delete "$INSTDIR\curl-ca-bundle.crt" Delete "$INSTDIR\changelog.txt" + Delete "$INSTDIR\known_issues.txt" + Delete "$INSTDIR\licence.txt" Delete "$INSTDIR\readme.txt" Delete "$INSTDIR\contributors.md" - Delete "$INSTDIR\openrct2.exe" - Delete "$INSTDIR\openrct2.dll" - Delete "$INSTDIR\licence.txt" + Delete "$INSTDIR\${OPENRCT2_EXE}" +!ifdef OPENRCT2_DLL + Delete "$INSTDIR\${OPENRCT2_DLL}" +!endif Delete "$INSTDIR\INSTALL.LOG" - Delete "$INSTDIR\crash.log" - Delete "$INSTDIR\crash.dmp" ; Data files - Delete "$INSTDIR\data\language\*.txt" - Delete "$INSTDIR\data\title\*.*" + RMDir /r "$INSTDIR\data" ; Remove remaining directories RMDir "$SMPROGRAMS\$SHORTCUTS" - RMDir "$INSTDIR\data" RMDir "$INSTDIR" SectionEnd @@ -285,13 +303,13 @@ FunctionEnd ;------------------------------------------------------------------------------- ; Check whether OpenRCT2 is running Function CheckOpenRCT2Running - IfFileExists "$INSTDIR\openrct2.exe" 0 Done + IfFileExists "$INSTDIR\${OPENRCT2_EXE}" 0 Done Retry: - FindProcDLL::FindProc "openrct2.exe" + FindProcDLL::FindProc "${OPENRCT2_EXE}" Pop $R0 IntCmp $R0 1 0 Done ClearErrors - Delete "$INSTDIR\openrct2.exe" + Delete "$INSTDIR\${OPENRCT2_EXE}" IfErrors 0 Done ClearErrors MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "OpenRCT2 is running. Please close it and retry." IDRETRY Retry diff --git a/distribution/windows/win32.txt b/distribution/windows/win32.txt deleted file mode 100644 index a33ea783b6..0000000000 --- a/distribution/windows/win32.txt +++ /dev/null @@ -1,5 +0,0 @@ -!define APPBITS 32 ; Define number of bits for the architecture -!define EXTRA_VERSION "Vista, 7, 8.1 and 10" -!define APPARCH "win32" ; Define the application architecture -!define BINARY_DIR "${PATH_ROOT}bin" -InstallDir "$PROGRAMFILES32\OpenRCT2\" diff --git a/openrct2.proj b/openrct2.proj index 546a9e0936..4dd7b65276 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -165,7 +165,10 @@ - From ff9e249a8549aaa43aaae853a1db66bf2341e08f Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 22:35:19 +0100 Subject: [PATCH 19/32] Fix inverse condition of BUILD_SERVER --- openrct2.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openrct2.proj b/openrct2.proj index 4dd7b65276..923310ff0d 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -18,7 +18,7 @@ 0.0.5 - $(COMPUTERNAME) + $(COMPUTERNAME) $(GIT_COMMIT_SHA1.Substring(0, 7)) From 0b2341ab8e0085a02dce22e9bf06aba7a8f87476 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 23:07:02 +0100 Subject: [PATCH 20/32] Improve artifact building --- appveyor.yml | 6 +++--- openrct2.proj | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0508b7813a..d71950fc82 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,9 +25,9 @@ configuration: Release build: project: openrct2.proj artifacts: -- path: .\artifacts\openrct2.zip +- path: .\artifacts\openrct2-portable*.zip name: OpenRCT2-portable -- path: .\artifacts\*.exe +- path: .\artifacts\openrct2-installer*.exe name: OpenRCT2-installer -- path: .\artifacts\openrct2-symbols-*.zip +- path: .\artifacts\openrct2-symbols*.zip name: OpenRCT2 debug symbols diff --git a/openrct2.proj b/openrct2.proj index 923310ff0d..850ddeb6ef 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -41,10 +41,12 @@ $(DistDir)windows\code-sign-key-openrct2.org.pfx http://timestamp.comodoca.com/authenticode - $(ArtifactsDir)openrct2.zip - $(ArtifactsDir)openrct2-symbols.zip - $(ArtifactsDir)openrct2-symbols-$(GIT_COMMIT_SHA1_SHORT).zip - $(ArtifactsDir)openrct2-install.exe + -$(Configuration)-$(Platform)-$(GIT_COMMIT_SHA1_SHORT) + $(PublishPostfix.ToLower()) + $(ArtifactsDir)openrct2-portable$(PublishPostfix).zip + $(ArtifactsDir)openrct2-symbols$(PublishPostfix).zip + $(ArtifactsDir)openrct2-symbols$(PublishPostfix).zip + $(ArtifactsDir)openrct2-installer$(PublishPostfix).exe OpenRCT2-$(Version)$(VersionExtension)-windows @@ -94,10 +96,13 @@ + + + @@ -135,19 +140,15 @@ - - - - - + <_7z Output="$(PublishZip)" Inputs="@(PublishItems)" /> - + <_7z Output="$(PublishSymbolsZip)" Inputs="@(SymbolItems)" /> @@ -163,6 +164,8 @@ $([System.IO.Path]::GetFilename($(PublishInstallerExe))) + + + Outputs="$(PublishInstallerExe)" + Condition="'$(NO_NSIS)'!='true'"> -$(GIT_BRANCH)-$(GIT_COMMIT_SHA1_SHORT) $(GIT_TAG) diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 index cb304542d4..4125dfa2a3 100644 --- a/scripts/ps/appveyor_install.ps1 +++ b/scripts/ps/appveyor_install.ps1 @@ -43,3 +43,20 @@ if (${env:OPENRCT2_ORG_TOKEN}) cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" } } + +# Check if OpenRCT2.org API security token is available +if (${env:OPENRCT2_ORG_TOKEN}) +{ + # Only upload tagged builds, develop branch or push/ branches + if (${env:APPVEYOR_REPO_TAG} -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/") + { + # Remove the OPENRCT2_ORG_TOKEN environment variable so that the msbuild will not + # try to upload the artifacts + ${env:OPENRCT2_ORG_TOKEN} = $null + } +} +else +{ + # Don't build the NSIS installer for non-uploaded builds + ${env:NO_NSIS} = "true" +} From 76b0e3158b6a5b86551c68c59f4ddf5c90c9bace Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 23:49:59 +0100 Subject: [PATCH 22/32] Delete obsolete scripts [ciskip] --- scripts/ps/appveyor_build.ps1 | 161 ----------------- scripts/ps/build.ps1 | 90 ---------- scripts/ps/publish.ps1 | 326 ---------------------------------- 3 files changed, 577 deletions(-) delete mode 100644 scripts/ps/appveyor_build.ps1 delete mode 100644 scripts/ps/build.ps1 delete mode 100644 scripts/ps/publish.ps1 diff --git a/scripts/ps/appveyor_build.ps1 b/scripts/ps/appveyor_build.ps1 deleted file mode 100644 index 6d87e22bb8..0000000000 --- a/scripts/ps/appveyor_build.ps1 +++ /dev/null @@ -1,161 +0,0 @@ -######################################################### -# Script to build OpenRCT2 on AppVeyor -######################################################### - -function Push-Build($file, $name, $version, $flavourId) -{ - curl.exe -s -o - ` - --form "key=${env:OPENRCT2.ORG_TOKEN}" ` - --form "fileName=$name" ` - --form "version=$version" ` - --form "gitHash=${env:APPVEYOR_REPO_COMMIT}" ` - --form "gitBranch=${env:APPVEYOR_REPO_BRANCH}" ` - --form "flavourId=$flavourId" ` - --form "file=@$file" ` - "https://openrct2.org/altapi/?command=push-build" -} - -$server = "AppVeyor" - -# Provide a short commit SHA1 too -${env:APPVEYOR_REPO_COMMIT_SHORT} = (${env:APPVEYOR_REPO_COMMIT}).Substring(0, 7) - -# Current version -$version = "0.0.5.0" - -# Tagged builds will hide branch and commit SHA1 -$tag = $null -if (${env:APPVEYOR_REPO_TAG} -ne $null) -{ - $tag = ${env:APPVEYOR_REPO_TAG_NAME} -} - -# Enable code signing if password environment variable is set -$codeSign = $false -if (${env:CODE-SIGN-KEY-OPENRCT2.ORG.PFX.PASSWORD} -ne $null) -{ - $codeSign = $true -} - -# Enable pushing builds to OpenRCT2.org if token environment variable is set -$pushBuilds = $false -$installer = $false -$symbols = $true -if (${env:OPENRCT2.ORG_TOKEN} -ne $null) -{ - $installer = $true - - if ($tag -ne $null -or $env:APPVEYOR_REPO_BRANCH -match "^develop$|^push/") - { - $pushBuilds = $true - } -} - -# Write out summary of the build -Write-Host "AppVeyor CI Build" -ForegroundColor Green -if ($tag -ne $null) -{ - Write-Host " $version ($tag)" -ForegroundColor Green -} -else -{ - Write-Host " $version-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT_SHORT" -ForegroundColor Green -} -Write-Host " Signed: $codeSign" -ForegroundColor Green -Write-Host " Push : $pushBuilds" -ForegroundColor Green - -# Install dependencies -install -Quiet - -# Build OpenRCT2 -publish build ` - -Server $server ` - -GitTag $tag ` - -GitBranch $env:APPVEYOR_REPO_BRANCH ` - -GitSha1 $env:APPVEYOR_REPO_COMMIT ` - -GitSha1Short $env:APPVEYOR_REPO_COMMIT_SHORT ` - -CodeSign $codeSign - -if ($LASTEXITCODE -ne 0) -{ - exit 1 -} - -# Create a Portable ZIP -publish package ` - -Server $server ` - -GitTag $tag ` - -GitBranch $env:APPVEYOR_REPO_BRANCH ` - -GitSha1 $env:APPVEYOR_REPO_COMMIT ` - -GitSha1Short $env:APPVEYOR_REPO_COMMIT_SHORT ` - -CodeSign $codeSign - -# Create an Installer -if ($installer) -{ - publish package ` - -Installer ` - -Server $server ` - -GitTag $tag ` - -GitBranch $env:APPVEYOR_REPO_BRANCH ` - -GitSha1 $env:APPVEYOR_REPO_COMMIT ` - -GitSha1Short $env:APPVEYOR_REPO_COMMIT_SHORT ` - -CodeSign $codeSign -} - -if ($symbols) -{ - publish package ` - -Symbols ` - -Server $server ` - -GitTag $tag ` - -GitBranch $env:APPVEYOR_REPO_BRANCH ` - -GitSha1 $env:APPVEYOR_REPO_COMMIT ` - -GitSha1Short $env:APPVEYOR_REPO_COMMIT_SHORT ` - -CodeSign $codeSign -} - -if ($pushBuilds) -{ - $versionExtension = "" - if ($tag -ne $null) - { - # Hide tag if it is a version - if ($GitTag -notmatch "^v[0-9]") - { - $versionExtension = "-$tag" - } - } - else - { - $versionExtension = "-${env:APPVEYOR_REPO_BRANCH}-${env:APPVEYOR_REPO_COMMIT_SHORT}" - } - $pushFileName = "OpenRCT2-${version}${versionExtension}-windows" - - # Push portable zip - Write-Host "Sending portable zip to OpenRCT2.org" -ForegroundColor Cyan - Push-Build -file ".\artifacts\openrct2.zip" ` - -name "$pushFileName.zip" ` - -version $version ` - -flavourId 1 - - # Push installer - if ($installer) - { - Write-Host "Sending installer to OpenRCT2.org" -ForegroundColor Cyan - Push-Build -file ".\artifacts\openrct2-install.exe" ` - -name "$pushFileName.exe" ` - -version $version ` - -flavourId 2 - } - - # Push symbols - if ($symbols) - { - Write-Host "Sending symbols to OpenRCT2.org" -ForegroundColor Cyan - Push-Build -file ".\artifacts\openrct2-symbols-${env:APPVEYOR_REPO_COMMIT_SHORT}.zip" ` - -name "$pushFileName-symbols.zip" ` - -version $version ` - -flavourId 5 - } -} diff --git a/scripts/ps/build.ps1 b/scripts/ps/build.ps1 deleted file mode 100644 index 3a908184e2..0000000000 --- a/scripts/ps/build.ps1 +++ /dev/null @@ -1,90 +0,0 @@ -######################################################### -# Script to build different parts of OpenRCT2 -######################################################### -[CmdletBinding()] -param ( - [Parameter(Mandatory = $false, Position = 1)] - [string]$Task = "openrct2", - - [Parameter(Mandatory = $false)] - [string]$Configuration = "Release", - - [Parameter(Mandatory = $false)] - [switch]$Rebuild = $false, - - [Parameter(Mandatory = $false)] - [switch]$Breakpad = $false -) - -# Setup -$ErrorActionPreference = "Stop" -$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path -Import-Module "$scriptsPath\common.psm1" -DisableNameChecking - -# Get paths -$rootPath = Get-RootPath -$binPath = Join-Path $rootPath "bin" -$openrct2Path = Join-Path $binPath "openrct2.exe" - -function Build-Data() -{ - $dataPath = "$rootPath\data" - $binDataPath = "$binPath\data" - - # Create data directory in bin - Write-Host "Create data directory..." -ForegroundColor Cyan - New-Item -Force -ItemType Directory $binDataPath > $null - - # Create symlinks - Symlink-or-Copy "$binDataPath\language" "$dataPath\language" > $null - Symlink-or-Copy "$binDataPath\shaders" "$dataPath\shaders" > $null - Symlink-or-Copy "$binDataPath\title" "$dataPath\title" > $null - - return 0 -} - -function Build-OpenRCT2() -{ - Write-Host "Building OpenRCT2 ($Configuration)..." -ForegroundColor Cyan - - $target = "" - if ($Rebuild) - { - $target = "/t:rebuild" - } - msbuild $rootPath\openrct2.sln /p:Breakpad=$Breakpad /p:Configuration=$Configuration /p:Platform=Win32 $target /v:minimal | Write-Host - return $LASTEXITCODE -} - -function Build-G2() -{ - # Check if OpenRCT2 binary exists - if (-not (Test-Path $openrct2Path)) - { - Write-Host "You must build OpenRCT2 first before g2.dat can be built." -ForegroundColor Red - return 1 - } - - Write-Host "Building g2.dat..." -ForegroundColor Cyan - & $openrct2Path sprite build "$binPath\data\g2.dat" "$rootPath\resources\g2" - return $LASTEXITCODE -} - -function Build-All() -{ - if (($result = (Build-Data )) -ne 0) { return $result } - if (($result = (Build-OpenRCT2)) -ne 0) { return $result } - if (($result = (Build-G2 )) -ne 0) { return $result } -} - -# Script entry point -switch ($Task) -{ - "data" { $result = Build-Data } - "openrct2" { $result = Build-OpenRCT2 } - "g2" { $result = Build-G2 } - "all" { $result = Build-All } - default { Write-Host "Unknown build task." -ForegroundColor Red - $result = 1 } -} -exit $result diff --git a/scripts/ps/publish.ps1 b/scripts/ps/publish.ps1 deleted file mode 100644 index 85cd9f5442..0000000000 --- a/scripts/ps/publish.ps1 +++ /dev/null @@ -1,326 +0,0 @@ -######################################################### -# Script to build and package OpenRCT2 -# - Sets the source code preprocessor defines -# - Builds a clean release of OpenRCT2 -# - Creates a ZIP for distribution -######################################################### -param ( - [Parameter(Position = 1)] - [string]$Task = "all", - - [string]$Server = "", - [string]$GitTag = "", - [string]$GitBranch = "", - [string]$GitSha1 = "", - [string]$GitSha1Short = "", - [bool] $CodeSign = $false, - [switch]$Installer = $false, - [switch]$Symbols = $false -) - -if (-not $GitTag) -{ - if (-not $GitBranch) - { - $GitBranch = (git rev-parse --abbrev-ref HEAD) - } - if (-not $GitCommitSha1) - { - $GitCommitSha1 = (git rev-parse HEAD) - } - if (-not $GitCommitSha1Short) - { - $GitCommitSha1Short = (git rev-parse --short HEAD) - } -} - -# Setup -$ErrorActionPreference = "Stop" -$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path -Import-Module "$scriptsPath\common.psm1" -DisableNameChecking - -# Get paths -$rootPath = Get-RootPath - -# Set build attributes -function Do-PrepareSource() -{ - Write-Host "Setting build #defines..." -ForegroundColor Cyan - $defines = @{ } - $defines["OPENRCT2_BUILD_SERVER"] = $Server; - if ($GitTag -ne "") - { - # Hide tag if it is a version - if ($GitTag -match "^v[0-9]") - { - $defines["OPENRCT2_BRANCH"] = ""; - } - else - { - $defines["OPENRCT2_BRANCH"] = $GitTag; - } - } - else - { - $defines["OPENRCT2_BRANCH"] = $GitBranch; - $defines["OPENRCT2_COMMIT_SHA1"] = $GitCommitSha1; - $defines["OPENRCT2_COMMIT_SHA1_SHORT"] = $GitCommitSha1Short; - } - - $defineString = "" - foreach ($key in $defines.Keys) { - $value = $defines[$key] - if ($value -is [System.String]) { - $value = $value.Replace('"', '\"') - } - $defineString += "$key=""$value"";"; - } - - # Set the environment variable which the msbuild project will use - $env:OPENRCT2_DEFINES = $defineString; - - return 0 -} - -# Building OpenRCT2 -function Do-Build() -{ - Write-Host "Building OpenRCT2..." -ForegroundColor Cyan - & "$scriptsPath\build.ps1" all -Rebuild -Breakpad - if ($LASTEXITCODE -ne 0) - { - Write-Host "Failed to build OpenRCT2" -ForegroundColor Red - return 1 - } - - if ($CodeSign) - { - $releaseDir = "$rootPath\bin" - $exePath = "$releaseDir\openrct2.exe" - $dllPath = "$releaseDir\openrct2.dll" - - if (-not (Sign-Binary($exePath))) { return 1 } - if (-not (Sign-Binary($dllPath))) { return 1 } - } - - return 0 -} - -# Symbols -function Do-Symbols() -{ - Write-Host "Publishing OpenRCT2 debug symbols as zip..." -ForegroundColor Cyan - $artifactsDir = "$rootPath\artifacts" - $releaseDir = "$rootPath\bin" - $outZip = "$rootPath\artifacts\openrct2-symbols-$GitSha1Short.zip" - - Copy-Item -Force "$releaseDir\openrct2.pdb" $artifactsDir -ErrorAction Stop - Copy-Item -Force "$releaseDir\openrct2.dll" $artifactsDir -ErrorAction Stop - - # Create archive using 7z (renowned for speed and compression) - $7zcmd = "7za" - if (-not (AppExists($7zcmd))) - { - # AppVeyor in particular uses '7z' instead - $7zcmd = "7z" - if (-not (AppExists($7zcmd))) - { - Write-Host "Publish script requires 7z to be in PATH" -ForegroundColor Red - return 1 - } - } - & $7zcmd a -tzip -mx9 -mtc=off $outZip "$artifactsDir\openrct2.pdb" "$artifactsDir\openrct2.dll" > $null - if ($LASTEXITCODE -ne 0) - { - Write-Host "Failed to create zip." -ForegroundColor Red - return 1 - } - Remove-Item -Force -Recurse "$artifactsDir\openrct2.pdb" -ErrorAction SilentlyContinue - return 0 -} - -# Package -function Do-Package() -{ - Write-Host "Publishing OpenRCT2 as zip..." -ForegroundColor Cyan - $releaseDir = "$rootPath\bin" - $distDir = "$rootPath\distribution" - $tempDir = "$rootPath\artifacts\temp" - $outZip = "$rootPath\artifacts\openrct2.zip" - - # Create new temp directory - Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue - New-Item -Force -ItemType Directory $tempDir > $null - - # Copy files to be archived - Copy-Item -Force -Recurse "$releaseDir\data" $tempDir -ErrorAction Stop - Copy-Item -Force "$releaseDir\openrct2.exe" $tempDir -ErrorAction Stop - Copy-Item -Force "$releaseDir\openrct2.dll" $tempDir -ErrorAction Stop - Copy-Item -Force "$releaseDir\curl-ca-bundle.crt" $tempDir -ErrorAction Stop - Copy-Item -Force "$distDir\changelog.txt" $tempDir -ErrorAction Stop - Copy-Item -Force "$distDir\known_issues.txt" $tempDir -ErrorAction Stop - Copy-Item -Force "$distDir\readme.txt" $tempDir -ErrorAction Stop - Copy-Item -Force "$rootPath\contributors.md" $tempDir -ErrorAction Stop - Copy-Item -Force "$rootPath\licence.txt" $tempDir -ErrorAction Stop - - # Create archive using 7z (renowned for speed and compression) - $7zcmd = "7za" - if (-not (AppExists($7zcmd))) - { - # AppVeyor in particular uses '7z' instead - $7zcmd = "7z" - if (-not (AppExists($7zcmd))) - { - Write-Host "Publish script requires 7z to be in PATH" -ForegroundColor Red - return 1 - } - } - & $7zcmd a -tzip -mx9 -mtc=off $outZip "$tempDir\*" > $null - if ($LASTEXITCODE -ne 0) - { - Write-Host "Failed to create zip." -ForegroundColor Red - return 1 - } - - # Remove temp directory - Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue - return 0 -} - -# Installer -function Do-Installer() -{ - Write-Host "Publishing OpenRCT2 as installer..." -ForegroundColor Cyan - $artifactsDir = "$rootPath\artifacts" - $installerDir = "$rootPath\distribution\windows" - - # Create artifacts directory - New-Item -Force -ItemType Directory $artifactsDir > $null - - # Resolve version extension - $VersionExtra = "" - if ($GitTag -ne "") - { - # Hide tag if it is a version - if ($GitTag -notmatch "^v[0-9]") - { - $VersionExtra = "-$GitTag"; - } - } - else - { - $VersionExtra = "-$GitBranch-$GitCommitSha1Short" - } - - # Create installer - & "$installerDir\build.ps1" -VersionExtra $VersionExtra - if ($LASTEXITCODE -ne 0) - { - Write-Host "Failed to create installer." -ForegroundColor Red - if (Test-Path -PathType Leaf "$installerDir\win32.log") - { - Get-Content "$installerDir\win32.log" | Write-Host - } - return 1 - } - - $binaries = (Get-ChildItem "$installerDir\*.exe" | Sort-Object -Property LastWriteTime -Descending) - if ($binaries -eq 0) - { - Write-Host "Unable to find created installer." -ForegroundColor Red - return 1 - } - - $installerPath = $binaries[0].FullName - - if ($CodeSign) - { - if (-not (Sign-Binary($installerPath))) { return 1 } - } - - Move-Item -Force $installerPath "$artifactsDir\openrct2-install.exe" - return 0 -} - -function Do-Task-Build() -{ - if (($result = (Do-PrepareSource)) -ne 0) { return $result } - if (($result = (Do-Build )) -ne 0) { return $result } - return 0 -} - -function Do-Task-Package() -{ - if ($Installer) - { - if (($result = (Do-Installer)) -ne 0) { return $result } - } - elseif ($Symbols) - { - if (($result = (Do-Symbols)) -ne 0) { return $result } - } - else - { - if (($result = (Do-Package)) -ne 0) { return $result } - } - return 0 -} - -function Do-Task-All() -{ - if (($result = (Do-Task-Build )) -ne 0) { return $result } - if (($result = (Do-Task-Package)) -ne 0) { return $result } - return 0 -} - -function Sign-Binary($binaryPath) -{ - $pfxPath = "$rootPath\distribution\windows\code-sign-key-openrct2.org.pfx" - $pfxPassword = ${env:CODE-SIGN-KEY-OPENRCT2.ORG.PFX.PASSWORD} - $timestampUrl = "http://timestamp.comodoca.com/authenticode" - - if (-not (Test-Path -PathType Leaf $pfxPath)) - { - Write-Host "Unable to sign, code signature key was not found." -ForegroundColor Red - return 1 - } - - if ($pfxPassword -eq $null) - { - Write-Host "Unable to sign, %CODE-SIGN-KEY-OPENRCT2.ORG.PFX.PASSWORD% was not set." -ForegroundColor Red - return 1 - } - - # Resolve signtool path - $signtoolcmd = "signtool" - if (-not (AppExists($signtoolcmd))) - { - $signtoolcmd = "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\SignTool.exe" - if (-not (AppExists($signtoolcmd))) - { - Write-Host "Publish script requires signtool to be in PATH" -ForegroundColor Red - return 1 - } - } - - # Sign the binary - & $signtoolcmd sign /f $pfxPath /p $pfxPassword /t $timestampUrl $binaryPath - if ($LASTEXITCODE -ne 0) - { - Write-Host "Failed to sign binary." -ForegroundColor Red - return 1 - } - - return 0 -} - -# Script entry point -switch ($Task) -{ - "build" { $result = Do-Task-Build } - "package" { $result = Do-Task-Package } - "all" { $result = Do-Task-All } - default { Write-Host "Unknown publish task." -ForegroundColor Red - $result = 1 } -} -exit $result From ea2e5f3273391293472a5317fbf08e96c72af0fb Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 25 Aug 2016 23:58:43 +0100 Subject: [PATCH 23/32] Update readme.md [ciskip] --- readme.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index 8598256e73..93d8a1d139 100644 --- a/readme.md +++ b/readme.md @@ -48,7 +48,8 @@ OpenRCT2 requires original files of RollerCoaster Tycoon 2 to play. It can be bo ### Windows: - Vista / 7 / 8 / 10 - Visual Studio 2015 Update 2 (Enterprise / Professional / [Community (Free)](https://www.visualstudio.com/products/visual-studio-community-vs)) -- [Powershell 4.0](http://social.technet.microsoft.com/wiki/contents/articles/21016.how-to-install-windows-powershell-4-0.aspx). +- [7-Zip](http://www.7-zip.org/) (for deployment only) +- [NSIS](http://nsis.sourceforge.net/) (for deployment only) ### Mac: - [Homebrew](http://brew.sh) @@ -66,13 +67,18 @@ All libs listed here (bar cmake) required in 32 bit variants. ## 3.2 Compiling and running ### Windows: 1. Check out the repository. This can be done using [GitHub Desktop](https://desktop.github.com) or [other tools](https://help.github.com/articles/which-remote-url-should-i-use). -2. Open a new Developer Command Prompt for VS2015, run PowerShell and then navigate to the repository. -3. Run the ```setenv.ps1``` script in the repository to set up your PowerShell environment for OpenRCT2 development. This will warn you of any missing applications required to build OpenRCT2. -4. Run ```install``` to download the required dependencies to build OpenRCT2. -5. Run ```build all``` to build all the required components for OpenRCT2. -6. Run ```run``` to run OpenRCT2. +2. Open a new Developer Command Prompt for VS2015, then navigate to the repository (e.g. `cd C:\GitHub\OpenRCT2`). +3. Run `msbuild openrct2.proj /t:build`. -These PowerShell scripts are stored in ```.\scripts\ps``` and have parameters. Once you have used the build script once, further development can be done within Visual Studio by opening ```openrct2.sln```. The build scripts have several commands allowing you to rebuild certain components such ```g2.dat``` or language files. +Once you have ran msbuild once, further development can be done within Visual Studio by opening `openrct2.sln`. + +Other examples: +``` +msbuild openrct2.proj /t:clean +msbuild openrct2.proj /t:rebuild /p:configuration=release /p:platform=x64 +msbuild openrct2.proj /t:g2 +msbuild openrct2.proj /t:PublishPortable +``` ### Mac: We support native builds for macOS (limited to i386 only for now). From f416da96f479482a81520ce5eb774d06b169231e Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 00:03:52 +0100 Subject: [PATCH 24/32] Update msbuild proj documentation [ci skip] --- openrct2.proj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 0a02b504a4..34dddea81c 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -1,12 +1,13 @@ - From ce7afb92fd4e33f2f9ab34527f622ee9fe0d7e21 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 00:45:57 +0100 Subject: [PATCH 25/32] Migrate update libs to msbuild project --- openrct2.proj | 41 +++++++++++++++++++-- openrct2.targets | 20 +++++++++- scripts/ps/common.psm1 | 83 ------------------------------------------ scripts/ps/install.ps1 | 63 -------------------------------- 4 files changed, 57 insertions(+), 150 deletions(-) delete mode 100644 scripts/ps/common.psm1 delete mode 100644 scripts/ps/install.ps1 diff --git a/openrct2.proj b/openrct2.proj index 34dddea81c..77abbbeb1a 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -18,6 +18,7 @@ 0.0.5 + 9 $(COMPUTERNAME) $(GIT_COMMIT_SHA1.Substring(0, 7)) @@ -52,6 +53,13 @@ OpenRCT2-$(Version)$(VersionExtension)-windows + + + https://github.com/OpenRCT2/Dependencies/releases/download/v$(TargetLibsVersion)/openrct2-libs-vs2015.zip + $(RootDir)lib\ + $(LibsPath)libversion + + @@ -91,9 +99,36 @@ + + + + + 0 + $([System.IO.File]::ReadAllText($(LibsVersionPath)).Trim()) + true + + + + + + + - - + + $(LibsPath)openrct2-libs-vs2015.zip + + + + + + + + + + + + + @@ -106,7 +141,7 @@ - + $(GIT_COMMIT_SHA1_SHORT) $(BuildString) ($(GIT_BRANCH)) diff --git a/openrct2.targets b/openrct2.targets index b6d141c4fb..cb86b35663 100644 --- a/openrct2.targets +++ b/openrct2.targets @@ -3,7 +3,7 @@ + AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> @@ -105,4 +105,22 @@ + + + + + + + + + + + + + diff --git a/scripts/ps/common.psm1 b/scripts/ps/common.psm1 deleted file mode 100644 index 17868366cf..0000000000 --- a/scripts/ps/common.psm1 +++ /dev/null @@ -1,83 +0,0 @@ -######################################################### -# Common functions for OpenRCT2 PowerShell scripts -######################################################### -$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path - -function AppExists($app) -{ - $result = (Get-Command $app -CommandType Application -ErrorAction SilentlyContinue) - return ($result -ne $null -and $result.Count -gt 0) -} - -function AddPath($path) -{ - $env:path = "$path;$env:path" -} - -function Get-RootPath() -{ - return Split-Path (Split-Path $scriptsPath) -} - -function Prompt-User($message) -{ - $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes" - $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No" - $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no) - $choice = $host.UI.PromptForChoice("", $message, $options, 1) - return ($choice -eq 0) -} - -function Resolve-PathFromBase($path) -{ - $rootPath = Get-RootPath - if ($path.StartsWith($rootPath)) { - $path = $path.Remove(0, $rootPath.Length + 1) - } - return $path -} - -function Symlink-or-Copy($path, $target) -{ - $pathDirectory = Split-Path $path - $pathName = Split-Path $path -Leaf - - $friendlyPath = Resolve-PathFromBase $path - $friendlyTarget = Resolve-PathFromBase $target - - # If the path is not a symlink, copy files instead - $mustCopy = $false - if (Test-Path $path) - { - if (-not ((Get-Item $path).Attributes -band [IO.FileAttributes]::ReparsePoint)) - { - $mustCopy = $true - } - } - - $symlinkSuccessful = $false - if (-not $mustCopy) - { - try - { - Write-Host "Symlink $friendlyPath to $friendlyTarget..." -ForegroundColor Cyan - New-Item -Force -ItemType SymbolicLink -Path $pathDirectory -Name $pathName -Target $target -ErrorAction Stop - $symlinkSuccessful = $true - } - catch [System.Management.Automation.ParameterBindingException] - { - Write-Host " Your powershell can not create symlinks, try updating it" -ForegroundColor Red - } - catch [System.UnauthorizedAccessException] - { - Write-Host " You need to run powershell in administration mode to create symlinks" -ForegroundColor Red - } - } - - if (-not $symlinkSuccessful) - { - Write-Host "Copying $friendlyTarget to $friendlyPath..." -ForegroundColor Cyan - New-Item -Force -Type Directory $path > $null - Copy-Item -Force -Recurse "$target\*" $path - } -} diff --git a/scripts/ps/install.ps1 b/scripts/ps/install.ps1 deleted file mode 100644 index 9d5fc99185..0000000000 --- a/scripts/ps/install.ps1 +++ /dev/null @@ -1,63 +0,0 @@ -######################################################### -# Script to install the latest dependencies for OpenRCT2 -######################################################### -param ( - [switch]$Force, - [switch]$Quiet -) -Write-Host "Installing OpenRCT2 development environment for Windows" -ForegroundColor Cyan - -# Setup -$ErrorActionPreference = "Stop" -$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path -Import-Module "$scriptsPath\common.psm1" -DisableNameChecking - -# Constants -$libsVersion = 9 -$libsUrl = "https://github.com/OpenRCT2/Dependencies/releases/download/v$libsVersion/openrct2-libs-vs2015.zip" - -# Get paths -$rootPath = Get-RootPath -$libsPath = Join-Path $rootPath "lib" -$zipPath = Join-Path $libsPath "openrct2-libs-vs2015.zip" -$libsVersionPath = Join-Path $libsPath "libversion" - -# Check if we need to update the dependencies -$currentLibsVersion = 0 -$updateLibs = $true -if (Test-Path $libsVersionPath) -{ - $currentLibsVersion = [IO.File]::ReadAllText($libsVersionPath) -} -if ($currentLibsVersion -ge $libsVersion) -{ - $updateLibs = $false -} - -# Check if user needs to download dependencies -$libsPathExists = Test-Path $libsPath -if ($libsPathExists -and -not $updateLibs -and -not $Force) -{ - if (-not $Quiet -and (Prompt-User "Dependencies already exists, reinstall?")) - { - $updateLibs = $true - } -} -else -{ - $updateLibs = $true -} - -# Download latest version of the dependencies -if ($updateLibs) { - Write-Host "Updating dependencies..." -ForegroundColor Cyan - - Remove-Item -Force -Recurse $libsPath -ErrorAction SilentlyContinue - New-Item -Force -ItemType Directory $libsPath > $null - - Invoke-WebRequest $libsUrl -OutFile $zipPath - [System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, $libsPath) - Remove-Item $zipPath -Force -ErrorAction SilentlyContinue - $libsVersion | Set-Content $libsVersionPath -} From a19d28a00c67d02545def74851b49db0a10deb67 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 14:20:17 +0100 Subject: [PATCH 26/32] Remove obsolete NSIS build --- distribution/windows/build.ps1 | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 distribution/windows/build.ps1 diff --git a/distribution/windows/build.ps1 b/distribution/windows/build.ps1 deleted file mode 100644 index 11cecea326..0000000000 --- a/distribution/windows/build.ps1 +++ /dev/null @@ -1,11 +0,0 @@ -param ( - [Parameter(Position = 1)] - [string]$VersionExtra = "" -) - -$path = Split-Path $Script:MyInvocation.MyCommand.Path -Write-Host "Building Windows Installer (NSIS script)"; -Write-Host " $VersionExtra"; -makensis /DAPPV_EXTRA=$VersionExtra ` - /DVERSION_INCLUDE=$path\win32.txt ` - $path\install.nsi > $path\win32.log; From 6654cdadfe8ed340db86013b7c34e438db679b6c Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 14:34:46 +0100 Subject: [PATCH 27/32] Create segment data for x64 builds --- distribution/windows/install.nsi | 17 ++++++++++++----- openrct2.proj | 22 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index 120d2b99f3..d43d8bde2b 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -14,14 +14,15 @@ !if "${PLATFORM}" == "Win32" !define OPENRCT2_EXE "openrct2.exe" !define OPENRCT2_DLL "openrct2.dll" - !define APPBITS 32 - !define APPARCH "win32" + !define APPBITS 32 + !define APPARCH "win32" InstallDir "$PROGRAMFILES32\OpenRCT2\" !else - !define OPENRCT2_EXE "openrct2_x64.exe" - !define APPBITS 64 - !define APPARCH "win64" + !define OPENRCT2_EXE "openrct2_x64.exe" + !define OPENRCT2_SEGMENT_INFO "openrct2_data" + !define APPBITS 64 + !define APPARCH "win64" InstallDir "$PROGRAMFILES64\OpenRCT2\" !endif @@ -159,6 +160,9 @@ Section "!OpenRCT2" Section1 !ifdef OPENRCT2_DLL File /oname=${OPENRCT2_DLL} ${BINARY_DIR}\${OPENRCT2_DLL} !endif +!ifdef OPENRCT2_SEGMENT_INFO + File /oname=${OPENRCT2_SEGMENT_INFO} ${BINARY_DIR}\${OPENRCT2_SEGMENT_INFO} +!endif ; Create the Registry Entries WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "Comments" "Visit ${APPURLLINK}" @@ -228,6 +232,9 @@ Section "Uninstall" Delete "$INSTDIR\${OPENRCT2_EXE}" !ifdef OPENRCT2_DLL Delete "$INSTDIR\${OPENRCT2_DLL}" +!endif +!ifdef OPENRCT2_SEGMENT_INFO + Delete "$INSTDIR\${OPENRCT2_SEGMENT_INFO}" !endif Delete "$INSTDIR\INSTALL.LOG" diff --git a/openrct2.proj b/openrct2.proj index 77abbbeb1a..ac3721f911 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -38,6 +38,7 @@ $(TargetDir)openrct2.dll $(TargetDir)openrct2.exe $(TargetPath) + $(TargetDir)openrct2_data $(TargetDir)data\g2.dat $(DistDir)windows\code-sign-key-openrct2.org.pfx @@ -75,6 +76,7 @@ + @@ -132,7 +134,8 @@ - + + @@ -156,6 +159,23 @@ + + + + + + + From 6a367e20660508932de9434e5c03081581936276 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 18:04:17 +0100 Subject: [PATCH 28/32] Improve artifact clean --- openrct2.proj | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index ac3721f911..364a5ef2e7 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -44,7 +44,8 @@ $(DistDir)windows\code-sign-key-openrct2.org.pfx http://timestamp.comodoca.com/authenticode - -$(Configuration)-$(Platform)-$(GIT_COMMIT_SHA1_SHORT) + -$(Configuration)-$(Platform) + $(PublishPostfix)-$(GIT_COMMIT_SHA1_SHORT) $(PublishPostfix.ToLower()) $(ArtifactsDir)openrct2-portable$(PublishPostfix).zip $(ArtifactsDir)openrct2-symbols$(PublishPostfix).zip @@ -134,13 +135,16 @@ - - - - - - - + + + + + + + + + + From c19437028de69d55511e5120ac25a0b88180d6d6 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 18:29:42 +0100 Subject: [PATCH 29/32] Move artifact upload to AppVeyor deploy --- appveyor.yml | 3 +++ openrct2.proj | 7 +------ scripts/ps/appveyor_deploy.ps1 | 21 +++++++++++++++++++++ scripts/ps/appveyor_install.ps1 | 13 +------------ 4 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 scripts/ps/appveyor_deploy.ps1 diff --git a/appveyor.yml b/appveyor.yml index d71950fc82..8bd62212c4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,3 +31,6 @@ artifacts: name: OpenRCT2-installer - path: .\artifacts\openrct2-symbols*.zip name: OpenRCT2 debug symbols +deploy_script: +- ps: >- + .\scripts\ps\appveyor_deploy.ps1 diff --git a/openrct2.proj b/openrct2.proj index 364a5ef2e7..9b8919cee9 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -9,7 +9,7 @@ - OPENRCT2_ORG_TOKEN - NO_NSIS: set to true to prevent the NSIS installer building --> - + @@ -269,9 +269,4 @@ CustomErrorRegularExpression=""error":1" /> - - - - - diff --git a/scripts/ps/appveyor_deploy.ps1 b/scripts/ps/appveyor_deploy.ps1 new file mode 100644 index 0000000000..059525bec0 --- /dev/null +++ b/scripts/ps/appveyor_deploy.ps1 @@ -0,0 +1,21 @@ +########################################### +# Script to deploy OpenRCT2 from AppVeyor # +########################################### + +# Check if OpenRCT2.org API security token is available +if (${env:OPENRCT2_ORG_TOKEN}) +{ + # Only upload tagged builds, develop branch or push/ branches + if (${env:APPVEYOR_REPO_TAG} -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/") + { + msbuild openrct2.proj /t:UploadArtifacts /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + } + else + { + Write-Host "No deployment: Non-tagged or push branch." -ForegroundColor Yellow + } +} +else +{ + Write-Host "No deployment: %OPENRCT2_ORG_TOKEN% not available." -ForegroundColor Yellow +} diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 index 4125dfa2a3..762318c20e 100644 --- a/scripts/ps/appveyor_install.ps1 +++ b/scripts/ps/appveyor_install.ps1 @@ -23,6 +23,7 @@ if ($env:ENCKEY) Check-ExitCode } +# Check if OpenRCT2.org API security token is available if (${env:OPENRCT2_ORG_TOKEN}) { if (-not (Test-Path "C:\ProgramData\chocolatey\lib\nsis.portable")) @@ -43,18 +44,6 @@ if (${env:OPENRCT2_ORG_TOKEN}) cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" } } - -# Check if OpenRCT2.org API security token is available -if (${env:OPENRCT2_ORG_TOKEN}) -{ - # Only upload tagged builds, develop branch or push/ branches - if (${env:APPVEYOR_REPO_TAG} -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/") - { - # Remove the OPENRCT2_ORG_TOKEN environment variable so that the msbuild will not - # try to upload the artifacts - ${env:OPENRCT2_ORG_TOKEN} = $null - } -} else { # Don't build the NSIS installer for non-uploaded builds From 4ea05cfb95add0db062a0f5d9ab97c27f9420b64 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 18:33:54 +0100 Subject: [PATCH 30/32] Use correct x64 flavour ids --- openrct2.proj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 9b8919cee9..f03558ceb6 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -90,15 +90,18 @@ $(UploadFilename).zip - 1 + 1 + 6 $(UploadFilename).exe - 2 + 2 + 7 $(UploadFilename)-symbols.zip - 5 + 5 + 10 From bd006de77b793cc51ea2bc753f1a97e7b42c6c11 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 18:50:52 +0100 Subject: [PATCH 31/32] Fix appveyor deployment script --- scripts/ps/appveyor_deploy.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ps/appveyor_deploy.ps1 b/scripts/ps/appveyor_deploy.ps1 index 059525bec0..bf63ce8592 100644 --- a/scripts/ps/appveyor_deploy.ps1 +++ b/scripts/ps/appveyor_deploy.ps1 @@ -6,7 +6,7 @@ if (${env:OPENRCT2_ORG_TOKEN}) { # Only upload tagged builds, develop branch or push/ branches - if (${env:APPVEYOR_REPO_TAG} -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/") + if (${env:APPVEYOR_REPO_TAG} -eq "true" -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/") { msbuild openrct2.proj /t:UploadArtifacts /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" } From a3e4bd1af431b2231d8389715f4b63c599a4a19a Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 26 Aug 2016 18:57:21 +0100 Subject: [PATCH 32/32] Avoid signing when build has not changed --- openrct2.proj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index f03558ceb6..edc667dc4b 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -148,6 +148,7 @@ + @@ -192,24 +193,27 @@ - + + + + - + <_7z Output="$(PublishZip)" Inputs="@(PublishItems)" /> - + <_7z Output="$(PublishSymbolsZip)" Inputs="@(SymbolItems)" /> @@ -217,7 +221,7 @@