-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload_build.bat
51 lines (51 loc) · 1.85 KB
/
upload_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
@echo off
echo Building... "%1" "%2" "%3"
set result1=false
if "%1"=="/c" set result1=true
if "%1"=="/f" set result1=true
if "%1"=="" set result1=true
if %result1%==true (
echo Type COM port number in the first argument ^( COM3 for example ^)
EXIT /b
)
xcopy /s /y /q "%~dp0src" "%~dp0build_temp\"
set resultc=false
if "%2"=="/c" set resultc=true
if "%3"=="/c" set resultc=true
if %resultc%==true (
for /r "%~dp0\build_temp" %%i in (*.lua) do (
node build\luatolc.js "%%i"
)
)
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 reset
ping 127.0.0.1 -n 2 > nul
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 remove init.lua
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 reset
ping 127.0.0.1 -n 2 > nul
echo Formatting...
set resultf=false
if "%2"=="/f" set resultf=true
if "%3"=="/f" set resultf=true
if %resultf%==true (
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 mkfs --noninteractive
)
echo Uploading...
for /r "%~dp0\build_temp" %%i in (*.lua *.png *.html *.json) do (
echo %%i
if NOT %%~xi==.lua-TEMPLATE (
if %resultc%==true (
if %%~ni==init (
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 upload "%%i"
) else (
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 upload --compile "%%i"
)
) else (
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 upload "%%i"
)
)
)
rmdir /s /q "%~dp0\build_temp"
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 fsinfo
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 reset
node "%~dp0node_modules\nodemcu-tool\bin\nodemcu-tool.js" -p %1 -b 115200 terminal
echo ESP8266 ready!