Last active
October 26, 2023 03:58
-
-
Save teefan/974c5552fa8efcf851ac630ea3eae184 to your computer and use it in GitHub Desktop.
Simple Godot build script for Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set godot_dir=C:\godot | |
set doc_dir=C:\godot-docs | |
set demo_dir=C:\godot-demos | |
set copy_editor_dir=C:\Users\Teefan\Desktop\Godot\Editors | |
set export_templates_dir=C:\Users\Teefan\AppData\Roaming\Godot\export_templates | |
git fetch | |
for /f "tokens=*" %%i in ('git show -s "--format=%%H" origin/master') do ( | |
set commit_hash=%%i | |
) | |
set commit_hash=%commit_hash:~0,8% | |
for /f "tokens=*" %%i in ('git rev-parse head') do ( | |
set local_hash=%%i | |
) | |
set local_hash=%local_hash:~0,8% | |
echo Remote commit hash: %commit_hash% | |
echo Local commit hash: %local_hash% | |
if "%~1" == "copy" goto set_version | |
if "%~1" == "current" goto build | |
if "%~1" == "doc" goto build_doc | |
if "%~1" == "update-demos" goto update_demos | |
if "%~1" == "android" goto set_version | |
if "%~1" == "android-clean" goto android_clean | |
if "%~1" == "android-templates" goto android_templates | |
if "%~1" == "android-copy" goto set_version | |
if not %local_hash% == %commit_hash% goto merge_latest | |
echo Already on latest version at: %local_hash% | |
exit /b | |
:merge_latest | |
git merge --ff-only origin/master | |
scons p=windows target=editor | |
scons p=windows target=template_release | |
scons p=windows target=template_debug | |
scons p=web target=template_release | |
scons p=web target=template_debug | |
:build | |
:set_version | |
for /f "tokens=1,2,3 delims=." %%a in ('.\bin\godot.windows.editor.x86_64.exe --version') do ( | |
set major=%%a | |
set minor=%%b | |
set release=%%c | |
) | |
set godot_ver=%major%.%minor% | |
set godot_release=%release% | |
set godot_ver_dash=%godot_ver%-%godot_release% | |
set godot_ver_dot=%godot_ver%.%godot_release% | |
echo Godot version: %godot_ver_dot% | |
set editor_dir=%copy_editor_dir%\Godot_%godot_ver_dash% | |
set templates_dir=%export_templates_dir%\%godot_ver_dot% | |
if not exist %editor_dir% mkdir %editor_dir% | |
if not exist %templates_dir% mkdir %templates_dir% | |
if "%~1" == "android" goto android | |
if "%~1" == "android-copy" goto android_copy | |
:copy_builds | |
copy /Y %godot_dir%\bin\godot.windows.editor.x86_64.exe %editor_dir%\Godot_v%godot_ver_dash%_win64.exe | |
copy /Y %godot_dir%\bin\godot.windows.editor.x86_64.console.exe %editor_dir%\Godot_v%godot_ver_dash%_win64_console.exe | |
copy /Y %godot_dir%\bin\godot.windows.template_debug.x86_64.exe %templates_dir%\windows_debug_x86_64.exe | |
copy /Y %godot_dir%\bin\godot.windows.template_debug.x86_64.console.exe %templates_dir%\windows_debug_x86_64_console.exe | |
copy /Y %godot_dir%\bin\godot.windows.template_release.x86_64.exe %templates_dir%\windows_release_x86_64.exe | |
copy /Y %godot_dir%\bin\godot.windows.template_release.x86_64.console.exe %templates_dir%\windows_release_x86_64_console.exe | |
copy /Y %godot_dir%\bin\godot.web.template_debug.wasm32.zip %templates_dir%\web_debug.zip | |
copy /Y %godot_dir%\bin\godot.web.template_release.wasm32.zip %templates_dir%\web_release.zip | |
if "%~1" == "copy" exit /b | |
:build_doc | |
cd %doc_dir% | |
git fetch | |
git merge --ff-only origin/master | |
./make.bat html | |
cd %godot_dir% | |
:update_demos | |
cd %demo_dir% | |
git fetch | |
git merge --ff-only origin/master | |
cd %godot_dir% | |
exit /b | |
:android | |
scons p=android arch=armv7 target=template_release | |
scons p=android arch=arm64v8 target=template_release | |
scons p=android arch=armv7 target=template_debug | |
scons p=android arch=arm64v8 target=template_debug | |
:android_templates | |
cd %godot_dir%\platform\android\java | |
.\gradlew generateGodotTemplates | |
cd %godot_dir% | |
:android_copy | |
copy /Y %godot_dir%\bin\android_release.apk %templates_dir%\android_release.apk | |
copy /Y %godot_dir%\bin\android_debug.apk %templates_dir%\android_debug.apk | |
exit /b | |
:android_clean | |
cd %godot_dir%\platform\android\java | |
.\gradlew cleanGodotTemplates | |
cd %godot_dir% | |
exit /b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for /f "tokens=1,2,3 delims=." %%a in ('.\bin\godot.windows.editor.x86_64.exe --version') do ( | |
set major=%%a | |
set minor=%%b | |
set release=%%c | |
) | |
set godot_ver=%major%.%minor%.%release% | |
echo Godot current version: %godot_ver% | |
git fetch | |
for /f "tokens=*" %%i in ('git show -s "--format=%%H" origin/master') do ( | |
set commit_hash=%%i | |
) | |
set commit_hash=%commit_hash:~0,8% | |
for /f "tokens=*" %%i in ('git rev-parse head') do ( | |
set local_hash=%%i | |
) | |
set local_hash=%local_hash:~0,8% | |
echo Remote commit hash: %commit_hash% | |
echo Local commit hash: %local_hash% | |
if %local_hash% == %commit_hash% goto :latest | |
echo New version available at: %commit_hash% | |
exit /b | |
:latest | |
echo Already on latest version at: %local_hash% | |
exit /b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment