@@ -219,7 +219,8 @@ test: all
219
219
$(CI_ASYNC_HOOKS ) \
220
220
$(CI_JS_SUITES ) \
221
221
$(CI_NATIVE_SUITES ) \
222
- doctool known_issues
222
+ $(CI_DOC ) \
223
+ known_issues
223
224
endif
224
225
225
226
# 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
268
269
--directory=" $( shell pwd) /test/gc" \
269
270
--nodedir=" $( shell pwd) "
270
271
271
- # Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
272
272
DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.js doc/api/addons.md
273
273
274
274
ifeq ($(OSTYPE ) ,aix)
@@ -277,7 +277,7 @@ endif
277
277
278
278
test/addons/.docbuildstamp : $(DOCBUILDSTAMP_PREREQS )
279
279
$(RM ) -r test/addons/?? _* /
280
- $(NODE ) $<
280
+ [ -x $( NODE) ] && $( NODE ) $< || node $<
281
281
touch $@
282
282
283
283
ADDONS_BINDING_GYPS := \
@@ -313,10 +313,10 @@ test/addons/.buildstamp: config.gypi \
313
313
done
314
314
touch $@
315
315
316
- # .buildstamp and .docbuildstamp need $(NODE_EXE) but cannot depend on it
316
+ # .buildstamp needs $(NODE_EXE) but cannot depend on it
317
317
# directly because it calls make recursively. The parent make cannot know
318
318
# if the subprocess touched anything so it pessimistically assumes that
319
- # .buildstamp and .docbuildstamp are out of date and need a rebuild.
319
+ # .buildstamp is out of date and need a rebuild.
320
320
# Just goes to show that recursive make really is harmful...
321
321
# TODO(bnoordhuis) Force rebuild after gyp update.
322
322
build-addons : $(NODE_EXE ) test/addons/.buildstamp
@@ -352,10 +352,10 @@ test/addons-napi/.buildstamp: config.gypi \
352
352
done
353
353
touch $@
354
354
355
- # .buildstamp and .docbuildstamp need $(NODE_EXE) but cannot depend on it
355
+ # .buildstamp needs $(NODE_EXE) but cannot depend on it
356
356
# directly because it calls make recursively. The parent make cannot know
357
357
# if the subprocess touched anything so it pessimistically assumes that
358
- # .buildstamp and .docbuildstamp are out of date and need a rebuild.
358
+ # .buildstamp is out of date and need a rebuild.
359
359
# Just goes to show that recursive make really is harmful...
360
360
# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
361
361
build-addons-napi : $(NODE_EXE ) test/addons-napi/.buildstamp
@@ -387,6 +387,7 @@ test-all-valgrind: test-build
387
387
CI_NATIVE_SUITES ?= addons addons-napi
388
388
CI_ASYNC_HOOKS := async-hooks
389
389
CI_JS_SUITES ?= default
390
+ CI_DOC := doctool
390
391
391
392
# Build and test addons without building anything else
392
393
test-ci-native : LOGLEVEL := info
@@ -412,7 +413,8 @@ test-ci: | clear-stalled build-addons build-addons-napi doc-only
412
413
out/Release/cctest --gtest_output=tap:cctest.tap
413
414
$(PYTHON ) tools/test.py $(PARALLEL_ARGS ) -p tap --logfile test.tap \
414
415
--mode=release --flaky-tests=$(FLAKY_TESTS ) \
415
- $(TEST_CI_ARGS ) $(CI_ASYNC_HOOKS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) doctool known_issues
416
+ $(TEST_CI_ARGS ) $(CI_ASYNC_HOOKS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) \
417
+ $(CI_DOC ) known_issues
416
418
# Clean up any leftover processes, error if found.
417
419
ps awwx | grep Release/node | grep -v grep | cat
418
420
@PS_OUT=` ps awwx | grep Release/node | grep -v grep | awk ' {print $$1}' ` ; \
@@ -448,6 +450,10 @@ test-tick-processor: all
448
450
test-hash-seed : all
449
451
$(NODE ) test/pummel/test-hash-seed.js
450
452
453
+ test-doc : doc-only
454
+ $(MAKE ) lint
455
+ $(PYTHON ) tools/test.py $(CI_DOC )
456
+
451
457
test-known-issues : all
452
458
$(PYTHON ) tools/test.py known_issues
453
459
@@ -981,26 +987,38 @@ lint-md: lint-md-build
981
987
./* .md doc src lib benchmark tools/doc/ tools/icu/
982
988
983
989
LINT_JS_TARGETS = benchmark doc lib test tools
990
+ LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \
991
+ --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
992
+ $(LINT_JS_TARGETS )
984
993
985
994
lint-js :
986
995
@echo " Running JS linter..."
987
- $(NODE ) tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
988
- $(LINT_JS_TARGETS )
996
+ @if [ -x $( NODE) ]; then \
997
+ $(NODE ) $(LINT_JS_CMD ) ; \
998
+ else \
999
+ node $(LINT_JS_CMD ) ; \
1000
+ fi
989
1001
990
1002
jslint : lint-js
991
1003
@echo " Please use lint-js instead of jslint"
992
1004
993
1005
lint-js-ci :
994
1006
@echo " Running JS linter..."
995
- $(NODE ) tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
996
- $(LINT_JS_TARGETS )
1007
+ @if [ -x $( NODE) ]; then \
1008
+ $(NODE ) tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1009
+ $(LINT_JS_TARGETS ) ; \
1010
+ else \
1011
+ node tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1012
+ $(LINT_JS_TARGETS ) ; \
1013
+ fi
997
1014
998
1015
jslint-ci : lint-js-ci
999
1016
@echo " Please use lint-js-ci instead of jslint-ci"
1000
1017
1018
+ LINT_CPP_ADDON_DOC_FILES = $(wildcard test/addons/??_* /* .cc test/addons/??_* /* .h)
1001
1019
LINT_CPP_EXCLUDE ?=
1002
1020
LINT_CPP_EXCLUDE += src/node_root_certs.h
1003
- LINT_CPP_EXCLUDE += $(wildcard test/addons/??_ * / * .cc test/addons/??_ * / * .h )
1021
+ LINT_CPP_EXCLUDE += $(LINT_CPP_ADDON_DOC_FILES )
1004
1022
LINT_CPP_EXCLUDE += $(wildcard test/addons-napi/??_* /* .cc test/addons-napi/??_* /* .h)
1005
1023
# These files were copied more or less verbatim from V8.
1006
1024
LINT_CPP_EXCLUDE += src/tracing/trace_event.h src/tracing/trace_event_common.h
@@ -1024,11 +1042,19 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
1024
1042
tools/icu/* .h \
1025
1043
) )
1026
1044
1045
+ # Code blocks don't have newline at the end,
1046
+ # and the actual filename is generated so it won't match header guards
1047
+ ADDON_DOC_LINT_FLAGS =-whitespace/ending_newline,-build/header_guard
1048
+
1027
1049
lint-cpp :
1028
1050
@echo " Running C++ linter..."
1029
1051
@$(PYTHON ) tools/cpplint.py $(LINT_CPP_FILES )
1030
1052
@$(PYTHON ) tools/check-imports.py
1031
1053
1054
+ lint-addon-docs : test/addons/.docbuildstamp
1055
+ @echo " Running C++ linter on addon docs..."
1056
+ @$(PYTHON ) tools/cpplint.py --filter=$(ADDON_DOC_LINT_FLAGS ) $(LINT_CPP_ADDON_DOC_FILES )
1057
+
1032
1058
cpplint : lint-cpp
1033
1059
@echo " Please use lint-cpp instead of cpplint"
1034
1060
@@ -1038,9 +1064,10 @@ lint:
1038
1064
$(MAKE ) lint-js || EXIT_STATUS=$$? ; \
1039
1065
$(MAKE ) lint-cpp || EXIT_STATUS=$$? ; \
1040
1066
$(MAKE ) lint-md || EXIT_STATUS=$$? ; \
1067
+ $(MAKE ) lint-addon-docs || EXIT_STATUS=$$? ; \
1041
1068
exit $$ EXIT_STATUS
1042
1069
CONFLICT_RE =^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+
1043
- lint-ci : lint-js-ci lint-cpp lint-md
1070
+ lint-ci : lint-js-ci lint-cpp lint-md lint-addon-docs
1044
1071
@if ! ( grep -IEqrs " $( CONFLICT_RE) " benchmark deps doc lib src test tools ) \
1045
1072
&& ! ( find . -maxdepth 1 -type f | xargs grep -IEqs " $( CONFLICT_RE) " ); then \
1046
1073
exit 0 ; \
@@ -1120,6 +1147,7 @@ endif
1120
1147
test-ci \
1121
1148
test-ci-js \
1122
1149
test-ci-native \
1150
+ test-doc \
1123
1151
test-gc \
1124
1152
test-gc-clean \
1125
1153
test-hash-seed \
0 commit comments