@@ -16,21 +16,21 @@ if not "%TFENV%" == "" (
1616 call " ..\..\..\tfenv.bat"
1717)
1818
19- for %%I in (nmake.exe) do if exist %%~$path:I set MAKE = %%~$path:I
20- if " %MAKE % " == " " (
21- for %%I in (jom.exe) do if exist %%~$path:I set MAKE = %%~$path:I
22- if not " %MAKE % " == " " (
23- set MAKE = jom
19+ for %%I in (nmake.exe) do if exist %%~$path:I set NMAKE = %%~$path:I
20+ if " %NMAKE % " == " " (
21+ for %%I in (jom.exe) do if exist %%~$path:I set NMAKE = %%~$path:I
22+ if not " %NMAKE % " == " " (
23+ set NMAKE = jom
2424 )
2525) else (
26- set MAKE = nmake VERBOSE=1
26+ set NMAKE = nmake VERBOSE=1
2727)
2828for %%I in (qmake.exe) do if exist %%~$path:I set QMAKE = %%~$path:I
2929for %%I in (cmake.exe) do if exist %%~$path:I set CMAKE = %%~$path:I
3030for %%I in (sqlite3.exe) do if exist %%~$path:I set SQLITE = %%~$path:I
3131if " %SQLITE% " == " " for %%I in (sqlite3-bin.exe) do if exist %%~$path:I set SQLITE = %%~$path:I
3232
33- if " %MAKE % " == " " (
33+ if " %NMAKE % " == " " (
3434 echo;
3535 echo nmake.exe not found.
3636 call :CleanUp
@@ -59,7 +59,7 @@ if /i "%Platform%" == "x64" (
5959)
6060
6161cd /D %BASEDIR%
62- rd /Q /S %APPNAME%
62+ rd /Q /S %APPNAME% > nul 2 > nul
6363tspawn new %APPNAME%
6464if " %SQLITE% " == " " (
6565 echo;
@@ -73,40 +73,29 @@ cd %APPDIR%
7373echo n | tspawn s blog
7474tspawn w foo
7575
76- :: Set ExecutionPolicy
77- @ REM for %%I in (tadpoled.exe) do if exist %%~$path:I set TADPOLED=%%~$path:I
78- @ REM for %%I in (tadpole.exe) do if exist %%~$path:I set TADPOLE=%%~$path:I
79- powershell -Command " Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser -Force"
80- @ REM powershell -command "New-NetFirewallRule -DisplayName MyAppAccess1 -Direction Inbound -Action Allow -Profile Public,Private -Program '%TADPOLED%' -Protocol TCP -LocalPort %PORT% -RemoteAddress 127.0.0.1" > nul 2> &1
81- @ REM powershell -command "New-NetFirewallRule -DisplayName MyAppAccess2 -Direction Inbound -Action Allow -Profile Public,Private -Program '%TADPOLE%' -Protocol TCP -LocalPort %PORT% -RemoteAddress 127.0.0.1" > nul 2> &1
82-
8376:: Test in debug mode
84- if not " %CMAKE% " == " " (
85- call :CMakeBuild Debug
86- if ERRORLEVEL 1 exit /B %ERRORLEVEL%
87- call :CheckWebApp treefrogd.exe
88- if ERRORLEVEL 1 exit /B %ERRORLEVEL%
89- )
77+ call :CMakeBuild Debug
78+ if ERRORLEVEL 1 exit /B %ERRORLEVEL%
79+ call :CheckWebApp treefrogd.exe
80+ if ERRORLEVEL 1 exit /B %ERRORLEVEL%
9081
9182call :QMakeBuild debug
9283if ERRORLEVEL 1 exit /B %ERRORLEVEL%
9384call :CheckWebApp treefrogd.exe
9485if ERRORLEVEL 1 exit /B %ERRORLEVEL%
95- %MAKE% distclean > nul 2 > nul
86+ nmake distclean > nul 2 > nul
9687
9788:: Test in release mode
98- if not " %CMAKE% " == " " (
99- call :CMakeBuild Release
100- if ERRORLEVEL 1 exit /B %ERRORLEVEL%
101- call :CheckWebApp treefrog.exe
102- if ERRORLEVEL 1 exit /B %ERRORLEVEL%
103- )
89+ call :CMakeBuild Release
90+ if ERRORLEVEL 1 exit /B %ERRORLEVEL%
91+ call :CheckWebApp treefrog.exe
92+ if ERRORLEVEL 1 exit /B %ERRORLEVEL%
10493
10594call :QMakeBuild release
10695if ERRORLEVEL 1 exit /B %ERRORLEVEL%
10796call :CheckWebApp treefrog.exe
10897if ERRORLEVEL 1 exit /B %ERRORLEVEL%
109- %MAKE% distclean > nul 2 > nul
98+ nmake distclean > nul 2 > nul
11099
111100echo;
112101echo Test OK
@@ -145,8 +134,8 @@ exit /B 0
145134:QMakeBuild
146135cd /D %APPDIR%
147136del /Q /F lib\*.*
148- qmake -r CONFIG+=%1
149- %MAKE %
137+ " %QMAKE% " -r CONFIG+=%1
138+ %NMAKE %
150139if ERRORLEVEL 1 (
151140 echo;
152141 echo Build Error!
@@ -167,49 +156,53 @@ if "%TREEFROG%" == "" (
167156 exit /B 1
168157)
169158
170- " %1 " -v
171- " %1 " -l
172- " %1 " --show-routes
159+ echo " %TREEFROG% " -v
160+ " %TREEFROG% " -v 2 >& 1
161+ echo " %TREEFROG% " -l
162+ " %TREEFROG% " -l 2 >& 1
163+ echo " %TREEFROG% " --show-routes
164+ " %TREEFROG% " --show-routes 2 >& 1
173165if ERRORLEVEL 1 (
174166 echo App Error!
175167 exit /B 1
176168)
177169echo;
178170
179- " %1 " --settings
171+ echo " %TREEFROG% " --settings
172+ " %TREEFROG% " --settings 2 >& 1
180173if ERRORLEVEL 1 (
181174 echo App Error!
182175 type log\treefrog.log
183176 exit /B 1
184177)
185178echo;
186179
187- @ REM echo Starting webapp..
188- @ REM set RES=1
189- @ REM "%1" -e dev -d -p %PORT% %APPDIR%
190- @ REM if ERRORLEVEL 1 (
191- @ REM echo App Start Error!
192- @ REM exit /B 1
193- @ REM )
194-
195- @ REM timeout 1 /nobreak > nul
196- @ REM set URL=http://localhost:%PORT%/blog
197- @ REM set CMD=curl -s "%URL%" -w "%%{http_code}" -o nul
198- @ REM set RESCODE=0
199- @ REM for /f "usebackq delims=" %%a in (`%CMD%`) do set RESCODE=%%a
200- @ REM "%1" -k stop %APPDIR%
201- @ REM if ERRORLEVEL 1 (
202- @ REM "%1" -k abort %APPDIR%
203- @ REM )
204- @ REM timeout 1 /nobreak > nul
205- @ REM if not "%RESCODE%"=="200" (
206- @ REM echo HTTP request failed
207- @ REM echo;
208- @ REM echo App Test Error!
209- @ REM call :CleanUp
210- @ REM exit /B 1
211- @ REM )
212- @ REM echo HTTP request success "%URL%"
180+ echo Starting webapp..
181+ set RES = 1
182+ " %1 " -e dev -d -p %PORT% %APPDIR%
183+ if ERRORLEVEL 1 (
184+ echo App Start Error!
185+ exit /B 1
186+ )
187+
188+ timeout 1 /nobreak > nul
189+ set URL = http://localhost:%PORT% /blog
190+ set CMD = curl -s " %URL% " -w " %% {http_code}" -o nul
191+ set RESCODE = 0
192+ for /f " usebackq delims=" %%a in (`%CMD% `) do set RESCODE = %%a
193+ " %1 " -k stop %APPDIR%
194+ if ERRORLEVEL 1 (
195+ " %1 " -k abort %APPDIR%
196+ )
197+ timeout 1 /nobreak > nul
198+ if not " %RESCODE% " == " 200" (
199+ echo HTTP request failed
200+ echo;
201+ echo App Test Error!
202+ call :CleanUp
203+ exit /B 1
204+ )
205+ echo HTTP request success " %URL% "
213206
214207exit /B 0
215208
@@ -218,7 +211,7 @@ exit /B 0
218211::
219212:CleanUp
220213cd /D %BASEDIR%
221- rd /Q /S %APPNAME%
214+ rd /Q /S %APPNAME% > nul 2 > nul
222215exit /B 0
223216
224217:: which cmd
0 commit comments