Skip to content

Commit 14cc1ab

Browse files
kfarnungMylesBorins
authored andcommitted
build: split up cpplint to avoid long cmd lines
Refactors cpplint slightly to allow multiple runs of it. This allows downstream projects to run cpplint on their dependencies. Backport-PR-URL: #14879 PR-URL: #14116 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Kunal Pathak <[email protected]> Reviewed-By: João Reis <[email protected]>
1 parent c9ae894 commit 14cc1ab

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

vcbuild.bat

+11-7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ if /i "%1"=="test-all" set test_args=%test_args% sequential parallel messag
7272
if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok
7373
if /i "%1"=="jslint" set jslint=1&goto arg-ok
7474
if /i "%1"=="jslint-ci" set jslint_ci=1&goto arg-ok
75+
if /i "%1"=="cpplint" set cpplint=1&goto arg-ok
7576
if /i "%1"=="lint" set cpplint=1&set jslint=1&goto arg-ok
7677
if /i "%1"=="lint-ci" set cpplint=1&set jslint_ci=1&goto arg-ok
7778
if /i "%1"=="package" set package=1&goto arg-ok
@@ -347,22 +348,25 @@ goto cpplint
347348

348349
:cpplint
349350
if not defined cpplint goto jslint
350-
echo running cpplint
351+
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
352+
call :run-python tools/check-imports.py
353+
goto jslint
354+
355+
:run-cpplint
356+
if "%*"=="" goto exit
357+
echo running cpplint '%*'
351358
set cppfilelist=
352359
setlocal enabledelayedexpansion
353-
for /f "tokens=*" %%G in ('dir /b /s /a src\*.c src\*.cc src\*.h ^
354-
test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h ^
355-
test\gc\binding.cc tools\icu\*.cc tools\icu\*.h') do (
360+
for /f "tokens=*" %%G in ('dir /b /s /a %*') do (
356361
set relpath=%%G
357362
set relpath=!relpath:*%~dp0=!
358363
call :add-to-list !relpath!
359364
)
360365
( endlocal
361366
set cppfilelist=%localcppfilelist%
362367
)
363-
python tools/cpplint.py %cppfilelist%
364-
python tools/check-imports.py
365-
goto jslint
368+
call :run-python tools/cpplint.py %cppfilelist%
369+
goto exit
366370

367371
:add-to-list
368372
echo %1 | findstr /c:"src\node_root_certs.h"

0 commit comments

Comments
 (0)