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