-
Notifications
You must be signed in to change notification settings - Fork 764
Add npm install step as post-build to Emscripten #404
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
Conversation
|
Is this for all normal emsdk usage ( |
|
This is for all targets. Whenever emscripten is pulled down, the post-build install builds optimizer and then does this npm install. |
|
Ah, that worries me, then. But I see this discussion is spread over many issues and PRs - where is the best place to get an overview of your total plan here, and to discuss it more in detail? |
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.
In general this is the direction am hoping that we can move in.
We do need to support the new "fat-packages" produced the emscripten-releases (e.g. sdk, latest, upstream, etc) build as well though. In that case emscripten is in a sub-directory of the tool since its all just once big tool (I'm actually kind of sad we lost granularity thee but that's a separate issue).
To summarize:
|
|
Thanks for the writeup @juj! I have some worries about using
|
|
I'll try to respond to your points in order:
|
|
I think the big practical point here is not about if closure uses native vs java vs js, and it is not about whether we distribute via npm or emsdk, or if we are unconventional users of npm, but it is the fact that bundling these kind of tools in the Emscripten tree is extremely costly. This is because (Currently git clone .git subdirectory of Emscripten is 296MB, whereas working tree is 138MB, so we are at a history:working tree ratio of about 2:1 at the moment. Each tool version accumulates that directly) The only in-tree solution to that would be to use git-lfs, but these are not large files, but many files, so git-lfs would only work if we zipped up closure in the tree and used git-lfs. But that is super clumsy as well, and whenever you checked out a different emscripten git hash, you'd need to run a custom post checkout unzip command. Hence I agree we should remove these tools from in-tree and move them to be downloaded via other means. At first I though it would be best to use emsdk hosting for that to keep the CDN dependency light, but after refactoring to use npm, I think that is more convenient for this, since their CDN is likely more stable, it is less work for us, not all Emscripten users like to use emsdk, and updating closure/html-minifier versions becomes super-easy (just edit depedencies.json and change the version number). I do think the npm install route is the best approach that we could take here. |
|
I'm not strongly opposed to npm. I do think this adds some risk in maintenance for emscripten developers, as we'll need to figure out npm issues for people that use the emsdk. But if people are in favor of this then let's consider it. Talking with @sbc100 and @jgravelle-google offline, I think a good next step here might be to post to the mailing list. We should get wide feedback before such a change. In particular we should be sure to consider the docker image use cases etc. cc @trzecieu One thing @jgravelle-google mentioned is that we should make sure we pin versions of all the things we use, and their dependencies as well. If we use X and it uses Y of version >= N, then we don't want npm to fetch newer versions at some point in time. (I don't know enough about npm to know if that's the default or not.) |
|
@juj how would you feel about delaying this change until we have disussed it on the mailing list and perhaps running a experiment? In the mean time maybe you should land the JS clusure compiler change by checking in direclyt into |
Yeah, considered the same. The PRs emscripten-core/emscripten#9989 and emscripten-core/emscripten#9990 are both authored in that form. It also changes websockets to be pinned in version, at this line: https://github.com/emscripten-core/emscripten/pull/9989/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R4 The way pinning works is that the version number in package.json is specified without a |
I'd rather not add a temp closure compiler copy in the repo, as I mentioned before, it is quite large at ~400 files and 57 MB (uncompressed), and it would bloat up the git repo needlessly. Testing out git commiting closure in the repository grows the .git subdirectory from 296MB to 323MB (+9.12% overall repository size). I'd rather not add a short-term temp solution commit that increased repo size that much.
Sure, go ahead. |
This should not be a problem, as npm will be executed on image build phase. This might add some extra weight to the image itself ans Once you have a test branch I'm happy to test solution and provide some data. |
Or hmm actually, the 296MB included my own fork and a couple of other people's forks. A clean git clone of emscripten-core/emscripten.git is 213MB, so 213MB -> 240MB = +12.7% size increase. |
I don't understand, I just did All of that looks like the jar file really: I must be missing something? |
|
Yeah, the target is |
|
Bit looks like its only 56Mb: And if you remove the native linux binary its only 23: So maybe it would be OK with checkin in the interim? Or you can just wait too if you prefer. |
54fc96f to
c9c4495
Compare
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.
We might want run with --production to avoid install any dev dependencies (currently just ws) on all users machines.. but its not huge deal.
The major blocker for this PR now is that I think it doesn't work for the "bundled" sdk such as "emsdk install latest". Here would probably need a separate function that does a similiar thing but in the "emscripten" subdirectory of a bundles SDK.
dd0d012 to
64213b1
Compare
|
Addressed review, tests pass now. |
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.
OK, I think we should land this and see what kind bug reports we get back.
Right now are landing this without actually depending on it yet. I propose that we don't actually start depending on the result of the npm install until we've got some feedback/results.
@kripken are you ok with this plan?
| node_path = os.path.join(node_tool.installation_path(), 'bin') | ||
| npm = os.path.join(node_path, 'npm' + ('.cmd' if WINDOWS else '')) | ||
| env = os.environ.copy() | ||
| env["PATH"] = node_path + os.pathsep + env["PATH"] |
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.
Just out of interest, why is this needed?
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.
Npm needs Node.js in PATH on Linux (on macOS and Windows it worked without).
|
Not sure I understand the plan - if we don't depend on it, how will we get bug reports? Maybe I don't understand which users you mean here - just us devs? Do you think the mailing list discussion is concluded? It didn't seem done last I read it. But I see no harm in landing something that we don't depend on and is optional (but again, if it's optional I don't see where bug reports will come from). |
|
Well What I mean by not depend on it, is that we can easily back it out, since we are not going to hold off on landing any emscripten-side change that depend on it (for some initial trial period). If we get reports of failure we can simpy disable this again. |
|
I see, thanks, lgtm then. For landing this, maybe let's wait until after the holidays, to avoid breakage when we are not available? That will also give more time for the mailing list discussion. |
|
lgtm |
|
Ping @kripken on this, it has now been quite a while since the conversation on mailing list. What do you think? |
|
Yeah, I think we've waited enough for that discussion, so if you and @sbc100 have the time to land this and handle any fallout, lgtm. |
…net/node dotnet/cpython (emscripten-core#404) * Update dependencies from https://github.com/dotnet/emscripten build 20230807.1 Microsoft.NETCore.Runtime.Wasm.Emscripten.Transport From Version 8.0.0-preview.4.23381.1 -> To Version 8.0.0-preview.4.23407.1 * Update dependencies from https://github.com/dotnet/binaryen build 20230807.1 runtime.linux-arm64.Microsoft.NETCore.Runtime.Wasm.Binaryen.Transport , runtime.linux-x64.Microsoft.NETCore.Runtime.Wasm.Binaryen.Transport , runtime.osx-arm64.Microsoft.NETCore.Runtime.Wasm.Binaryen.Transport , runtime.osx-x64.Microsoft.NETCore.Runtime.Wasm.Binaryen.Transport , runtime.win-arm64.Microsoft.NETCore.Runtime.Wasm.Binaryen.Transport , runtime.win-x64.Microsoft.NETCore.Runtime.Wasm.Binaryen.Transport From Version 8.0.0-preview.4.23381.1 -> To Version 8.0.0-preview.4.23407.1 * Update dependencies from https://github.com/dotnet/node build 20230807.1 runtime.linux-arm64.Microsoft.NETCore.Runtime.Wasm.Node.Transport , runtime.linux-x64.Microsoft.NETCore.Runtime.Wasm.Node.Transport , runtime.osx-arm64.Microsoft.NETCore.Runtime.Wasm.Node.Transport , runtime.osx-x64.Microsoft.NETCore.Runtime.Wasm.Node.Transport , runtime.win-arm64.Microsoft.NETCore.Runtime.Wasm.Node.Transport , runtime.win-x64.Microsoft.NETCore.Runtime.Wasm.Node.Transport From Version 8.0.0-preview.4.23381.1 -> To Version 8.0.0-preview.4.23407.1 * Update dependencies from https://github.com/dotnet/cpython build 20230809.1 runtime.osx-arm64.Microsoft.NETCore.Runtime.Wasm.Python.Transport , runtime.osx-x64.Microsoft.NETCore.Runtime.Wasm.Python.Transport , runtime.win-arm64.Microsoft.NETCore.Runtime.Wasm.Python.Transport , runtime.win-x64.Microsoft.NETCore.Runtime.Wasm.Python.Transport From Version 8.0.0-preview.4.23374.1 -> To Version 8.0.0-preview.4.23409.1 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

Automatically run
npm installin Emscripten root directory after installing an Emscripten tool.