-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: prepare for upload symbols to sentry.
- Loading branch information
1 parent
518f323
commit bc38c58
Showing
1 changed file
with
46 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
script_dir="$( cd "$( dirname "$0" )" && pwd )" | ||
project_dir=$(dirname $script_dir) | ||
|
||
# https://docs.sentry.io/platforms/react-native/manual-setup/hermes/ | ||
|
||
os_name=$(uname -s) | ||
|
||
if [[ "$os_name" = "Darwin" ]]; then | ||
HERMES_OS_BIN="osx-bin" | ||
elif [[ "$os_name" = "Linux" ]]; then | ||
HERMES_OS_BIN="linux64-bin" | ||
else | ||
HERMES_OS_BIN="win64-bin" | ||
fi | ||
|
||
if [[ -f "$project_dir/node_modules/react-native/sdks/hermesc/${HERMES_OS_BIN}/hermesc" ]]; then | ||
# react-native v0.69 or higher (keep only this condition when version is reached) | ||
HERMES_BIN="$project_dir/node_modules/react-native/sdks/hermesc/${HERMES_OS_BIN}/hermesc" | ||
elif [[ -f "$project_dir/node_modules/hermes-engine/${HERMES_OS_BIN}/hermesc" ]]; then | ||
# react-native v0.68 (current) | ||
HERMES_BIN="$project_dir/node_modules/hermes-engine/${HERMES_OS_BIN}/hermesc" | ||
else | ||
echo "Hermes compiler not found." | ||
exit 1; | ||
fi | ||
|
||
JSBUNDLE_NAME="../android/app/src/main/assets/index.android.bundle" | ||
|
||
"${HERMES_BIN}" \ | ||
-O \ | ||
-emit-binary \ | ||
-output-source-map \ | ||
-out="${JSBUNDLE_NAME}.hbc" \ | ||
"${JSBUNDLE_NAME}" | ||
|
||
rm -f "${JSBUNDLE_NAME}" | ||
mv "${JSBUNDLE_NAME}.hbc" "${JSBUNDLE_NAME}" | ||
|
||
node ../node_modules/react-native/scripts/compose-source-maps.js \ | ||
"${JSBUNDLE_NAME}.packager.map" \ | ||
"${JSBUNDLE_NAME}.hbc.map" \ | ||
-o "${JSBUNDLE_NAME}.map" |