before this change, gcc and g++ are installed using `updateAptAlternatives()`
with the same priority of 40 when they are installed along with
ld and libstdc++ as the dependencies of clang and llvm. but both
gcc and clang are installed using the same priority of 40 on ubuntu,
and the same applies to g++ and clang++. this renders it impossible
to use the default compilers of cc and cxx when clang/llvm is installed
using setup-cpp on an ubuntu host, as gcc is always prefered over
clang by the update-alternatives, as their priorities are identical.
in this change, the "priority" parameter is added to the setupGcc(),
so that we can specify a different priority when installing llvm.
strictly speaking, this is not necessary. as we can just use a higher
priority when calling updateAptAlternatives() in llvm/llvm.ts. but by
making it more explicit, we can ensure that we always prefer llvm over
gcc when installing llvm.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This reduces the main bundle size by ⚠️ 1.28 MB minified! This bundle is loaded only when caching is enabled.
`setup-python` is used in [`setup-cpp`](https://github.com/aminya/setup-cpp) as a library. This optimization reduces the bundle size for that package as well. The build system of `setup-python` uses `ncc`, which doesn't immediately benefit from this change, but setup-cpp uses `Parcel`, which shows this huge improvement.
The reason for this huge reduction is that caching the dependencies uses the `@actions/cache` package, which is an extremely large package with big dependencies. The bundle size before this separation shows this:
![Screenshot_20230907_230625](https://github.com/actions/setup-python/assets/16418197/ec1baf34-85c3-459d-b8cf-894899959b2c)