Skip to content

Commit 236491e

Browse files
lanceMyles Borins
authored and
Myles Borins
committed
build: update build-addons when node-gyp changes
Backported from 99bf6fa We can tell when `node-gyp` is changed by creating a prerequisite on `deps/npm/node_modules/node-gyp/package.json`. The prerequisite is added to the `test/addons/.buildstamp` since `build-addons` is .PHONY. Testing for this change was entirely manual. $ make clean test-build # Initial build $ make test-build # Make sure build-addons doesn't rebuild $ touch deps/npm/node_modules/node-gyp/package.json # simulate change $ make test-build # Ensure build-addons rebuilds PR-URL: #6787 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 9a8acad commit 236491e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ ADDONS_BINDING_GYPS := \
138138
$(wildcard test/addons/*/binding.gyp))
139139

140140
# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
141-
test/addons/.buildstamp: $(ADDONS_BINDING_GYPS) test/addons/.docbuildstamp
141+
# Depends on node-gyp package.json so that build-addons is (re)executed when
142+
# node-gyp is updated as part of an npm update.
143+
test/addons/.buildstamp: deps/npm/node_modules/node-gyp/package.json \
144+
$(ADDONS_BINDING_GYPS) test/addons/.docbuildstamp
142145
# Cannot use $(wildcard test/addons/*/) here, it's evaluated before
143146
# embedded addons have been generated from the documentation.
144147
for dirname in test/addons/*/; do \
@@ -154,7 +157,7 @@ test/addons/.buildstamp: $(ADDONS_BINDING_GYPS) test/addons/.docbuildstamp
154157
# if the subprocess touched anything so it pessimistically assumes that
155158
# .buildstamp and .docbuildstamp are out of date and need a rebuild.
156159
# Just goes to show that recursive make really is harmful...
157-
# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
160+
# TODO(bnoordhuis) Force rebuild after gyp update.
158161
build-addons: $(NODE_EXE) test/addons/.buildstamp
159162

160163
test-gc: all test/gc/node_modules/weak/build/Release/weakref.node

0 commit comments

Comments
 (0)