From 5a7154ef32e53555d6a56a509a1cafdec250b8ec Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 6 Jun 2019 12:16:08 -0400 Subject: [PATCH] build,win: delegate lint-cpp to make MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * look for GNU Make in the Path or use wsl PR-URL: https://github.com/nodejs/node/pull/28102 Fixes: https://github.com/nodejs/node/issues/28086 Reviewed-By: James M Snell Reviewed-By: João Reis --- vcbuild.bat | 52 +++++++++------------------------------------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index 4c84473558614e..a6553e89b53a80 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -593,51 +593,17 @@ goto lint-cpp :lint-cpp if not defined lint_cpp goto lint-js -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 -python tools/check-imports.py +if defined NODEJS_MAKE goto run-make-lint +where make > NUL 2>&1 && make -v | findstr /C:"GNU Make" 1> NUL +if "%ERRORLEVEL%"=="0" set "NODEJS_MAKE=make PYTHON=python" & goto run-make-lint +where wsl > NUL 2>1 +if "%ERRORLEVEL%"=="0" set "NODEJS_MAKE=wsl make" & goto run-make-lint +echo Could not find GNU Make, needed for linting C/C++ goto lint-js -:run-lint-cpp -if "%*"=="" goto exit -echo running lint-cpp '%*' -set cppfilelist= -setlocal enabledelayedexpansion -for /f "tokens=*" %%G in ('dir /b /s /a %*') do ( - set relpath=%%G - set relpath=!relpath:*%~dp0=! - call :add-to-list !relpath! > nul -) -( endlocal - set cppfilelist=%localcppfilelist% -) -python tools/cpplint.py %cppfilelist% > nul -goto exit - -:add-to-list -@rem Subroutine used to filter items from the cpplint file list -echo %1 | findstr /c:"src\node_root_certs.h" > nul 2>&1 -if %errorlevel% equ 0 goto exit - -echo %1 | findstr /c:"src\tracing\trace_event.h" > nul 2>&1 -if %errorlevel% equ 0 goto exit - -echo %1 | findstr /c:"src\tracing\trace_event_common.h" > nul 2>&1 -if %errorlevel% equ 0 goto exit - -echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.h" > nul 2>&1 -if %errorlevel% equ 0 goto exit - -echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.cc" > nul 2>&1 -if %errorlevel% equ 0 goto exit - -echo %1 | findstr /c:"test\js-native-api\common.h" > nul 2>&1 -if %errorlevel% equ 0 goto exit - -echo %1 | findstr /c:"test\node-api\common.h" > nul 2>&1 -if %errorlevel% equ 0 goto exit - -set "localcppfilelist=%localcppfilelist% %1" -goto exit +:run-make-lint +%NODEJS_MAKE% lint-cpp +goto lint-js :lint-js if defined lint_js_ci goto lint-js-ci