This is a bit of a hack but I can't think of another way to do it.
Basically when downloading SDKs, we first try the new `.xz` extension.
If that fails, we fall back to the old `.tbz2`. Both these first two
download attempts we run in "silent" mode. If both of them fail we
re-run the original request in non-silent mode so that the error message
will always contain the original `.xz` extension.
See #1235
The first time around `node` was being correctly added to the PATH, but
the second time around this code was observing the emsdk copy of node
in the PATH and assuming it could be skipped.
Fixes: #1240
If the user already has a version of node in their PATH don't clobber
it. This doesn't effect emscripten since the version of node we use
there is controlled via the config file, not via PATH.
Part of fix for #705.
We have an existing `version_key` helper function for sorting versions.
It also does a better job, producing output like:
```
All recent (non-legacy) installable versions are:
3.1.31
3.1.31-asserts
3.1.30
3.1.30-asserts
3.1.29
3.1.29-asserts
```
Rather than:
```
All recent (non-legacy) installable versions are:
3.1.31
3.1.30
3.1.29
3.1.28
3.1.27
```
(with -assert versions listed after 3.1.0)
* Add support for Visual Studio 2022 and migrate to using cmake --build when building on Windows. Leverage the VS2019 MSBuild 'Multi-ToolTask' feature CL_MPCount to saturate project builds properly to 100% CPU usage so building LLVM builds different cpp files in parallel. Clean up some code duplication around Visual Studio support.
* flake
* Work around Linux bot not having 'cmake --build . -j' flag.
Newer versions of emscipten, starting all the way back in 1.39.13, can
automatically locate the `.emscripten` config file that emsdk creates so
there is no need for the explicit EM_CONFIG environment variable. Its
redundant and adds unnessary noisce/complexity.
Really, adding emcc to the PATH is all the is needed these days.
One nice thing about this change is that it allows folks to run
whichever emcc they want to and have it just work, even if they have
configured emsdk. Without this change, if I activate emsdk and I run
`some/other/emcc` then emsdk's `EM_CONFIG` will still be present and
override the configuration embedded in `some/other/emcc`.
e.g. in the same shell, with emsdk activated, I can run both these
commands and have them both just work as expected.
```
$ emcc --version
$ /path/to/my/emcc --version
```
Without this the recommended way to silence emsdk_env was to pipe its
stderr to /dev/null.. but then you also loose potentially useful error
message.
Fixes: #946
* Pass -DENABLE_WERROR=0 when building Binaryen
We are experiencing an issue at our Unity CI with building Binaryen: https://github.com/WebAssembly/binaryen/issues/4588
It seems that for end users, disabling -Werror is a good general measure to enable wider chance of success to build. Emsdk installations are unlikely to be used by Binaryen developers to iterate on Binaryen development, so it is not necessary there?
* Flake
* Enable building LLVM with about-to-be deprecated toolchains for best chance of succeeding with the build.
* Shorten line length
* Adjust to 80 columns
When doing a git clone of a branch, instead of doing a general git clone that first would check out the default (main/master) branch and then later doing a checkout to switch to the target branch, instead specify the `--branch` option to the clone command line to immediately clone and checkout the desired final branch.
This helps first checkout runtime performance on CIs, especially when using shallow clones (GIT_CLONE_SHALLOW option).
Also this sidesteps a really odd git clone issue we are currently seeing in our CI, where it is unable to `checkout` the googletest submodule in binaryen, but would fail saying "path not found".
* Fix native Closure Compiler to work. Reverts my earlier PR #803 which was a great mistake, as it caused Emscripten to silently fall back to Java version of the Closure Compiler. After this PR, Closure Compiler will work on user platforms that do not have Java installed. Also forcibly remove Java version of Closure Compiler on systems where installing the native version succeeds, in order to save on code size.
* Add note to bug
* Improve google-closure-compiler-java uninstall.
* Read Closure version from Emscripten repository
* Skip native google-closure-compiler install when it is not present in the emscripten branch in package.json
* Print error
* Cache git executable search into a variable. This helps reduce noise in the verbose debug logging output messages when EMSDK_VERBOSE=1 is enabled.
* Flake
* Mark cached_git_executable global
Regarding the change to `content_exists`, we only support tools that
are directories full of files, there is no such thing as a tool that
is just a single file and not a directory.