-
Notifications
You must be signed in to change notification settings - Fork 199
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
Support arbitrary node.js runtime versions #40
Comments
@lexor90 Thank you very much for the detailed proposal. This is indeed a feature that has been raised a lot of times, the most recent one being #27 (comment) Assuming local node version as the default does have some advantage though, when it comes to compiling native modules. Since C++ native modules are built in the local environment, the ABI versions should really match what Node.js version is being use at compile time and that is going to be used after compiled. In the future 8.x releases N-API might help mitigate the issue but for Node v6 and v7 it is quite relevant. I really appreciate your work into implementing it. If you need any help please do not hesitate to ask me. I have added this to the 1.x roadmap here: https://github.com/pmq20/node-compiler/blob/master/ROADMAP.md |
@lexor90 I have generated the current patch file at https://github.com/pmq20/node-compiler/blob/master/diff.erb Note though that this diff file will go out of date as we commit new changes. We could write an automated script to generate that file to keep it in sync. Regarding the Moving ahead I think we could remove the |
@pmq20 Thank you for the reply and sorry for the delay. Have had some work to get done. We need to be very carefully at generating diffs, because should we remove the This means we cannot directly produce a patch compating the With that in mind I think we need to develop a resilient way to avoid human error and keep the diff up to date on a per-commit release. Thinking about a git pre-commit hook if it's fine for you. I'm just going to produce an example. I like the idea of the By the way I think we need to state what to do when this implementation will go live: do we want to keep adding new features (and bugfixes) on all node versions supported by this work (porting them backward)? Or we do want to commit new changes only against the current and future ones? what do you think about it @pmq20 ? Because we're facing the "issue" that while this project improves also node.js itself does. Thanks. |
The original implementation I'm testing out makes use of the
Pros:
Cons:
Considerations: We need to generate the Rather than running the testing suite on each commit, we could instead opt to only generate the Also, probably nobody of us will develop The ALTERNATIVE: I also worked to get this done without having to download a clean node version for the But I could verify this is not as consistent as the first solution because This is faster at generating a diff but definitely more error prone as described above. @pmq20 I hope I have been able to be clear about it, btw what do you think about it? What solution does it appeal more to you? Put it like you want, we need to checkout the same version, free from any edit, and compare it against the changes. Then we can try to apply the patch to the LTS or to the v7.x (i'd skip prev versions) and run tests. The more we want to cover, the more work it has to be done to verify the patch applies without issues. |
@lexor90 Thanks for the feedback. After reading your comment, I am beginning to hate the idea of using a single unified diff with a lot of I just reviewed the upstream active branches ( https://github.com/nodejs/node/branches/active ) and listed the Node.js versions that are currently maintained:
Therefore, I think a good way to move forward is to keep exactly 4 diff files, and only test against the latest release of each release line, i.e. (for the moment)
For older versions in each release line, we generate a warning at compile time to warn the user that it is not guaranteed to work but the compiler will try its best (at the user's own risk), and recommend upgrading to the latest version of that particular release line (e.g. from v6.10.0 to v6.11.0). For the ease of our development, I'll create 4 separate branches, where
|
@lexor90 After reading your second comment, I feel it's becoming overwhelmingly complicated and seems we should simplify our original goal a little bit. I think we need to ask ourselves the following 2 questions,
I observed that (based on the active branch list of my last comment), even the upstream Node.js team does not have that kind of granularity of back-supporting that many versions. They seem to be only supporting one major version and forgot about minor versions. If our answer to the above questions is "no" and we are only ready to support the latest release of each line, then the problem could be greatly simplified. None of source-downloading, patch-generating, diff-applying are needed. We just need to keep more
Then add a @lexor90 Do you think we could make that simplification? |
Maybe we should follow nodejs lts https://github.com/nodejs/lts |
@fengmk2 Good point. I think we should drop 7 according to this. Just Argon, Boron and Carbon 🎉 ..., yet we have to be prepared for node 9 though, which will come into being on October this year. |
I've applied the current nodec patch to each release line, let's watch how CI goes for them,
Note that, Moving forward my thinking is that we still do development mainly on the |
Ehy there, I don't know how should we evaluate your purpose to pick only the latest minor/patch release for each release line (e.g. v6.x, v7.x, etc). Theoretically it should be safe for small developers, because it also enforces to pick the latest release for each major version (which is good because you get all the optimizations and security patches), but I'm not sure about big projects/corporate. By the way this can be a safe compromise, since I don't expect any "major" change between node v6.11.0 and 6.10.0 in their source code (maybe some refactoring, some patch, or some function more, but not something completely different). We need to test it out but I definitely think we might have good chances of having a patch that's applying on v6.11.0 to apply properly also on previous versions in the v6 line. The LTS is fine, but some companies do prefer to use the latest version to start a new project so we cannot just sit on the LTS IMO (as newer versions also come with newer npm and v8 features, which is what most users want). I guess that having support for the active releases is fine. Don't know how much code has changed in node since v4, but should it be too much different we can safely skip it I think. Nobody rather than legacy applications should be using it, and I doubt anybody will pick a legacy app and compile it right now. |
@pmq20 well, if we put all node versions in our repo we fix the networking issue at runtime, but I don't think I'd put it inside our repo. Because then we have to update and maintain 4 different node source code. I made some thoughts about the networking issue: almost any node project uses npm packages (yarn/npm, no matter) but CI servers for a node project hardly can be offline. I'd work on the latest version, check manually (the first time) that the patch applies to previous versions, and try to run tests manually (we still need to discover what's the minimum test suite to run to cover our changes) and if everything goes fine, we can automatize the process on our CI. The specific node version can be downloaded on compilation time, this way we can always pick the latest one for each major version and we don't have to think about updating this repo for each new node release (it might be distracting from other things we need to get done). |
@pmq20 I'm going to create a branch to make this changes, so that you'll be able to test them out:
So we have a starting point to work on. @pmq20 can you check here what should we test in your opinion? This way the n.6 will be efficient. I've skipped the test part after for the n.3 (to test the patch extracted applies to the same node version) because it would be duplicated work, since we already have a CI that verifies our commits do not break anything. |
@lexor90 Interesting. I like the idea on minimizing our amount of work on maintenance. The current way of having so many node sources in one repo does not seem last for a long period of time since it requires too much maintenance. I agree with you on the idea of downloading source and applying patches. However we are also faced with the issue of difference between numerous Node.js versions. I think we could try applying those patches dynamically at compile time by the Ruby scripts. That way we can cater to specific needs of particular Node.js versions by writing some Overall I like your original idea of dynamically downloading source and dynamically applying patches, rather than statically maintaining source code in our repo which gives us too much burden. I'll implement it tomorrow. If you have time you could try it as well, feel free to delete my code :) |
@lexor90 Wow just saw your third comment after replying my previous one 😄 It offers a better idea than mine. Generating the patch dynamically at runtime sounds very cool, that further minimizes our burden by eliminating the work of maintaining the patch itself. My previous idea of applying patch via Ruby script also have another problem of not being idempotent and requires a hell lot of code to write. So I'll drop it and prefer your idea. I think running tests should be made optional with another option like Also in order to reduce the time spent on the first run we could deliver the source code like we previously did. That way only one new download is needed. Please implement it as the way you see fit and I'll delete the |
Eager for this capability to land! 👍 |
Hello there, just an update. I'm working on this right now, as soon as I get it to work I'll push so you can test it out. I'm going a bit slower than I wanted these days since I have some work to get done. |
Hello,
as discussed already in other issues I think nodec should be able to compile using a user defined node version among whose supported by the applied patches.
I didn't have any chance to test the patches with the v6.x, v7.x and v8.x but since those were versions supported by nodec itself I guess we should have some sort of support for them (by the way I'd really like to add some tests against regressions).
Patches have evolved while also upgrading the supported node version, so I think we should still be able to verify the patches apply properly and that node.js retains its functionalities after those patches are applied.
My purpose is to:
--node-version=7.0.0
flag to the nodec binary (or--runtime
, but I thinknode-version
is more user-friendly) and keep the latest nodejs version (or maybe the LTS) as the defaultdiff
or some ruby gem)I'd really like to avoid what other similar tools do that is to download the detected (current-system) node version: it's ugly, annoying for nvm users, error prone and furthermore in a CI/CD environment one may need to skip this (and using nvm to workaround this might get complicated as nvm is hard to be used in some shell scripts). Also I don't think there's really some logical reason one should assume that I want my local node version on my servers.
I already started to work and implemented the flag and the download part, but I'm not sure how would you like to distribute the patch: do you want to place a
.patch
file inside this repo?I'd avoid to keep the expanded source code under
node/
because it could lead to unwanted patching (e.g. files modified from one version to another would be modified, and we would need to declare what files to pick explicitly, which may still get unwanted modifications.I'd like to know your thoughts about it @pmq20
Thank you.
The text was updated successfully, but these errors were encountered: