Skip to content

Commit 5a7154e

Browse files
refackBridgeAR
authored andcommitted
build,win: delegate lint-cpp to make
* look for GNU Make in the Path or use wsl PR-URL: #28102Fixes: #28086 Reviewed-By: James M Snell <[email protected]> Reviewed-By: João Reis <[email protected]>
1 parent 48d7d7c commit 5a7154e

File tree

1 file changed

+9
-43
lines changed

1 file changed

+9
-43
lines changed

‎vcbuild.bat‎

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -593,51 +593,17 @@ goto lint-cpp
593593

594594
:lint-cpp
595595
ifnotdefined lint_cpp goto lint-js
596-
call :run-lint-cpp src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\js-native-api\*.cc test\js-native-api\*.cc test\js-native-api\*.h test\node-api\*.cc test\node-api\*.cc test\node-api\*.h test\cctest\*.cc test\cctest\*.h tools\icu\*.cc tools\icu\*.h
597-
python tools/check-imports.py
596+
ifdefined NODEJS_MAKE goto run-make-lint
597+
where make >NUL2>&1 && make -v |findstr /C:"GNU Make"1>NUL
598+
if"%ERRORLEVEL%"=="0"set"NODEJS_MAKE=make PYTHON=python"&goto run-make-lint
599+
wherewsl>NUL2>1
600+
if"%ERRORLEVEL%"=="0"set"NODEJS_MAKE=wsl make"&goto run-make-lint
601+
echo Could not find GNU Make, needed for linting C/C++
598602
goto lint-js
599603

600-
:run-lint-cpp
601-
if"%*"==""gotoexit
602-
echo running lint-cpp '%*'
603-
setcppfilelist=
604-
setlocalenabledelayedexpansion
605-
for /f "tokens=*"%%Gin ('dir /b /s /a %*') do (
606-
setrelpath=%%G
607-
setrelpath=!relpath:*%~dp0=!
608-
call :add-to-list!relpath!>nul
609-
)
610-
( endlocal
611-
setcppfilelist=%localcppfilelist%
612-
)
613-
python tools/cpplint.py %cppfilelist%>nul
614-
gotoexit
615-
616-
:add-to-list
617-
@rem Subroutine used to filter items from the cpplint file list
618-
echo%1|findstr /c:"src\node_root_certs.h">nul2>&1
619-
if%errorlevel%equ0gotoexit
620-
621-
echo%1|findstr /c:"src\tracing\trace_event.h">nul2>&1
622-
if%errorlevel%equ0gotoexit
623-
624-
echo%1|findstr /c:"src\tracing\trace_event_common.h">nul2>&1
625-
if%errorlevel%equ0gotoexit
626-
627-
echo%1|findstr /r /c:"test\\addons\\[0-9].*_.*\.h">nul2>&1
628-
if%errorlevel%equ0gotoexit
629-
630-
echo%1|findstr /r /c:"test\\addons\\[0-9].*_.*\.cc">nul2>&1
631-
if%errorlevel%equ0gotoexit
632-
633-
echo%1|findstr /c:"test\js-native-api\common.h">nul2>&1
634-
if%errorlevel%equ0gotoexit
635-
636-
echo%1|findstr /c:"test\node-api\common.h">nul2>&1
637-
if%errorlevel%equ0gotoexit
638-
639-
set"localcppfilelist=%localcppfilelist%%1"
640-
gotoexit
604+
:run-make-lint
605+
%NODEJS_MAKE% lint-cpp
606+
goto lint-js
641607

642608
:lint-js
643609
ifdefined lint_js_ci goto lint-js-ci

0 commit comments

Comments
(0)