@@ -219,7 +219,8 @@ test: all
219219 $(CI_ASYNC_HOOKS ) \
220220 $(CI_JS_SUITES ) \
221221 $(CI_NATIVE_SUITES ) \
222- doctool known_issues
222+ $(CI_DOC ) \
223+ known_issues
223224endif
224225
225226# For a quick test, does not run linter or build doc
@@ -268,7 +269,6 @@ test/gc/build/Release/binding.node: test/gc/binding.cc test/gc/binding.gyp
268269 --directory=" $( shell pwd) /test/gc" \
269270 --nodedir=" $( shell pwd) "
270271
271- # Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
272272DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.js doc/api/addons.md
273273
274274ifeq ($(OSTYPE ) ,aix)
@@ -277,7 +277,7 @@ endif
277277
278278test/addons/.docbuildstamp : $(DOCBUILDSTAMP_PREREQS )
279279 $(RM ) -r test/addons/?? _* /
280- $(NODE ) $<
280+ [ -x $( NODE) ] && $( NODE ) $< || node $<
281281 touch $@
282282
283283ADDONS_BINDING_GYPS := \
@@ -312,10 +312,10 @@ test/addons/.buildstamp: config.gypi \
312312 done
313313 touch $@
314314
315- # .buildstamp and .docbuildstamp need $(NODE_EXE) but cannot depend on it
315+ # .buildstamp needs $(NODE_EXE) but cannot depend on it
316316# directly because it calls make recursively. The parent make cannot know
317317# if the subprocess touched anything so it pessimistically assumes that
318- # .buildstamp and .docbuildstamp are out of date and need a rebuild.
318+ # .buildstamp is out of date and need a rebuild.
319319# Just goes to show that recursive make really is harmful...
320320# TODO(bnoordhuis) Force rebuild after gyp update.
321321build-addons : $(NODE_EXE ) test/addons/.buildstamp
@@ -347,10 +347,10 @@ test/addons-napi/.buildstamp: config.gypi \
347347 done
348348 touch $@
349349
350- # .buildstamp and .docbuildstamp need $(NODE_EXE) but cannot depend on it
350+ # .buildstamp needs $(NODE_EXE) but cannot depend on it
351351# directly because it calls make recursively. The parent make cannot know
352352# if the subprocess touched anything so it pessimistically assumes that
353- # .buildstamp and .docbuildstamp are out of date and need a rebuild.
353+ # .buildstamp is out of date and need a rebuild.
354354# Just goes to show that recursive make really is harmful...
355355# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
356356build-addons-napi : $(NODE_EXE ) test/addons-napi/.buildstamp
@@ -382,6 +382,7 @@ test-all-valgrind: test-build
382382CI_NATIVE_SUITES ?= addons addons-napi
383383CI_ASYNC_HOOKS := async-hooks
384384CI_JS_SUITES ?= default
385+ CI_DOC := doctool
385386
386387# Build and test addons without building anything else
387388test-ci-native : LOGLEVEL := info
@@ -407,7 +408,8 @@ test-ci: | clear-stalled build-addons build-addons-napi doc-only
407408 out/Release/cctest --gtest_output=tap:cctest.tap
408409 $(PYTHON ) tools/test.py $(PARALLEL_ARGS ) -p tap --logfile test.tap \
409410 --mode=release --flaky-tests=$(FLAKY_TESTS ) \
410- $(TEST_CI_ARGS ) $(CI_ASYNC_HOOKS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) doctool known_issues
411+ $(TEST_CI_ARGS ) $(CI_ASYNC_HOOKS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) \
412+ $(CI_DOC ) known_issues
411413 # Clean up any leftover processes, error if found.
412414 ps awwx | grep Release/node | grep -v grep | cat
413415 @PS_OUT=` ps awwx | grep Release/node | grep -v grep | awk ' {print $$1}' ` ; \
@@ -443,6 +445,10 @@ test-tick-processor: all
443445test-hash-seed : all
444446 $(NODE ) test/pummel/test-hash-seed.js
445447
448+ test-doc : doc-only
449+ $(MAKE ) lint
450+ $(PYTHON ) tools/test.py $(CI_DOC )
451+
446452test-known-issues : all
447453 $(PYTHON ) tools/test.py known_issues
448454
@@ -976,26 +982,38 @@ lint-md: lint-md-build
976982 ./* .md doc src lib benchmark tools/doc/ tools/icu/
977983
978984LINT_JS_TARGETS = benchmark doc lib test tools
985+ LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \
986+ --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
987+ $(LINT_JS_TARGETS )
979988
980989lint-js :
981990 @echo " Running JS linter..."
982- $(NODE ) tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
983- $(LINT_JS_TARGETS )
991+ @if [ -x $( NODE) ]; then \
992+ $(NODE ) $(LINT_JS_CMD ) ; \
993+ else \
994+ node $(LINT_JS_CMD ) ; \
995+ fi
984996
985997jslint : lint-js
986998 @echo " Please use lint-js instead of jslint"
987999
9881000lint-js-ci :
9891001 @echo " Running JS linter..."
990- $(NODE ) tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
991- $(LINT_JS_TARGETS )
1002+ @if [ -x $( NODE) ]; then \
1003+ $(NODE ) tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1004+ $(LINT_JS_TARGETS ) ; \
1005+ else \
1006+ node tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1007+ $(LINT_JS_TARGETS ) ; \
1008+ fi
9921009
9931010jslint-ci : lint-js-ci
9941011 @echo " Please use lint-js-ci instead of jslint-ci"
9951012
1013+ LINT_CPP_ADDON_DOC_FILES = $(wildcard test/addons/??_* /* .cc test/addons/??_* /* .h)
9961014LINT_CPP_EXCLUDE ?=
9971015LINT_CPP_EXCLUDE += src/node_root_certs.h
998- LINT_CPP_EXCLUDE += $(wildcard test/addons/??_ * / * .cc test/addons/??_ * / * .h )
1016+ LINT_CPP_EXCLUDE += $(LINT_CPP_ADDON_DOC_FILES )
9991017LINT_CPP_EXCLUDE += $(wildcard test/addons-napi/??_* /* .cc test/addons-napi/??_* /* .h)
10001018# These files were copied more or less verbatim from V8.
10011019LINT_CPP_EXCLUDE += src/tracing/trace_event.h src/tracing/trace_event_common.h
@@ -1019,11 +1037,19 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
10191037 tools/icu/* .h \
10201038 ) )
10211039
1040+ # Code blocks don't have newline at the end,
1041+ # and the actual filename is generated so it won't match header guards
1042+ ADDON_DOC_LINT_FLAGS =-whitespace/ending_newline,-build/header_guard
1043+
10221044lint-cpp :
10231045 @echo " Running C++ linter..."
10241046 @$(PYTHON ) tools/cpplint.py $(LINT_CPP_FILES )
10251047 @$(PYTHON ) tools/check-imports.py
10261048
1049+ lint-addon-docs : test/addons/.docbuildstamp
1050+ @echo " Running C++ linter on addon docs..."
1051+ @$(PYTHON ) tools/cpplint.py --filter=$(ADDON_DOC_LINT_FLAGS ) $(LINT_CPP_ADDON_DOC_FILES )
1052+
10271053cpplint : lint-cpp
10281054 @echo " Please use lint-cpp instead of cpplint"
10291055
@@ -1033,9 +1059,10 @@ lint:
10331059 $(MAKE ) lint-js || EXIT_STATUS=$$? ; \
10341060 $(MAKE ) lint-cpp || EXIT_STATUS=$$? ; \
10351061 $(MAKE ) lint-md || EXIT_STATUS=$$? ; \
1062+ $(MAKE ) lint-addon-docs || EXIT_STATUS=$$? ; \
10361063 exit $$ EXIT_STATUS
10371064CONFLICT_RE =^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+
1038- lint-ci : lint-js-ci lint-cpp lint-md
1065+ lint-ci : lint-js-ci lint-cpp lint-md lint-addon-docs
10391066 @if ! ( grep -IEqrs " $( CONFLICT_RE) " benchmark deps doc lib src test tools ) \
10401067 && ! ( find . -maxdepth 1 -type f | xargs grep -IEqs " $( CONFLICT_RE) " ); then \
10411068 exit 0 ; \
@@ -1115,6 +1142,7 @@ endif
11151142 test-ci \
11161143 test-ci-js \
11171144 test-ci-native \
1145+ test-doc \
11181146 test-gc \
11191147 test-gc-clean \
11201148 test-hash-seed \
0 commit comments