From f5f401961a3b37ef2a7ed668808111c8edc2ade7 Mon Sep 17 00:00:00 2001 From: Al Murray Date: Fri, 28 Jun 2019 17:03:59 -0500 Subject: [PATCH] Upgrade to Unity 2019-1.8f1 Upgraded to to work with Unity versions after Unity Hub was introduced. Tested against Unity 2019.1.8f1. Also improvement to code that detects and closes Unity and Devenv whilst we are building. Also detects build success and failure and prints better messaging. --- .gitignore | 5 +- Build/buildconfig.bat | 51 +++++++++++++++---- Build/clean.bat | 18 +++++-- .../Client/ProjectSettings/ProjectVersion.txt | 3 +- .../Server/ProjectSettings/ProjectVersion.txt | 3 +- Packages/manifest.json | 17 +++++++ 6 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 Packages/manifest.json diff --git a/.gitignore b/.gitignore index 1696b33..2fcd9d0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,9 @@ /[Oo]utput/ /[Ee]nvironment/ /[Pp]roject[Ss]ettings/ -/[Pp]ackages/ +/[Ll]ogs/ +/[Tt]emp/ +/[Oo]bj/ SDK/*/Net35/bin/ SDK/*/Net35/obj/ @@ -44,6 +46,7 @@ sysinfo.txt DeployTool/bin/ DeployTool/obj/ +DeployTool/packages/ Backend/bin/ Backend/obj/ SDK/GameLift-CSharp-ServerSDK-3.3.0/Net35/Dependencies/EngineIoClientDotNet-master/Src/EngineIoClientDotNet.net35/bin/Release/net35/EngineIoClientDotNet.dll diff --git a/Build/buildconfig.bat b/Build/buildconfig.bat index 0bd79df..9e9297e 100644 --- a/Build/buildconfig.bat +++ b/Build/buildconfig.bat @@ -62,28 +62,61 @@ FOR /L %%A IN (1,1,100) DO IF "!CONFIGNAME:~-1!"==" " SET CONFIGNAME=!CONFIGNAME :BUILD ECHO BUILDING %CONFIGNAME% -REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING. IF UNITY IS NOT RUNNING THEN IT WILL THROW AN ERROR MSG TO STDERR. -REM BUT WE DON'T CARE ABOUT THAT SO CAPTURE THE STDERR OUTPUT AND IGNORE IT. -TASKKILL /IM unity.exe 2> NUL -REM WHICH UNITY ARE WE USING (32- OR 64-BIT)? -IF EXIST "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles(x86)%\Unity\Editor\Unity.exe" -IF EXIST "%ProgramFiles%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles%\Unity\Editor\Unity.exe" +:KILLUNITY +REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING. +TASKLIST | FIND /I "UNITY.EXE" >NUL && ( + TASKKILL /IM "UNITY.EXE" /F + GOTO KILLUNITY +) + + +REM REMOVE OLD OUTPUT FOLDER +IF EXIST "%ABS_ROOT%\Output\%CONFIGNAME%" RMDIR /S /Q "%ABS_ROOT%\Output\%CONFIGNAME%" + + +REM WHICH UNITY EXECUTABLE WILL WE USE? +FOR /f "delims=" %%F IN ('DIR "%ProgramFiles%\Unity\Hub\Editor\" /b /on') DO SET UNITYVERSION=%%F +IF EXIST "%ProgramFiles%\Unity\Hub\Editor\%UNITYVERSION%\Editor\Unity.exe" ( + SET UNITYEXE="%ProgramFiles%\Unity\Hub\Editor\%UNITYVERSION%\Editor\Unity.exe" +) ELSE ( + IF EXIST "%ProgramFiles%\Unity\Hub\Editor" GOTO ERRORINVALUNITY + IF EXIST "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles(x86)%\Unity\Editor\Unity.exe" + IF EXIST "%ProgramFiles%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles%\Unity\Editor\Unity.exe" +) IF "" EQU "%UNITYEXE%" GOTO ERRORNOUNITY +ECHO USING %UNITYEXE% TO BUILD + REM DO A BUILD OF THE STANDALONE USING THE UNITY COMMAND LINE. -%UNITYEXE% -nographics -batchmode -projectPath "%ABS_ROOT%" -buildWindows64Player "%ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity.exe" -quit +%UNITYEXE% -batchmode -buildTarget Win64 -projectPath "%ABS_ROOT%" -buildWindows64Player "%ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity.exe" -quit + + +REM DID THE BUILD COMPLETE SUCCESSFULLY? +IF NOT EXIST "%ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity.exe" GOTO BUILDFAILED REM COPY THE PLUGIN TO THE BUILD DIRECTORY COPY %ABS_ROOT%\Output\Intermediate\GameLiftClientSDKPlugin\Release\GameLiftClientSDKPlugin.dll %ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity_Data\Plugins > NUL COPY %ABS_ROOT%\Plugin\Sdk\GameLiftServer\GameLift-CSharpSDK-3.1.3\Net35\bin\Release\*.dll %ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity_Data\Plugins > NUL + REM FINISHED -ECHO BUILD COMPLETE. SEE %LOCALAPPDATA%\Unity\Editor\Editor.log +ECHO BUILD COMPLETED SUCCESSFULLY. SEE %LOCALAPPDATA%\Unity\Editor\Editor.log +EXIT /B 0 + +:BUILDFAILED +ECHO BUILD FAILED: LOG AT %LOCALAPPDATA%\Unity\Editor\Editor.log +ECHO SEE %ABS_ROOT%\Build\buildconfig.bat EXIT /B 0 :ERRORNOUNITY ECHO "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" OR "%ProgramFiles%\Unity\Editor\Unity.exe" NOT FOUND ECHO BUILD FAILED: UNITY IS NOT INSTALLED -ECHO See %ABS_ROOT%\Build\buildconfig.bat +ECHO SEE %ABS_ROOT%\Build\buildconfig.bat +EXIT /B 0 + +:ERRORINVALUNITY +ECHO "%ProgramFiles(x86)%\Unity\Hub\Editor\" WAS FOUND BUT A VALID VERSION WAS NOT +ECHO BUILD FAILED: UNITY IS NOT VALID VERSION +ECHO SEE %ABS_ROOT%\Build\buildconfig.bat EXIT /B 0 diff --git a/Build/clean.bat b/Build/clean.bat index b12a277..dd76da7 100644 --- a/Build/clean.bat +++ b/Build/clean.bat @@ -14,11 +14,19 @@ @ECHO OFF -REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING. IF UNITY IS NOT RUNNING THEN IT WILL THROW AN ERROR MSG TO STDERR. -REM BUT WE DON'T CARE ABOUT THAT SO CAPTURE THE STDERR OUTPUT AND IGNORE IT. -TASKKILL /IM unity.exe 2> NUL +:KILLUNITY +REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING. +TASKLIST | FIND /I "UNITY.EXE" >NUL && ( + TASKKILL /IM "UNITY.EXE" /F 2> NUL + GOTO KILLUNITY +) -REM CLOSE MSVS TOO? +:KILLDEVENV +REM TASKKILL KILLS THE DEVENV.EXE PROCESS IF IT IS RUNNING. +TASKLIST | FIND /I "DEVENV.EXE" >NUL && ( + TASKKILL /IM "DEVENV.EXE" /F 2> NUL + GOTO KILLUNITY +) REM ------- FIND MY ABSOLUTE ROOT ------- SET REL_ROOT=..\ @@ -35,6 +43,8 @@ IF EXIST "%ABS_ROOT%\Assets\Plugins" RMDIR /S /Q "%ABS_ROOT%\Assets\Plugins" IF EXIST "%ABS_ROOT%\Library" RMDIR /S /Q "%ABS_ROOT%\Library" IF EXIST "%ABS_ROOT%\Environment" RMDIR /S /Q "%ABS_ROOT%\Environment" IF EXIST "%ABS_ROOT%\Output" RMDIR /S /Q "%ABS_ROOT%\Output" +IF EXIST "%ABS_ROOT%\obj" RMDIR /S /Q "%ABS_ROOT%\obj" +IF EXIST "%ABS_ROOT%\Logs" RMDIR /S /Q "%ABS_ROOT%\Logs" IF EXIST "%ABS_ROOT%\ProjectSettings" RMDIR /S /Q "%ABS_ROOT%\ProjectSettings" IF EXIST "%ABS_ROOT%\Temp" RMDIR /S /Q "%ABS_ROOT%\Temp" IF EXIST "%ABS_ROOT%\.VS" RMDIR /S /Q "%ABS_ROOT%\.VS" diff --git a/Configurations/Client/ProjectSettings/ProjectVersion.txt b/Configurations/Client/ProjectSettings/ProjectVersion.txt index 4a9cfb6..a5b7492 100644 --- a/Configurations/Client/ProjectSettings/ProjectVersion.txt +++ b/Configurations/Client/ProjectSettings/ProjectVersion.txt @@ -1 +1,2 @@ -m_EditorVersion: 2017.4.6f1 +m_EditorVersion: 2019.1.8f1 +m_EditorVersionWithRevision: 2019.1.8f1 (7938dd008a75) diff --git a/Configurations/Server/ProjectSettings/ProjectVersion.txt b/Configurations/Server/ProjectSettings/ProjectVersion.txt index 4a9cfb6..a5b7492 100644 --- a/Configurations/Server/ProjectSettings/ProjectVersion.txt +++ b/Configurations/Server/ProjectSettings/ProjectVersion.txt @@ -1 +1,2 @@ -m_EditorVersion: 2017.4.6f1 +m_EditorVersion: 2019.1.8f1 +m_EditorVersionWithRevision: 2019.1.8f1 (7938dd008a75) diff --git a/Packages/manifest.json b/Packages/manifest.json new file mode 100644 index 0000000..74d6ced --- /dev/null +++ b/Packages/manifest.json @@ -0,0 +1,17 @@ +{ + "dependencies": { + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.screencapture": "1.0.0", + "com.unity.modules.tilemap": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.unitywebrequesttexture": "1.0.0", + "com.unity.modules.unitywebrequestwww": "1.0.0" + } +}