-
-
Notifications
You must be signed in to change notification settings - Fork 111
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 build agents to automatically select emsdk version, and enable support for 3.1.60+ 🍒 🏠 #12245
Merged
mcdurdin
merged 3 commits into
stable-17.0
from
chore/developer/cherry-pick/emscripten-3.1.60-patch
Aug 22, 2024
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,73 @@ | ||
# shellcheck shell=bash | ||
# no hashbang for .inc.sh | ||
|
||
KEYMAN_MIN_VERSION_EMSCRIPTEN=3.1.58 | ||
|
||
# | ||
# We don't want to rely on emcc.py being on the path, because Emscripten puts far | ||
# We don't want to rely on emcc being on the path, because Emscripten puts far | ||
# too many things onto the path (in particular for us, node). | ||
# | ||
# The following comment suggests that we don't need emcc.py on the path. | ||
# The following comment suggests that we don't need emcc on the path. | ||
# https://github.com/emscripten-core/emscripten/issues/4848#issuecomment-1097357775 | ||
# | ||
# So we try and locate emcc.py in common locations ourselves. The search pattern | ||
# So we try and locate in common locations ourselves. The search pattern | ||
# is: | ||
# | ||
# 1. Look for $EMSCRIPTEN_BASE (our primary emscripten variable), which should | ||
# point to the folder that emcc.py is located in | ||
# 2. Look for $EMCC which should point to the emcc.py executable | ||
# 3. Look for emcc.py on the path | ||
# point to the folder that emcc is located in | ||
# 2. Look for $EMCC which should point to the emcc executable | ||
# 3. Look for emcc on the path | ||
# | ||
locate_emscripten() { | ||
local EMCC_EXECUTABLE | ||
if [[ "${BUILDER_OS}" == "win" ]]; then | ||
EMCC_EXECUTABLE="emcc.py" | ||
else | ||
EMCC_EXECUTABLE="emcc" | ||
fi | ||
if [[ -z ${EMSCRIPTEN_BASE+x} ]]; then | ||
if [[ -z ${EMCC+x} ]]; then | ||
local EMCC=`which emcc.py` | ||
[[ -z $EMCC ]] && builder_die "locate_emscripten: Could not locate emscripten (emcc.py) on the path or with \$EMCC or \$EMSCRIPTEN_BASE" | ||
local EMCC=`which ${EMCC_EXECUTABLE}` | ||
[[ -z $EMCC ]] && builder_die "locate_emscripten: Could not locate emscripten (emcc) on the path or with \$EMCC or \$EMSCRIPTEN_BASE" | ||
fi | ||
[[ -f $EMCC && ! -x $EMCC ]] && builder_die "locate_emscripten: Variable EMCC ($EMCC) points to emcc.py but it is not executable" | ||
[[ -x $EMCC ]] || builder_die "locate_emscripten: Variable EMCC ($EMCC) does not point to a valid executable emcc.py" | ||
[[ -f $EMCC && ! -x $EMCC ]] && builder_die "locate_emscripten: Variable EMCC ($EMCC) points to emcc but it is not executable" | ||
[[ -x $EMCC ]] || builder_die "locate_emscripten: Variable EMCC ($EMCC) does not point to a valid executable emcc" | ||
EMSCRIPTEN_BASE="$(dirname "$EMCC")" | ||
fi | ||
[[ -f ${EMSCRIPTEN_BASE}/emcc.py && ! -x ${EMSCRIPTEN_BASE}/emcc.py ]] && builder_die "locate_emscripten: Variable EMSCRIPTEN_BASE ($EMSCRIPTEN_BASE) contains emcc.py but it is not executable" | ||
[[ -x ${EMSCRIPTEN_BASE}/emcc.py ]] || builder_die "locate_emscripten: Variable EMSCRIPTEN_BASE ($EMSCRIPTEN_BASE) does not point to emcc.py's folder" | ||
[[ -f ${EMSCRIPTEN_BASE}/${EMCC_EXECUTABLE} && ! -x ${EMSCRIPTEN_BASE}/${EMCC_EXECUTABLE} ]] && builder_die "locate_emscripten: Variable EMSCRIPTEN_BASE ($EMSCRIPTEN_BASE) contains ${EMCC_EXECUTABLE} but it is not executable" | ||
[[ -x ${EMSCRIPTEN_BASE}/${EMCC_EXECUTABLE} ]] || builder_die "locate_emscripten: Variable EMSCRIPTEN_BASE ($EMSCRIPTEN_BASE) does not point to ${EMCC_EXECUTABLE}'s folder" | ||
|
||
verify_emscripten_version | ||
} | ||
|
||
# Ensure that we use correct version of emsdk on build agents. | ||
# For developers, define KEYMAN_USE_SDK to do this on your | ||
# build machine. | ||
verify_emscripten_version() { | ||
if [[ "$VERSION_ENVIRONMENT" != local || ! -z "${KEYMAN_USE_EMSDK+x}" ]]; then | ||
_select_emscripten_version_with_emsdk | ||
fi | ||
} | ||
|
||
# Use emsdk to select the appropriate version of Emscripten | ||
# according to minimum-versions.inc.sh | ||
_select_emscripten_version_with_emsdk() { | ||
if [[ -z "${EMSCRIPTEN_BASE+x}" ]]; then | ||
builder_die "Variable EMSCRIPTEN_BASE must be set" | ||
fi | ||
|
||
if [[ -z "${KEYMAN_MIN_VERSION_EMSCRIPTEN+x}" ]]; then | ||
builder_die "Variable KEYMAN_MIN_VERSION_EMSCRIPTEN must be set" | ||
fi | ||
|
||
pushd "${EMSCRIPTEN_BASE}/../.." > /dev/null | ||
if [[ ! -f emsdk ]]; then | ||
builder_die "emsdk[.bat] should be in $(pwd)" | ||
fi | ||
|
||
export EMSDK_KEEP_DOWNLOADS=1 | ||
git pull | ||
./emsdk install "$KEYMAN_MIN_VERSION_EMSCRIPTEN" | ||
./emsdk activate "$KEYMAN_MIN_VERSION_EMSCRIPTEN" | ||
popd > /dev/null | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is in minimum-versions.inc.sh in 18.0