-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
chore(common): Allow to build offline #12439
base: master
Are you sure you want to change the base?
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
de980f4
to
c12f788
Compare
A lot of the `configure` actions rely on node dependencies and so call `npm install`. Without a internet connection this hangs forever, even if you had successfully installed the dependencies before and nothing changed since then. This change adds a `--offline` parameter that passes `--prefer-offline` to npm, which causes npm to use the cached dependencies. Also sets the `MESON_PACKAGE_CACHE_DIR` environment variable so that all (sub-)projects share the same package cache dir. This will speed up regular builds a bit (e.g. `developer/src/kmcmplib` and `core` both have `icu4c` as a dependency), but will also help with offline builds. `MESON_PACKAGE_CACHE_DIR` requires Meson 1.3, however older Meson versions ignore this environment variable and simply continue to use a cache per subproject, so will continue to work (minus offline builds).
c12f788
to
389fb4f
Compare
builder_echo "Trying offline build" | ||
offline_param=--prefer-offline | ||
fi | ||
try_multiple_times npm ${offline_param} ci |
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 could consider to always pass --prefer-offline
which would probably help if nodejs.org has an outage, but I don't know if that has unwanted side-effects.
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.
I don't know if that's a good idea for build agents?
|
||
# Set shared Meson package cache (works with Meson >= 1.3) | ||
if [[ -z ${MESON_PACKAGE_CACHE_DIR:-} ]]; then | ||
export MESON_PACKAGE_CACHE_DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/keyman/builder" |
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.
Is ~/.cache
a safe path? We have already a ~/.keyman path used for nvm (see
Line 33 in aa50672
### Caveats on macOS/Linux |
A lot of the
configure
actions rely on node dependencies and so callnpm install
. Without a internet connection this hangs forever, even if you had successfully installed the dependencies before and nothing changed since then. This change adds a--offline
parameter that passes--prefer-offline
to npm, which causes npm to use the cached dependencies.Also sets the
MESON_PACKAGE_CACHE_DIR
environment variable so that all (sub-)projects share the same package cache dir. This will speed up regular builds a bit (e.g.developer/src/kmcmplib
andcore
both haveicu4c
as a dependency), but will also help with offline builds.MESON_PACKAGE_CACHE_DIR
requires Meson 1.3, however older Meson versions ignore this environment variable and simply continue to use a cache per subproject, so will continue to work (minus offline builds).@keymanapp-test-bot skip