Conversation
|
Hmm, oddly |
… in test_other suite already.
|
This looks good! It will be great to get rid of our java dependency! A couple of comments:
I general I think we should be moving away from on-demand installation, download and compilation if possible. |
The JavaScript version is unfortunately slower - how much slower I haven't actually profiled, but it is likely to be noticeable. So in a video call earlier with Alon the idea was to pursue this kind of dual approach instead.
That would imply that all users prefer the JS version instead of the Java version, although I can certainly place it there.
Agree, I dislike the approach I had to go with here. The only reason for this was that checking in a large node_modules directory was unwieldy. Ideal solution would be a minified+amalgamated |
|
It should definitely be possible to build the entire project to a single minified js file, and I think that's the best thing to check in, parallel to the java binary we have today. Does If we need help with this hopefully there are npm experts reading this already, if not we can cc someone. |
|
@kripken, is there some reason why your prefer to check-in the dependencies into source control? What do you think of the idea of doing I think @mathiasbynens was helping is move away from checked-in JS deps in the past but we didn't yet succeed. Maybe he has some advice here? |
Tried this out, was not able to get anywhere. I think |
|
@sbc100 I think the core issue is that these files almost never change, and they are portable. So it's simpler to just check in a "binary" than to set up a build environment (both on CI and locally; instead, just make the portable binary locally by 1 dev, every few years). cc @dcodeIO (who I see mentioned on the closure compiler page 😄) about building closure compiler js to a single .js file, maybe we are missing something here... |
|
Looks like the platform = getFirstSupportedPlatform(['native', 'java', 'javascript']);Suggesting to remove the old Java one and replace it with the npm package incl. dependencies, building it like and then zipping the contents of the (Didn't test) |
|
Migrating closure to be supplied by emsdk would be fine for me, though that would be something Google people would have to help with, as I cannot upload artifacts to emsdk repository. |
|
Gave this a proper test-run now and it turned out that the native compilers becoming installed depend on the platform installing, so I updated the little build snippet above accordingly. Now forces installation of all the native ones so these exist if the platform building and the platform executing differ. Size of the directory then is 125mb (each native compiler is about 35mb and the Java one is 10mb), all zipped about 45mb. Also gave building a JS-only one a try but then figured that we'd have to ship the externs it uses to describe various web and node APIs in addition to the bundle anyway. Seems that packaging all of this up is a better approach since it reduces the risk of breakage compared to rolling a custom solution. |
|
I don't understand. What does "packing all this up" mean? Wouldn't that be the definition of a custom solution? The standard solution seems to be "npm install", no? I guess I agree with the "packing all this up", I just think that should be done as part of emsdk, not the "git clone" of emscripten. |
|
What I meant there is to ship closure compiler via Emsdk, similar to how node is shipped. What the build snippet above does is to make the |
|
Oh I like that idea. Having a post install step in emsdk that does npm install. I think i'll try that approach. I like the better then zipping up node_modules because node_modules can have arch-specific stuff in to in theory and itsn't designed to be shared between machines (IIUC). |
|
Posted PRs emscripten-core/emsdk#403 and #9986 that migrate Closure to be shipped via emsdk. (or if not using that, one can do a If we decide to go that route, that pair of PRs will obsolete this PR. |
|
Superceded by #9989. |
This adds JS version of Closure compiler for users who don't want to ship Java as part of their SDKs.
First I added google-closure-compiler in the tree directly, but after doing that, I realize that there are many dependencies to the closure compiler npm package and so many files to bundle (490) that would make it a bit awkward to put in the repository.
So I settled for a scheme that if one enables the JS closure compiler, it is
npm installed on demand. I am not sure if there would exist a minified version of closure-cli that we could easily embed, asked for that in google/closure-compiler#3515.