Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
build: expose napi_build_version variable to native addons#27835
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
NickNaso commented May 23, 2019 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
lpinca left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
lpinca commented May 23, 2019 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@NickNaso can you please remove "build:" and capitalize "ensure" in commit message body? |
Expose `napi_build_version` to allow `node-gyp` to make it available for addons. Fixes: nodejs/node-gyp#1745 Refs: nodejs/abi-stable-node#371
mhdawson commented May 23, 2019
@NickNaso is there any way to have this be generated from where the value is defined? Just worried about keeping the 2 in sync. I wonder if something the in the makefiles/build steps could update it? MIght be a bad idea if we don't modify the build files already but thought I'd ask to see if anybody else has any suggestions/comments as well. |
NickNaso commented May 23, 2019
@mhdawson I will investigate later or tomorrow what you suggested because it's a more robust solution. If anyone want help all feedback are welcome. |
bnoordhuis commented May 23, 2019
configure.py could write it to config.gypi, that's also picked up by node-gyp. Another benefit: it'll show up in There's precedence, see |
mhdawson commented May 24, 2019
@bnoordhuis thanks for the great pointers. |
addaleax commented Jun 2, 2019
A test with |
NickNaso commented Jun 3, 2019
Thanks all for suggestions I will update the PR very soon. |
legendecas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a definition of NAPI_VERSION in node_version.h. Should it be derived from the one in js_native_api.h too?
NickNaso commented Jun 4, 2019
@legendecas |
nodejs-github-bot commented Jun 4, 2019
legendecas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering the difference of NAPI_VERSION between node_version.h and js_native_api.h. Should they both be updated on version bumping?
NickNaso commented Jun 4, 2019
@legendecas I think that we need to update both version in |
NickNaso commented Jun 7, 2019 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I executed the tests and it seems to work, but I don't know if it could be the right solution. @nodejs/n-api |
mhdawson commented Jun 7, 2019
The two definitions of N-API version are actually a bit different. The one in node_version.h is the version which the Node binary being built supports. The one in js_native_api_version.h controls which version will be used by default when compiling a native addon. For example, if all LTS versions support N-API 4, but the latest support N-API 5 we still may want to have the default be N-API 4 be the default so that the addon can compile across all of the LTS versions. If the addon developer specifically wants to use functions in N-API 5 they can do that by setting NAPI_VERSION to 5 knowing that they have specifically depended on that version. Might have been better if we had named them differently as I can't remember if there was any reason they needed to be the same. My thought is that having them be separate is useful but that we should have more comments to explain what I've just said in the code. |
jschlight commented Jun 10, 2019 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
If I understand correctly, the For example,
Edit: Reviewing the documentation linked above, it looks like for |
Uh oh!
There was an error while loading. Please reload this page.
gabrielschulhof commented Jun 13, 2019
@mhdawson #include"node_version.h"#include"js_native_api.h" |
gabrielschulhof commented Jun 13, 2019
@mhdawson that's probably why they have the same name. |
mhdawson left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
nodejs-github-bot commented Jun 17, 2019
mhdawson commented Jun 17, 2019
mhdawson commented Jun 17, 2019
bnoordhuis left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % style nit. Thanks for doing this!
edit: the CI failures are all infrastructural, by the way.
Uh oh!
There was an error while loading. Please reload this page.
NickNaso commented Jul 1, 2019
Hi everybody is there a chance to merge this PR? |
nodejs-github-bot commented Jul 1, 2019
gabrielschulhof commented Jul 2, 2019
Landed in 9868126. |
Expose `napi_build_version` to allow `node-gyp` to make it available for building native addons. Fixes: nodejs/node-gyp#1745 Refs: nodejs/abi-stable-node#371 PR-URL: nodejs#27835 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Expose `napi_build_version` to allow `node-gyp` to make it available for building native addons. Fixes: nodejs/node-gyp#1745 Refs: nodejs/abi-stable-node#371 PR-URL: #27835 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Expose `napi_build_version` to allow `node-gyp` to make it available for building native addons. Fixes: nodejs/node-gyp#1745 Refs: nodejs/abi-stable-node#371 PR-URL: #27835 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Expose `napi_build_version` to allow `node-gyp` to make it available for building native addons. Fixes: nodejs/node-gyp#1745 Refs: nodejs/abi-stable-node#371 PR-URL: nodejs#27835 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Expose `napi_build_version` to allow `node-gyp` to make it available for building native addons. Fixes: nodejs/node-gyp#1745 Refs: nodejs/abi-stable-node#371 PR-URL: #27835 Backport-PR-URL: #35266 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Expose
napi_build_versionto allownode-gypto make itavailable for addons.
Fixes: nodejs/node-gyp#1745
Refs: nodejs/abi-stable-node#371
make -j4 test(UNIX), orvcbuild test(Windows) passes