@@ -378,55 +378,64 @@ goto cpplint
378378if not defined cpplint goto jslint
379379echo running cpplint
380380set cppfilelist =
381- setlocal enabledelayedexpansion
382- for /f " tokens=* " %%G in ('dir /b /s /a src\*.c src\*.cc src\*.h ^
383- test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h ^
384- test\gc\binding.cc tools\icu\*.cc tools\icu \*.h') do (
385- set relpath = %%G
386- set relpath = !relpath: * % ~dp0 =!
387- call : add-to-list !relpath!
388- )
389- ( endlocal
390- set cppfilelist = %localcppfilelist%
391- )
381+ set cpp_locs = src\*.c
382+ set cpp_locs = %cpp_locs% src\*.cc
383+ set cpp_locs = %cpp_locs% src\*.h
384+ set cpp_locs = %cpp_locs% test\addons \*.cc
385+ set cpp_locs = %cpp_locs% test\addons\*.h
386+ set cpp_locs = %cpp_locs% test\cctest\*.cc
387+ set cpp_locs = %cpp_locs% test\cctest\*.h
388+ set cpp_locs = %cpp_locs% test\gc\binding.cc
389+ set cpp_locs = %cpp_locs% tools\icu\*.cc
390+ set cpp_locs = %cpp_locs% tools\icu\*.h
391+ for /f " tokens=* " %%G in ('dir /b /s /a:, %cpp_locs% ') do call : add-to-list %%G
392392python tools/cpplint.py %cppfilelist%
393393python tools/check-imports.py
394394goto jslint
395395
396396:add-to-list
397- echo %1 | findstr /c:" src\node_root_certs.h"
398- if %errorlevel% equ 0 goto exit
399-
400- echo %1 | findstr /c:" src\queue.h"
401- if %errorlevel% equ 0 goto exit
402-
403- echo %1 | findstr /c:" src\tree.h"
404- if %errorlevel% equ 0 goto exit
405-
406- @ rem skip subfolders under /src
407- echo %1 | findstr /r /c:" src\\.*\\.*"
408- if %errorlevel% equ 0 goto exit
409-
410- echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.h"
411- if %errorlevel% equ 0 goto exit
412-
413- echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.cc"
414- if %errorlevel% equ 0 goto exit
415-
416- set " localcppfilelist = %localcppfilelist% %1 "
397+ setlocal enabledelayedexpansion
398+ set base_path =
399+ set relpath = %1
400+ set relpath = !relpath:%~dp0 =!
401+ endlocal& set relpath=%relpath%
402+ @ rem findstr can do multiple searches, but only for regexes
403+ set find_arg = /r
404+ set find_arg = %find_arg% /c:" src\\node_root_certs\.h"
405+ set find_arg = %find_arg% /c:" src\\queue\.h"
406+ set find_arg = %find_arg% /c:" src\\tree\.h"
407+ set find_arg = %find_arg% /c:" src\\.*\\.*"
408+ set find_arg = %find_arg% /c:" test\\addons\\[0-9].*_.*\.h"
409+ set find_arg = %find_arg% /c:" test\\addons\\[0-9].*_.*\.cc"
410+ echo %relpath% | findstr %find_arg% > nul
411+ if not errorlevel 1 exit /b
412+ set " cppfilelist = %cppfilelist% %relpath% "
413+ exit /b
414+
415+ :find_node_for_linting
416+ @ rem fall back to node.exe in path, used for linting only.
417+ if exist %config% \node set nodeexe4linting = %config% \node& exit /b
418+ where node > nul 2 > nul
419+ if not errorlevel 1 set nodeexe4linting = node& exit /b
420+ echo Could not find node.exe, needed for linting
417421goto exit
422+ exit /b
418423
419424:jslint
420425if defined jslint_ci goto jslint-ci
421426if not defined jslint goto exit
422427if not exist tools\eslint\lib\eslint.js goto no-lint
428+ call :find_node_for_linting
423429echo running jslint
424430%config% \node tools\eslint\bin\eslint.js --cache --rule " linebreak-style: 0" --rulesdir=tools\eslint-rules --ext=.js,.md benchmark doc lib test tools
431+ if not errorlevel 1 echo jslint finished with no errors
425432goto exit
426433
427434:jslint-ci
435+ call :find_node_for_linting
428436echo running jslint-ci
429- %config% \node tools\jslint.js -J -f tap -o test-eslint.tap benchmark lib test tools
437+ %nodeexe4linting% tools\jslint.js -J -f tap -o test-eslint.tap benchmark lib test tools
438+ if not errorlevel 1 echo jslint-ci finished with no errors
430439goto exit
431440
432441:no-lint
@@ -439,7 +448,7 @@ echo Failed to create vc project files.
439448goto exit
440449
441450:help
442- 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]
451+ 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 ]
443452echo Examples:
444453echo vcbuild.bat : builds release build
445454echo vcbuild.bat debug : builds debug build
0 commit comments