tools: allow single JS file for --link-module#28443
Closed
danbev wants to merge 3 commits intonodejs:masterfrom
Closed
tools: allow single JS file for --link-module#28443danbev wants to merge 3 commits intonodejs:masterfrom
danbev wants to merge 3 commits intonodejs:masterfrom
Conversation
Collaborator
lpinca
approved these changes
Jun 27, 2019
Member
|
Before this change, what input to |
refack
previously requested changes
Jun 28, 2019
Contributor
refack
left a comment
There was a problem hiding this comment.
Should not land without a test.
Contributor
anything with at least 1 |
Contributor
Author
I'll take a look at adding a test for this, might not be until next week though. Thanks |
Collaborator
Member
|
@refack Test was added. OK to dismiss your request for changes? |
Trott
approved these changes
Jul 19, 2019
Collaborator
refack
reviewed
Jul 22, 2019
tools/js2c.py
Outdated
Contributor
There was a problem hiding this comment.
No as critical, but should be
Suggested change
| if split != []: | |
| if len(split): |
as it's more "pythonic", and doesn't assume split is a list, only that it's enumerable.
Contributor
Author
|
I’m currently on PTO and will be back in August and I’m happy to address
this then. Thanks.
tis 23 juli 2019 kl. 04:41 skrev Refael Ackermann (רפאל פלחי) <
notifications@github.com>:
… ***@***.**** commented on this pull request.
------------------------------
In tools/js2c.py
<#28443 (comment)>:
> @@ -261,7 +261,8 @@ def NormalizeFileName(filename):
split = ['internal'] + split
else: # `lib/**/*.js` so drop the 'lib' part
split = split[1:]
- filename = '/'.join(split)
+ if split != []:
No as critical, but should be
⬇️ Suggested change
- if split != []:
+ if len(split):
as it's more "pythonic", and doesn't assume split is a list, only that
it's enumerable.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#28443?email_source=notifications&email_token=AADJRX73YINRA5ODGBOKW53QAX5M5A5CNFSM4H3X3532YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7FVFKY#pullrequestreview-264983211>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADJRX4FRUZ6YYGFBOUQE6TQAX5M5ANCNFSM4H3X353Q>
.
|
The description for the --link-module configuration option is as
follows:
$ ./configure --help | grep -A 5 'link-module'
--link-module=LINKED_MODULE
Path to a JS file to be bundled in the binary as a
builtin. This module will be referenced by path
without extension; e.g. /root/x/y.js will be
referenced via require('root/x/y'). Can be used
multiple times
This lead me to think that it was possible to specify a file like this:
$ ./configure --link-module=something.js
$ NODE_DEBUG=mkcodecache make -j8
This will lead to a compilation error as an entry in the source_ map in
node_javascript.cc will end up having an empty string as its key:
source_.emplace("", UnionBytes{_raw, 105});
This will then be used by CodeCacheBuilder when it iterates over the
module ids, which will lead to the following compilation errors:
/node/out/Release/obj/gen/node_code_cache.cc:12:23: warning:
ISO C++17 does not allow a decomposition group to be
empty [-Wempty-decomposition]
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: warning:
decomposition declarations are a C++17 extension [-Wc++17-extensions]
static const uint8_t [] = {
^~
/node/out/Release/obj/gen/node_code_cache.cc:12:1: error:
decomposition declaration cannot be declared 'static'
static const uint8_t [] = {
^~~~~~
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
decomposition declaration cannot be declared with type 'const uint8_t'
(aka 'const unsigned char'); declared type must be 'auto' or
reference to 'auto'
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
excess elements in scalar initializer
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:660:7: error:
expected expression
,
^
/node/out/Release/obj/gen/node_code_cache.cc:661:24: error:
no matching function for call to 'arraysize'
static_cast<int>(arraysize()), policy
^~~~~~~~~
../src/util.h:667:18: note: candidate function template not viable:
requires 1 argument, but 0 were provided
constexpr size_t arraysize(const T (&)[N]) {
^
2 warnings and 5 errors generated.
This commit suggests that passing a single file be allowed by modifying
tools/js2c.py, or alternatively raise an Exception with an message that
indicates the cause of this.
d31f2e7 to
a656ed3
Compare
Collaborator
Contributor
Author
|
Landed in b4f0a18. |
pull bot
pushed a commit
to SimenB/node
that referenced
this pull request
Aug 12, 2019
The description for the --link-module configuration option is as
follows:
$ ./configure --help | grep -A 5 'link-module'
--link-module=LINKED_MODULE
Path to a JS file to be bundled in the binary as a
builtin. This module will be referenced by path
without extension; e.g. /root/x/y.js will be
referenced via require('root/x/y'). Can be used
multiple times
This lead me to think that it was possible to specify a file like this:
$ ./configure --link-module=something.js
$ NODE_DEBUG=mkcodecache make -j8
This will lead to a compilation error as an entry in the source_ map in
node_javascript.cc will end up having an empty string as its key:
source_.emplace("", UnionBytes{_raw, 105});
This will then be used by CodeCacheBuilder when it iterates over the
module ids, which will lead to the following compilation errors:
/node/out/Release/obj/gen/node_code_cache.cc:12:23: warning:
ISO C++17 does not allow a decomposition group to be
empty [-Wempty-decomposition]
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: warning:
decomposition declarations are a C++17 extension [-Wc++17-extensions]
static const uint8_t [] = {
^~
/node/out/Release/obj/gen/node_code_cache.cc:12:1: error:
decomposition declaration cannot be declared 'static'
static const uint8_t [] = {
^~~~~~
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
decomposition declaration cannot be declared with type 'const uint8_t'
(aka 'const unsigned char'); declared type must be 'auto' or
reference to 'auto'
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
excess elements in scalar initializer
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:660:7: error:
expected expression
,
^
/node/out/Release/obj/gen/node_code_cache.cc:661:24: error:
no matching function for call to 'arraysize'
static_cast<int>(arraysize()), policy
^~~~~~~~~
../src/util.h:667:18: note: candidate function template not viable:
requires 1 argument, but 0 were provided
constexpr size_t arraysize(const T (&)[N]) {
^
2 warnings and 5 errors generated.
This commit suggests that passing a single file be allowed by modifying
tools/js2c.py.
PR-URL: nodejs#28443
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos
pushed a commit
that referenced
this pull request
Aug 19, 2019
The description for the --link-module configuration option is as
follows:
$ ./configure --help | grep -A 5 'link-module'
--link-module=LINKED_MODULE
Path to a JS file to be bundled in the binary as a
builtin. This module will be referenced by path
without extension; e.g. /root/x/y.js will be
referenced via require('root/x/y'). Can be used
multiple times
This lead me to think that it was possible to specify a file like this:
$ ./configure --link-module=something.js
$ NODE_DEBUG=mkcodecache make -j8
This will lead to a compilation error as an entry in the source_ map in
node_javascript.cc will end up having an empty string as its key:
source_.emplace("", UnionBytes{_raw, 105});
This will then be used by CodeCacheBuilder when it iterates over the
module ids, which will lead to the following compilation errors:
/node/out/Release/obj/gen/node_code_cache.cc:12:23: warning:
ISO C++17 does not allow a decomposition group to be
empty [-Wempty-decomposition]
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: warning:
decomposition declarations are a C++17 extension [-Wc++17-extensions]
static const uint8_t [] = {
^~
/node/out/Release/obj/gen/node_code_cache.cc:12:1: error:
decomposition declaration cannot be declared 'static'
static const uint8_t [] = {
^~~~~~
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
decomposition declaration cannot be declared with type 'const uint8_t'
(aka 'const unsigned char'); declared type must be 'auto' or
reference to 'auto'
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
excess elements in scalar initializer
static const uint8_t [] = {
^
/node/out/Release/obj/gen/node_code_cache.cc:660:7: error:
expected expression
,
^
/node/out/Release/obj/gen/node_code_cache.cc:661:24: error:
no matching function for call to 'arraysize'
static_cast<int>(arraysize()), policy
^~~~~~~~~
../src/util.h:667:18: note: candidate function template not viable:
requires 1 argument, but 0 were provided
constexpr size_t arraysize(const T (&)[N]) {
^
2 warnings and 5 errors generated.
This commit suggests that passing a single file be allowed by modifying
tools/js2c.py.
PR-URL: #28443
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This was referenced Aug 20, 2019
This was referenced Aug 20, 2019
codebytere
added a commit
to electron/electron
that referenced
this pull request
Aug 21, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The description for the
--link-moduleconfiguration option is asfollows:
This lead me to think that it was possible to specify a file like this:
This will lead to a compilation error as an entry in the source_ map in
node_javascript.cc will end up having an empty string as its key:
This will then be used by CodeCacheBuilder when it iterates over the
module ids, which will lead to the following compilation errors:
This commit suggests that passing a single file be allowed by modifying
tools/js2c.py, or alternatively raise an Exception with an message that
indicates the cause of this.
With the changes in this PR the usage would look like this:
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes