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: #28102 Fixes: #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

+9-43
Original file line numberDiff line numberDiff line change
@@ -593,51 +593,17 @@ goto lint-cpp
593593

594594
:lint-cpp
595595
if not defined 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+
if defined NODEJS_MAKE goto run-make-lint
597+
where make > NUL 2>&1 && make -v | findstr /C:"GNU Make" 1> NUL
598+
if "%ERRORLEVEL%"=="0" set "NODEJS_MAKE=make PYTHON=python" & goto run-make-lint
599+
where wsl > NUL 2>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 "%*"=="" goto exit
602-
echo running lint-cpp '%*'
603-
set cppfilelist=
604-
setlocal enabledelayedexpansion
605-
for /f "tokens=*" %%G in ('dir /b /s /a %*') do (
606-
set relpath=%%G
607-
set relpath=!relpath:*%~dp0=!
608-
call :add-to-list !relpath! > nul
609-
)
610-
( endlocal
611-
set cppfilelist=%localcppfilelist%
612-
)
613-
python tools/cpplint.py %cppfilelist% > nul
614-
goto exit
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" > nul 2>&1
619-
if %errorlevel% equ 0 goto exit
620-
621-
echo %1 | findstr /c:"src\tracing\trace_event.h" > nul 2>&1
622-
if %errorlevel% equ 0 goto exit
623-
624-
echo %1 | findstr /c:"src\tracing\trace_event_common.h" > nul 2>&1
625-
if %errorlevel% equ 0 goto exit
626-
627-
echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.h" > nul 2>&1
628-
if %errorlevel% equ 0 goto exit
629-
630-
echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.cc" > nul 2>&1
631-
if %errorlevel% equ 0 goto exit
632-
633-
echo %1 | findstr /c:"test\js-native-api\common.h" > nul 2>&1
634-
if %errorlevel% equ 0 goto exit
635-
636-
echo %1 | findstr /c:"test\node-api\common.h" > nul 2>&1
637-
if %errorlevel% equ 0 goto exit
638-
639-
set "localcppfilelist=%localcppfilelist% %1"
640-
goto exit
604+
:run-make-lint
605+
%NODEJS_MAKE% lint-cpp
606+
goto lint-js
641607

642608
:lint-js
643609
if defined lint_js_ci goto lint-js-ci

0 commit comments

Comments
 (0)