summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-06-06 00:18:55 +0200
committerAnna Henningsen <anna@addaleax.net>2018-06-11 20:09:28 +0200
commitcea10baa221e7ed3c5408d526dcec4fb7a6e99fa (patch)
treea416bb6ba1b1bdcd2a9d463e0409568bb7c44cb6 /Makefile
parentfa2d0a117e0882c5f5d9e0e9b596b8628b6b533f (diff)
downloadandroid-node-v8-cea10baa221e7ed3c5408d526dcec4fb7a6e99fa.tar.gz
android-node-v8-cea10baa221e7ed3c5408d526dcec4fb7a6e99fa.tar.bz2
android-node-v8-cea10baa221e7ed3c5408d526dcec4fb7a6e99fa.zip
build: build addon tests in parallel
Use a JS script to build addons rather than a shell command embedded in the Makefile, because parallelizing is hard in sh and easy in JS. PR-URL: https://github.com/nodejs/node/pull/21155 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 9 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 396708ae75..8bfd4e674a 100644
--- a/Makefile
+++ b/Makefile
@@ -315,25 +315,14 @@ ADDONS_BINDING_SOURCES := \
# Depends on node-gyp package.json so that build-addons is (re)executed when
# node-gyp is updated as part of an npm update.
test/addons/.buildstamp: config.gypi \
- deps/npm/node_modules/node-gyp/package.json \
+ deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \
$(ADDONS_BINDING_GYPS) $(ADDONS_BINDING_SOURCES) \
deps/uv/include/*.h deps/v8/include/*.h \
src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \
test/addons/.docbuildstamp
-# Cannot use $(wildcard test/addons/*/) here, it's evaluated before
-# embedded addons have been generated from the documentation.
-# Ignore folders without binding.gyp
-# (https://github.com/nodejs/node/issues/14843)
- @for dirname in test/addons/*/; do \
- if [ ! -f "$$PWD/$${dirname}binding.gyp" ]; then \
- continue; fi ; \
- printf "\nBuilding addon $$PWD/$$dirname\n" ; \
- env MAKEFLAGS="-j1" $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp \
- --loglevel=$(LOGLEVEL) rebuild \
- --python="$(PYTHON)" \
- --directory="$$PWD/$$dirname" \
- --nodedir="$$PWD" || exit 1 ; \
- done
+ env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \
+ npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \
+ "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" "$$PWD/test/addons"
touch $@
.PHONY: build-addons
@@ -355,25 +344,15 @@ ADDONS_NAPI_BINDING_SOURCES := \
# Implicitly depends on $(NODE_EXE), see the build-addons-napi rule for rationale.
test/addons-napi/.buildstamp: config.gypi \
- deps/npm/node_modules/node-gyp/package.json \
+ deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \
$(ADDONS_NAPI_BINDING_GYPS) $(ADDONS_NAPI_BINDING_SOURCES) \
deps/uv/include/*.h deps/v8/include/*.h \
src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \
src/node_api.h src/node_api_types.h
-# Cannot use $(wildcard test/addons-napi/*/) here, it's evaluated before
-# embedded addons have been generated from the documentation.
-# Ignore folders without binding.gyp
-# (https://github.com/nodejs/node/issues/14843)
- @for dirname in test/addons-napi/*/; do \
- if [ ! -f "$$PWD/$${dirname}binding.gyp" ]; then \
- continue; fi ; \
- printf "\nBuilding addon $$PWD/$$dirname\n" ; \
- env MAKEFLAGS="-j1" $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp \
- --loglevel=$(LOGLEVEL) rebuild \
- --python="$(PYTHON)" \
- --directory="$$PWD/$$dirname" \
- --nodedir="$$PWD" || exit 1 ; \
- done
+ env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \
+ npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \
+ "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" \
+ "$$PWD/test/addons-napi"
touch $@
.PHONY: build-addons-napi