From 005b4166cc06fbf27418043acf297589f5d1f0f1 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 13 Mar 2017 09:47:22 +0000 Subject: [PATCH] Move Windows launcher compilation to packaging scripts. --- Makefile | 15 +---- OpenRA.GameMonitor/OpenRA.GameMonitor.csproj | 54 ------------------ OpenRA.sln | 2 - appveyor.yml | 4 +- packaging/package-all.sh | 5 +- {OpenRA.Game => packaging/windows}/OpenRA.ico | Bin .../windows/WindowsLauncher.cs.in | 9 ++- packaging/windows/buildpackage.sh | 14 +++++ 8 files changed, 23 insertions(+), 80 deletions(-) delete mode 100644 OpenRA.GameMonitor/OpenRA.GameMonitor.csproj rename {OpenRA.Game => packaging/windows}/OpenRA.ico (100%) rename OpenRA.GameMonitor/GameMonitor.cs => packaging/windows/WindowsLauncher.cs.in (97%) diff --git a/Makefile b/Makefile index ca0ae6f3a5..9d381cc05d 100644 --- a/Makefile +++ b/Makefile @@ -173,9 +173,6 @@ check: utility mods @echo "Checking for code style violations in OpenRA.Platforms.Default..." @mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default @echo - @echo "Checking for code style violations in OpenRA.GameMonitor..." - @mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.GameMonitor - @echo @echo "Checking for code style violations in OpenRA.Mods.Common..." @mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Mods.Common @echo @@ -230,16 +227,6 @@ test: utility mods ##### Launchers / Utilities ##### -gamemonitor_SRCS := $(shell find OpenRA.GameMonitor/ -iname '*.cs') -gamemonitor_TARGET = OpenRA.exe -gamemonitor_KIND = winexe -gamemonitor_DEPS = $(game_TARGET) -gamemonitor_LIBS = $(COMMON_LIBS) $(gamemonitor_DEPS) System.Windows.Forms.dll -gamemonitor_FLAGS = -win32icon:OpenRA.Game/OpenRA.ico -PROGRAMS += gamemonitor -gamemonitor: $(gamemonitor_TARGET) - -# Backend for the launcher apps - queries game/mod info and applies actions to an install utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs') utility_TARGET = OpenRA.Utility.exe utility_KIND = exe @@ -289,7 +276,7 @@ default: core core: dependencies game platforms mods utility server -package: all-dependencies core gamemonitor docs version +package: all-dependencies core docs version mods: mod_common mod_cnc mod_d2k diff --git a/OpenRA.GameMonitor/OpenRA.GameMonitor.csproj b/OpenRA.GameMonitor/OpenRA.GameMonitor.csproj deleted file mode 100644 index f2a1398538..0000000000 --- a/OpenRA.GameMonitor/OpenRA.GameMonitor.csproj +++ /dev/null @@ -1,54 +0,0 @@ - - - - Debug - x86 - {68295755-7902-4602-AC2C-9A8AC36D5EF7} - WinExe - OpenRA - OpenRA - v4.5 - - - true - full - ..\ - DEBUG;TRACE - prompt - x86 - AllRules.ruleset - true - false - - - ..\OpenRA.Game\OpenRA.ico - - - true - ..\ - TRACE - true - pdbonly - x86 - false - prompt - AllRules.ruleset - true - - - - - - - - - {0DFB103F-2962-400F-8C6D-E2C28CCBA633} - OpenRA.Game - False - - - - - - - \ No newline at end of file diff --git a/OpenRA.sln b/OpenRA.sln index 449ca07899..3f0520ae30 100644 --- a/OpenRA.sln +++ b/OpenRA.sln @@ -129,8 +129,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "System Lua scripts", "Syste lua\stacktraceplus.lua = lua\stacktraceplus.lua EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.GameMonitor", "OpenRA.GameMonitor\OpenRA.GameMonitor.csproj", "{68295755-7902-4602-AC2C-9A8AC36D5EF7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Test", "OpenRA.Test\OpenRA.Test.csproj", "{6CB8E1B7-6B36-4D93-8633-7C573E194AC4}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tiberian Sun Lua scripts", "Tiberian Sun Lua scripts", "{85159569-F5BD-458E-B5C0-EB16690C432B}" diff --git a/appveyor.yml b/appveyor.yml index 456db769d7..36d6d88022 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,7 +53,9 @@ after_test: - appveyor DownloadFile "https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md" -FileName Changelog.md - make docs - ps: dir *.md | % {gc $_ -Raw | .\ConvertFrom-Markdown.ps1 | Out-File -FilePath "$($_.Name.TrimEnd(".md")).html"} - - ps: cp OpenRA.Game/OpenRA.ico . + - ps: (Get-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs.in").replace('DISPLAY_NAME', 'OpenRA').replace('MOD_ID', '').replace('FAQ_URL', 'http://wiki.openra.net/FAQ') | Set-Content "${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs" + - ps: csc.exe /noconfig /platform:x86 /reference:System.dll /reference:System.Core.dll /reference:System.Drawing.dll /reference:System.Windows.Forms.dll /reference:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.Game.exe" /out:"${env:APPVEYOR_BUILD_FOLDER}\OpenRA.exe" /win32icon:"${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\OpenRA.ico" /target:winexe ${env:APPVEYOR_BUILD_FOLDER}\packaging\windows\WindowsLauncher.cs + - ps: cp packaging\windows\OpenRA.ico . - '"C:\Program Files (x86)\NSIS\makensis.exe" /DSRCDIR="%APPVEYOR_BUILD_FOLDER%" /DDEPSDIR="%APPVEYOR_BUILD_FOLDER%\thirdparty\download\windows" /V3 packaging/windows/OpenRA.nsi' - if defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_TAG_NAME% - if not defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_COMMIT:~0,7% diff --git a/packaging/package-all.sh b/packaging/package-all.sh index 5261da70e2..84ed6591ac 100755 --- a/packaging/package-all.sh +++ b/packaging/package-all.sh @@ -70,10 +70,7 @@ cp thirdparty/download/MaxMind.Db.dll packaging/built cp thirdparty/download/SmarIrc4net.dll packaging/built # Copy game icon for windows package -cp OpenRA.Game/OpenRA.ico packaging/built - -# Copy the Windows crash monitor -cp OpenRA.exe packaging/built +cp packaging/windows/OpenRA.ico packaging/built cd packaging echo "Creating packages..." diff --git a/OpenRA.Game/OpenRA.ico b/packaging/windows/OpenRA.ico similarity index 100% rename from OpenRA.Game/OpenRA.ico rename to packaging/windows/OpenRA.ico diff --git a/OpenRA.GameMonitor/GameMonitor.cs b/packaging/windows/WindowsLauncher.cs.in similarity index 97% rename from OpenRA.GameMonitor/GameMonitor.cs rename to packaging/windows/WindowsLauncher.cs.in index d153ee6737..b75f6559b9 100644 --- a/OpenRA.GameMonitor/GameMonitor.cs +++ b/packaging/windows/WindowsLauncher.cs.in @@ -16,11 +16,12 @@ using System.IO; using System.Linq; using System.Media; using System.Reflection; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace OpenRA { - class GameMonitor + class WindowsLauncher { static Process gameProcess; @@ -128,8 +129,7 @@ namespace OpenRA { Process.Start(Platform.ResolvePath("^", "Logs")); } - catch - { } + catch { } } static void ViewFaqClicked(object sender, EventArgs e) @@ -138,8 +138,7 @@ namespace OpenRA { Process.Start("http://wiki.openra.net/FAQ"); } - catch - { } + catch { } } static void FormClosed(object sender, EventArgs e) diff --git a/packaging/windows/buildpackage.sh b/packaging/windows/buildpackage.sh index 6b6987f0c1..eff2d76566 100755 --- a/packaging/windows/buildpackage.sh +++ b/packaging/windows/buildpackage.sh @@ -5,6 +5,20 @@ BUILTDIR="$2" SRCDIR="$3" OUTPUTDIR="$4" +LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe" +FAQ_URL="http://wiki.openra.net/FAQ" + +function makelauncher() +{ + sed "s|DISPLAY_NAME|$2|" WindowsLauncher.cs.in | sed "s|MOD_ID|$3|" | sed "s|FAQ_URL|${FAQ_URL}|" > WindowsLauncher.cs + mcs -sdk:4.5 WindowsLauncher.cs -warn:4 -codepage:utf8 -warnaserror -out:"$1" -t:winexe ${LAUNCHER_LIBS} -win32icon:"$4" + rm WindowsLauncher.cs + mono ${SRCDIR}/fixheader.exe $1 > /dev/null +} + +echo "Compiling Windows launcher" +makelauncher ${BUILTDIR}/OpenRA.exe "OpenRA" "" OpenRA.ico + if [ -x /usr/bin/makensis ]; then echo "Building Windows setup.exe" makensis -V2 -DSRCDIR="$BUILTDIR" -DDEPSDIR="${SRCDIR}/thirdparty/download/windows" OpenRA.nsi