@@ -376,55 +376,63 @@ goto cpplint
376
376
if not defined cpplint goto jslint
377
377
echo running cpplint
378
378
set cppfilelist =
379
- setlocal enabledelayedexpansion
380
- for /f " tokens=* " %%G in ('dir /b /s /a src\*.c src\*.cc src\*.h ^
381
- test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h ^
382
- test\gc\binding.cc tools\icu\*.cc tools\icu \*.h') do (
383
- set relpath = %%G
384
- set relpath = !relpath: * % ~dp0 =!
385
- call : add-to-list !relpath!
386
- )
387
- ( endlocal
388
- set cppfilelist = %localcppfilelist%
389
- )
379
+ set cpp_locs = src\*.c
380
+ set cpp_locs = %cpp_locs% src\*.cc
381
+ set cpp_locs = %cpp_locs% src\*.h
382
+ set cpp_locs = %cpp_locs% test\addons \*.cc
383
+ set cpp_locs = %cpp_locs% test\addons\*.h
384
+ set cpp_locs = %cpp_locs% test\cctest\*.cc
385
+ set cpp_locs = %cpp_locs% test\cctest\*.h
386
+ set cpp_locs = %cpp_locs% test\gc\binding.cc
387
+ set cpp_locs = %cpp_locs% tools\icu\*.cc
388
+ set cpp_locs = %cpp_locs% tools\icu\*.h
389
+ for /f " tokens=* " %%G in ('dir /b /s /a:, %cpp_locs% ') do call : add-to-list %%G
390
390
python tools/cpplint.py %cppfilelist%
391
391
python tools/check-imports.py
392
392
goto jslint
393
393
394
394
:add-to-list
395
- echo %1 | findstr /c:" src\node_root_certs.h"
396
- if %errorlevel% equ 0 goto exit
397
-
398
- echo %1 | findstr /c:" src\queue.h"
399
- if %errorlevel% equ 0 goto exit
400
-
401
- echo %1 | findstr /c:" src\tree.h"
402
- if %errorlevel% equ 0 goto exit
403
-
404
- @ rem skip subfolders under /src
405
- echo %1 | findstr /r /c:" src\\.*\\.*"
406
- if %errorlevel% equ 0 goto exit
407
-
408
- echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.h"
409
- if %errorlevel% equ 0 goto exit
410
-
411
- echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.cc"
412
- if %errorlevel% equ 0 goto exit
413
-
414
- set " localcppfilelist = %localcppfilelist% %1 "
395
+ setlocal enabledelayedexpansion
396
+ set base_path =
397
+ set relpath = %1
398
+ set relpath = !relpath:%~dp0 =!
399
+ endlocal& set relpath=%relpath%
400
+ @ rem findstr can do multiple searches, but only for regexes
401
+ set find_arg = /r
402
+ set find_arg = %find_arg% /c:" src\\node_root_certs\.h"
403
+ set find_arg = %find_arg% /c:" src\\queue\.h"
404
+ set find_arg = %find_arg% /c:" src\\tree\.h"
405
+ set find_arg = %find_arg% /c:" src\\.*\\.*"
406
+ set find_arg = %find_arg% /c:" test\\addons\\[0-9].*_.*\.h"
407
+ set find_arg = %find_arg% /c:" test\\addons\\[0-9].*_.*\.cc"
408
+ echo %relpath% | findstr %find_arg% > nul
409
+ if not errorlevel 1 exit /b
410
+ set " cppfilelist = %cppfilelist% %relpath% "
411
+ exit /b
412
+
413
+ :find_node
414
+ if exist %config% \node set nodeexe = %config% \node& exit /b
415
+ where node > nul 2 > nul
416
+ if not errorlevel 1 set nodeexe = node& exit /b
417
+ echo Could not file node.exe
415
418
goto exit
419
+ exit /b
416
420
417
421
:jslint
418
422
if defined jslint_ci goto jslint-ci
419
423
if not defined jslint goto exit
420
424
if not exist tools\eslint\lib\eslint.js goto no-lint
425
+ call :find_node
421
426
echo running jslint
422
- %config% \node tools\eslint\bin\eslint.js --cache --rule " linebreak-style: 0" --rulesdir=tools\eslint-rules benchmark lib test tools
427
+ %nodeexe% tools\eslint\bin\eslint.js --cache --rule " linebreak-style: 0" --rulesdir=tools\eslint-rules benchmark lib test tools
428
+ if not errorlevel 1 echo jslint finished with no errors
423
429
goto exit
424
430
425
431
:jslint-ci
432
+ call :find_node
426
433
echo running jslint-ci
427
- %config% \node tools\jslint.js -J -f tap -o test-eslint.tap benchmark lib test tools
434
+ %nodeexe% tools\jslint.js -J -f tap -o test-eslint.tap benchmark lib test tools
435
+ if not errorlevel 1 echo jslint-ci finished with no errors
428
436
goto exit
429
437
430
438
:no-lint
@@ -437,7 +445,7 @@ echo Failed to create vc project files.
437
445
goto exit
438
446
439
447
:help
440
- echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-inspector/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [sign] [x86/x64] [vc2015] [download-all] [enable-vtune] [lint/lint-ci]
448
+ echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-inspector/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [sign] [x86/x64] [vc2015] [download-all] [enable-vtune] [lint/lint-ci/jslint/jslint-ci ]
441
449
echo Examples:
442
450
echo vcbuild.bat : builds release build
443
451
echo vcbuild.bat debug : builds debug build
0 commit comments