-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
executable file
·91 lines (72 loc) · 2.41 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@echo off
REM Strip trailing \
set PATH_BAT=%~dp0
if %PATH_BAT:~-1%==\ set PATH_BAT=%PATH_BAT:~0,-1%
REM ---------------------------------------------------------------------------
REM Setup
REM ---------------------------------------------------------------------------
set BUILD_TARGET=2017.3032
if not "%1"=="" (
set BUILD_TARGET="%1"
)
set BUILD_DIR=%PATH_BAT%\build
if not "%2"=="" (
set BUILD_DIR="%2"
)
set LUAC="%PATH_BAT%\bin\luac.exe"
set BUILD_TARGET_VM="lua_51"
if not "%3"=="" (
set BUILD_TARGET_VM="%3"
set LUAC="%PATH_BAT%/bin/luac-%BUILD_TARGET_VM%"
REM Verify that this VM is supported.
if not exist "%LUAC%" (
echo Error: Lua VM '%BUILD_TARGET_VM%' is not supported.
exit -1
)
)
set SevenZip="%PATH_BAT%\bin\7za.exe"
set LIBRARY_NAME=amazon-s3-lite
set LIBRARY_TYPE="plugin"
set ZIP_PATH=%PATH_BAT%\plugin-%LIBRARY_NAME%.zip
REM Clean build
if exist "%BUILD_DIR%" (
rmdir /s /q "%BUILD_DIR%"
)
if exist "%ZIP_PATH%" (
del /q "%ZIP_PATH%"
)
REM Create directories
set BUILD_DIR_LUA=%BUILD_DIR%\plugins\%BUILD_TARGET%\lua\%BUILD_TARGET_VM%
mkdir "%BUILD_DIR_LUA%"
REM ---------------------------------------------------------------------------
REM Copy files over.
REM ---------------------------------------------------------------------------
echo [copy]
xcopy /I /S "%PATH_BAT%\lua\%LIBRARY_TYPE%" "%BUILD_DIR_LUA%\%LIBRARY_TYPE%" /EXCLUDE:.bat_ignore
copy "%PATH_BAT%\metadata.json" "%BUILD_DIR%\metadata.json"
REM ---------------------------------------------------------------------------
REM Compile lua files.
REM ---------------------------------------------------------------------------
echo.
echo [compile]
%LUAC% -v
For /R "%BUILD_DIR%" %%F in (*.lua) Do (
echo Compiling %%F
%LUAC% -s -o "%%F" -- "%%F"
)
REM ---------------------------------------------------------------------------
REM Zip up files.
REM ---------------------------------------------------------------------------
echo.
echo [zip]
pushd %BUILD_DIR%
echo 7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
%SevenZip% a -r -tzip -y "%ZIP_PATH%" * | FIND "Compressing"
popd
REM ---------------------------------------------------------------------------
REM Finish.
REM ---------------------------------------------------------------------------
echo.
echo [complete]
echo Plugin build succeeded.
echo Zip file located at: %ZIP_PATH%