Skip to content

Commit

Permalink
build: split up cpplint to avoid long cmd lines
Browse files Browse the repository at this point in the history
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 <refack@gmail.com>
Reviewed-By: Kunal Pathak <kunal.pathak@microsoft.com>
Reviewed-By: João Reis <reis@janeasystems.com>
  • Loading branch information
kfarnung authored and MylesBorins committed Sep 19, 2017
1 parent c9ae894 commit 14cc1ab
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -347,22 +348,25 @@ 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!
)
( 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"
Expand Down

0 comments on commit 14cc1ab

Please sign in to comment.