Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: don't build node for doc build #9660

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets

apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))

doc-only: $(apidocs_html) $(apidocs_json)
doc: $(NODE_EXE) doc-only
doc: $(apidocs_html) $(apidocs_json)

$(apidoc_dirs):
mkdir -p $@
Expand All @@ -315,9 +314,14 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
out/doc/%: doc/%
cp -r $< $@

GET_NODE := $(or $(shell [ -x ./node ] && echo ./node), $(shell command -v node))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used to find one for the purpose of printing an error and not actually using it. Note that $(NODE) is still invoked for gen-json and gen-html which could be different to ./node or command -v node.

It also may be prudent to use which in here rather than command (see the XZ check).

So, perhaps this check should be used to determine which node to invoke but it should default to testing for $(NODE) rather than ./node (since ./node is the default but it can be overridden at runtime, e.g. NODE=blergh make .... The final command/which is a nice fallback that should get us by but that needs to carry on down to the execution of gen-json and gen-html.


# check if ./node is actually set, else use user pre-installed binary
gen-json = tools/doc/generate.js --format=json $< > $@
out/doc/api/%.json: doc/api/%.md
ifeq ($(call GET_NODE),)
$(error Node.js not found. Build it with `make`)
endif
@[ -e tools/doc/node_modules/js-yaml/package.json ] || \
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
if [ -x $(NODE) ]; then \
Expand All @@ -327,9 +331,13 @@ out/doc/api/%.json: doc/api/%.md
fi
[ -x $(NODE) ] && $(NODE) $(gen-json) || node $(gen-json)


# check if ./node is actually set, else use user pre-installed binary
gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html --template=doc/template.html $< > $@
out/doc/api/%.html: doc/api/%.md
ifeq ($(call GET_NODE),)
$(error Node.js not found. Build it with `make`)
endif
@[ -e tools/doc/node_modules/js-yaml/package.json ] || \
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
if [ -x $(NODE) ]; then \
Expand Down Expand Up @@ -750,5 +758,5 @@ endif
blog blogclean tar binary release-only bench-http-simple bench-idle \
bench-all bench bench-misc bench-array bench-buffer bench-net \
bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \
test-v8-benchmarks test-v8-all v8 lint-ci bench-ci jslint-ci doc-only \
test-v8-benchmarks test-v8-all v8 lint-ci bench-ci jslint-ci \
$(TARBALL)-headers test-ci test-ci-native test-ci-js build-ci