Skip to content
Snippets Groups Projects
Commit 142d0013 authored by svornost's avatar svornost
Browse files

Write commit hash for batch file builds if git is installed

parent 66b38a58
No related branches found
No related tags found
1 merge request!6972Write commit hash for batch file builds if git is installed
...@@ -3,6 +3,29 @@ ...@@ -3,6 +3,29 @@
:: Set working directory :: Set working directory
pushd %~dp0 pushd %~dp0
:: See if we can find a git installation
setlocal enabledelayedexpansion
for %%k in (HKCU HKLM) do (
for %%w in (\ \Wow6432Node\) do (
for /f "skip=2 delims=: tokens=1*" %%a in ('reg query "%%k\SOFTWARE%%wMicrosoft\Windows\CurrentVersion\Uninstall\Git_is1" /v InstallLocation 2^> nul') do (
for /f "tokens=3" %%z in ("%%a") do (
set GIT=%%z:%%b
set GITFOUND=yes
goto FOUND
)
)
)
)
:FOUND
if %GITFOUND% == yes (
set "PATH=%GIT%bin;%PATH%"
echo|set /p out="App.Version.commitHash = " > "%~dp0src\002-config\fc-version.js.commitHash.js"
git rev-parse --sq --short HEAD >> "%~dp0src\002-config\fc-version.js.commitHash.js"
echo|set /p out=";" >> "%~dp0src\002-config\fc-version.js.commitHash.js"
)
if not exist "bin\resources" mkdir bin\resources if not exist "bin\resources" mkdir bin\resources
CALL devTools/concatFiles.bat js\ "*.js" bin\fc.js CALL devTools/concatFiles.bat js\ "*.js" bin\fc.js
:: Run the appropriate compiler for the user's CPU architecture. :: Run the appropriate compiler for the user's CPU architecture.
...@@ -12,6 +35,7 @@ if %PROCESSOR_ARCHITECTURE% == AMD64 ( ...@@ -12,6 +35,7 @@ if %PROCESSOR_ARCHITECTURE% == AMD64 (
CALL "%~dp0devTools\tweeGo\tweego_win86.exe" -o "%~dp0bin/FC_pregmod.html" --module=bin/fc.js --head devTools/head.html "%~dp0src" CALL "%~dp0devTools\tweeGo\tweego_win86.exe" -o "%~dp0bin/FC_pregmod.html" --module=bin/fc.js --head devTools/head.html "%~dp0src"
) )
DEL bin\fc.js DEL bin\fc.js
DEL "%~dp0src\002-config\fc-version.js.commitHash.js"
popd popd
ECHO Done ECHO Done
...@@ -27,13 +27,5 @@ if %GITFOUND% == yes ( ...@@ -27,13 +27,5 @@ if %GITFOUND% == yes (
:: Compile the game :: Compile the game
call "%~dp0compile.bat" call "%~dp0compile.bat"
if %GITFOUND% == yes (
:: Make the output prettier, replacing \t with a tab and \n with a newline
bash -c "sed -i -e '/^.*<div id=\"store-area\".*$/s/\\\t/\t/g' -e '/^.*<div id=\"store-area\".*$/s/\\\n/\n/g' bin/FC_pregmod.html"
:: Revert ./src/init/storyInit.tw for next compilation
git checkout -- ./src/init/storyInit.tw
)
popd popd
PAUSE PAUSE
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment