summaryrefslogtreecommitdiff
path: root/scripts/build_release.bat
diff options
context:
space:
mode:
authorIndrajith K L2025-11-10 01:58:00 +0530
committerIndrajith K L2025-11-10 01:58:25 +0530
commitd9d1a8a51ea7cd7e7076724918008b6adb1302ca (patch)
tree59a8f258c9bb4db4edafc2c70993319e3c3c859c /scripts/build_release.bat
parent8c9367f3689aee05d33fc1cae8a5d1aa6d2b5fb8 (diff)
downloadreilua-enhanced-d9d1a8a51ea7cd7e7076724918008b6adb1302ca.tar.gz
reilua-enhanced-d9d1a8a51ea7cd7e7076724918008b6adb1302ca.tar.bz2
reilua-enhanced-d9d1a8a51ea7cd7e7076724918008b6adb1302ca.zip
Add flexible module loading and complete file embedding
- Support any folder structure (no hard-coded folders) - Embed all file types recursively from any folder - Fix require() dot-to-slash conversion for embedded modules - Clean build folder for fresh builds every time - Generate empty headers for Lua-only projects Backward compatible with existing projects.
Diffstat (limited to 'scripts/build_release.bat')
-rw-r--r--scripts/build_release.bat69
1 files changed, 47 insertions, 22 deletions
diff --git a/scripts/build_release.bat b/scripts/build_release.bat
index a1a08c0..4f9ce43 100644
--- a/scripts/build_release.bat
+++ b/scripts/build_release.bat
@@ -24,21 +24,48 @@ if errorlevel 1 (
exit /b 1
)
+REM ALWAYS clean build folder for fresh build
+echo Cleaning build directory for fresh build...
+del /Q /S * >nul 2>&1
+for /d %%p in (*) do rmdir "%%p" /s /q >nul 2>&1
+echo * Build directory cleaned
+echo.
+
REM Clean old embedded files
-echo Cleaning old embedded files...
+echo Ready for fresh build...
del /Q embedded_main.h embedded_assets.h 2>nul
-REM Check for Lua files
+REM Auto-copy from game folder if it exists
echo.
+if exist "..\game" (
+ echo Found game/ folder - auto-copying ALL contents to build...
+
+ REM Copy all files from game folder recursively, excluding LSP files
+ xcopy /E /I /Y /EXCLUDE:..\game\ReiLua_API.lua+..\game\.luarc.json "..\game\*" . >nul 2>&1
+ if exist "..\game\ReiLua_API.lua" del /Q "ReiLua_API.lua" 2>nul
+ if exist "..\game\.luarc.json" del /Q ".luarc.json" 2>nul
+
+ echo * Copied ALL game files and folders
+ echo * All folder structures preserved ^(user-created folders included^)
+ echo.
+)
+
+REM Check for Lua files
echo Checking for Lua files...
dir /b *.lua >nul 2>&1
if errorlevel 1 (
echo.
echo WARNING: No Lua files found in build directory!
echo.
- echo Please copy your Lua files:
- echo cd build
- echo copy ..\your_game\*.lua .
+ if exist "..\game" (
+ echo No Lua files found in game/ folder.
+ echo Add your main.lua to game/ folder and try again.
+ ) else (
+ echo Tip: Create a game/ folder in project root and add main.lua there.
+ echo Or manually copy files:
+ echo cd build
+ echo copy ..\your_game\*.lua .
+ )
echo.
set /p CONTINUE="Do you want to continue anyway? (y/N): "
if /i not "%CONTINUE%"=="y" exit /b 1
@@ -47,24 +74,22 @@ if errorlevel 1 (
dir /b *.lua
)
-REM Check for assets folder
+REM Check for non-Lua data files (any folder, any file type)
echo.
-echo Checking for assets...
-if not exist "assets" (
- echo.
- echo WARNING: No assets folder found!
- echo.
- echo To embed assets, create the folder and copy files:
- echo cd build
- echo mkdir assets
- echo copy ..\your_game\assets\* assets\
- echo.
- set /p CONTINUE="Do you want to continue without assets? (y/N): "
- if /i not "%CONTINUE%"=="y" exit /b 1
- set EMBED_ASSETS=OFF
-) else (
- echo Found assets folder
+echo Checking for data files to embed...
+set DATA_COUNT=0
+for /r %%f in (*) do (
+ echo %%~nxf | findstr /i /v ".lua .exe .o .a CMake Makefile" >nul
+ if not errorlevel 1 set /a DATA_COUNT+=1
+)
+
+if %DATA_COUNT% GTR 0 (
+ echo Found data files to embed
+ echo ^(includes: images, sounds, config, data, and any other files^)
set EMBED_ASSETS=ON
+) else (
+ echo No non-Lua files found ^(only Lua code will be embedded^)
+ set EMBED_ASSETS=OFF
)
echo.
@@ -72,7 +97,7 @@ echo ================================
echo Build Configuration
echo ================================
echo Lua Embedding: ON
-echo Asset Embedding: %EMBED_ASSETS%
+echo Data Embedding: %EMBED_ASSETS%
echo Build Type: Release
echo ================================
echo.