From 78efc8cbb401e266733d3da0ab304e62130d09fe Mon Sep 17 00:00:00 2001 From: Kyle Farnung Date: Thu, 6 Jul 2017 16:03:27 -0700 Subject: [PATCH] build: split up cpplint to avoid long cmd lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactors cpplint slightly to allow multiple runs of it. This allows downstream projects to run cpplint on their dependencies. PR-URL: https://github.com/nodejs/node/pull/14116 Reviewed-By: Refael Ackermann Reviewed-By: Kunal Pathak Reviewed-By: João Reis --- vcbuild.bat | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index d33e4b7dfc16ab..4b7f95a9a8134f 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -72,6 +72,7 @@ if /i "%1"=="test-all" set test_args=%test_args% sequential parallel messag if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok if /i "%1"=="jslint" set jslint=1&goto arg-ok if /i "%1"=="jslint-ci" set jslint_ci=1&goto arg-ok +if /i "%1"=="cpplint" set cpplint=1&goto arg-ok if /i "%1"=="lint" set cpplint=1&set jslint=1&goto arg-ok if /i "%1"=="lint-ci" set cpplint=1&set jslint_ci=1&goto arg-ok if /i "%1"=="package" set package=1&goto arg-ok @@ -347,12 +348,16 @@ goto cpplint :cpplint if not defined cpplint goto jslint -echo running cpplint +call :run-cpplint src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h tools\icu\*.cc tools\icu\*.h +call :run-python tools/check-imports.py +goto jslint + +:run-cpplint +if "%*"=="" goto exit +echo running cpplint '%*' set cppfilelist= setlocal enabledelayedexpansion -for /f "tokens=*" %%G in ('dir /b /s /a src\*.c src\*.cc src\*.h ^ -test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h ^ -test\gc\binding.cc tools\icu\*.cc tools\icu\*.h') do ( +for /f "tokens=*" %%G in ('dir /b /s /a %*') do ( set relpath=%%G set relpath=!relpath:*%~dp0=! call :add-to-list !relpath! @@ -360,9 +365,8 @@ test\gc\binding.cc tools\icu\*.cc tools\icu\*.h') do ( ( endlocal set cppfilelist=%localcppfilelist% ) -python tools/cpplint.py %cppfilelist% -python tools/check-imports.py -goto jslint +call :run-python tools/cpplint.py %cppfilelist% +goto exit :add-to-list echo %1 | findstr /c:"src\node_root_certs.h"