-
Notifications
You must be signed in to change notification settings - Fork 465
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
Introduce include_dir
for use with gyp in a scalar context
#766
Conversation
Deprecate use of `include` in an gyp array context, which happens to work when paths are absolute, but can fail on Windows when paths are relative and a gyp file contains multiple entries in its `include_dirs` directive. This change corrects documentation and tooling, adds support for relative paths (e.g. those containing whitespace) in a backwards compatible manner and makes the approach holistically consistent with that used by nan.
@lovell, did we just break windows for existing users with 3.0.1 or just not fix it on windows? |
As far as I can tell, the ability to support both filesystem paths containing whitespace and Windows users isn't possible with the |
@lovell understood, thanks for the quick reply. Would it be possible to add some tests to this PR which will test the broken case as well as the ones you were fixing? That way our CI will be able to validate it works across platforms (we have windows, linux etc. in that) My bad for not looking for tests in the first PR as we probably would have caught the issue. @NickNaso we should get some messaging out to tell people not to use 3.0.1 and that a 3.0.2 will be coming soon. I think we should try to get a 3.0.2 out by end of next week which either reverts the breaking change or incorporates this PR if it is ready/landed. |
@NickNaso I also meant to ask if you wanted to send out the messaging via twitter and I think also a message on the README.md (if so let me know when you do and I'll retweet what you send out) or if you'd like somebody else to take a look at doing that? |
I notice there's a Windows CI environment defined in an Appveyor config file, but this isn't run for PRs and doesn't appear to actually work as-is. I attempted to modernise it but there is a compilation failure in the existing tests:
Is there an example of a successful Windows CI config/build/log as I can't quite work out how the tests are currently passing on Windows? UPDATE: Appveyor was defaulting to VS2015. Updating to VS2017 allows the tests to compile - I'll submit a separate PR to re-enable the use of Appveyor testing. |
The regular CI runs are here: https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api-LTS%20versions/ But they use our jenkins infra as opposed to an external service. |
With this as a windows example: https://ci.nodejs.org/job/node-test-node-addon-api-new/nodes=win-vs2019/2465/console, but seems you'd already figured out the issues, and @lovell thanks for looking at fixing up that file in a separate PR. |
* windows-os specific error ("keytar" dependency compiling process) * we lock "keytar/[email protected]" transient dependency for now since recently released "[email protected]" is broken, see nodejs/node-addon-api#766 * TODO revert when "node-addon-api" releases v3.0.2
I had a quick look at how we might be able to reproduce this using the existing tests but haven't spotted an obvious solution yet. Nick, if you have an idea then please go ahead. The underlying cause is a |
Hi everybody, |
@NickNaso just wondering if you've had a chance to take a look at this one? |
@mhdawson sorry for the delay I would complete the work in this weekend. |
@NickNaso thanks. |
Update from @NickNaso through email, -> just back from vacation, working on it. |
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, tests are going to be added through -> #808
Introduce `include_dir` for use with gyp in a scalar context Deprecate use of `include` in an gyp array context, which happens to work when paths are absolute, but can fail on Windows when paths are relative and a gyp file contains multiple entries in its `include_dirs` directive. This change corrects documentation and tooling, adds support for relative paths (e.g. those containing whitespace) in a backwards compatible manner and makes the approach holistically consistent with that used by nan. PR-URL: #766 Reviewed-By: Michael Dawson <[email protected]>
Landed as f27623f |
Thanks for merging, thank you both for your continued maintenance of this module, and with apologies for temporarily breaking things for Windows users. |
Refs: #766 PR-URL: #808 Reviewed-By: Michael Dawson <[email protected]>
Introduce `include_dir` for use with gyp in a scalar context Deprecate use of `include` in an gyp array context, which happens to work when paths are absolute, but can fail on Windows when paths are relative and a gyp file contains multiple entries in its `include_dirs` directive. This change corrects documentation and tooling, adds support for relative paths (e.g. those containing whitespace) in a backwards compatible manner and makes the approach holistically consistent with that used by nan. PR-URL: nodejs#766 Reviewed-By: Michael Dawson <[email protected]>
Refs: nodejs#766 PR-URL: nodejs#808 Reviewed-By: Michael Dawson <[email protected]>
* windows-os specific error ("keytar" dependency compiling process) * we lock "keytar/[email protected]" transient dependency for now since recently released "[email protected]" is broken, see nodejs/node-addon-api#766 * TODO revert when "node-addon-api" releases v3.0.2
Introduce `include_dir` for use with gyp in a scalar context Deprecate use of `include` in an gyp array context, which happens to work when paths are absolute, but can fail on Windows when paths are relative and a gyp file contains multiple entries in its `include_dirs` directive. This change corrects documentation and tooling, adds support for relative paths (e.g. those containing whitespace) in a backwards compatible manner and makes the approach holistically consistent with that used by nan. PR-URL: nodejs/node-addon-api#766 Reviewed-By: Michael Dawson <[email protected]>
Refs: nodejs/node-addon-api#766 PR-URL: nodejs/node-addon-api#808 Reviewed-By: Michael Dawson <[email protected]>
Introduce `include_dir` for use with gyp in a scalar context Deprecate use of `include` in an gyp array context, which happens to work when paths are absolute, but can fail on Windows when paths are relative and a gyp file contains multiple entries in its `include_dirs` directive. This change corrects documentation and tooling, adds support for relative paths (e.g. those containing whitespace) in a backwards compatible manner and makes the approach holistically consistent with that used by nan. PR-URL: nodejs/node-addon-api#766 Reviewed-By: Michael Dawson <[email protected]>
Refs: nodejs/node-addon-api#766 PR-URL: nodejs/node-addon-api#808 Reviewed-By: Michael Dawson <[email protected]>
Introduce `include_dir` for use with gyp in a scalar context Deprecate use of `include` in an gyp array context, which happens to work when paths are absolute, but can fail on Windows when paths are relative and a gyp file contains multiple entries in its `include_dirs` directive. This change corrects documentation and tooling, adds support for relative paths (e.g. those containing whitespace) in a backwards compatible manner and makes the approach holistically consistent with that used by nan. PR-URL: nodejs/node-addon-api#766 Reviewed-By: Michael Dawson <[email protected]>
Refs: nodejs/node-addon-api#766 PR-URL: nodejs/node-addon-api#808 Reviewed-By: Michael Dawson <[email protected]>
Introduce `include_dir` for use with gyp in a scalar context Deprecate use of `include` in an gyp array context, which happens to work when paths are absolute, but can fail on Windows when paths are relative and a gyp file contains multiple entries in its `include_dirs` directive. This change corrects documentation and tooling, adds support for relative paths (e.g. those containing whitespace) in a backwards compatible manner and makes the approach holistically consistent with that used by nan. PR-URL: nodejs/node-addon-api#766 Reviewed-By: Michael Dawson <[email protected]>
Refs: nodejs/node-addon-api#766 PR-URL: nodejs/node-addon-api#808 Reviewed-By: Michael Dawson <[email protected]>
This change reverts PR #757, adds a new
include_dir
scalar property and suggests the deprecation of the ambiguousinclude
string-as-array property.This is required due to the currently-documented approach of using the single
include
path in an array/list context instead of a scalar context with gyp.The use of a gyp list/array context just happens to work when a path is absolute, hence no one spotting this ambiguity before, but shell expansion can fail on Windows when paths are relative and a gyp file contains multiple entries in its
include_dirs
directive.This problem, which only affects v3.0.1 on Windows, will manifest itself as
fatal error C1083: Cannot open include file: 'napi.h': No such file or directory
.This PR provides an overall approach that is more consistent with that used by nan - https://github.com/nodejs/nan#usage
Modules wishing to add support for filesystem paths containing whitespace will need to use this new
include_dir
property in the correct and newly-documented gyp scalar context.