Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MOB-5167] Fix/android sourcemap upload #578

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

Merged
merged 1 commit into from
May 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion android/upload_sourcemap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ else
echo "Instabug: Generating sourcemap files..."
IS_HERMES=$(grep "enableHermes:" ./android/app/build.gradle -m 1)
if [[ $IS_HERMES == *"true"* ]]; then
#Find HERMES OS bin directory
case "$OSTYPE" in
darwin*) HERMES_OS_BIN='osx-bin' ;;
linux*) HERMES_OS_BIN='linux64-bin' ;;
msys*) HERMES_OS_BIN='win64-bin' ;;
*) echo "unknown: $OSTYPE" ;;
esac

#Find HERMES command file name
INSTALLED_RN_VERSION_MAJOR=$(node -p "require('./node_modules/react-native/package.json').version" | cut -d "." -f2)
if [ "$INSTALLED_RN_VERSION_MAJOR" -ge 63 ]
then
HERMES_COMMAND_NAME='hermesc'
else
HERMES_COMMAND_NAME='hermes'

fi
#Generate android sourcemap (HERMES)
react-native bundle --platform android \
--reset-cache \
Expand All @@ -47,7 +64,7 @@ else
--bundle-output index.android.bundle \
--sourcemap-output index.android.bundle.packager.map \

node_modules/hermes-engine/osx-bin/hermes -emit-binary -out index.android.bundle.hbc index.android.bundle -O -output-source-map > /dev/null 2>&1
node_modules/hermes-engine/$HERMES_OS_BIN/$HERMES_COMMAND_NAME -emit-binary -out index.android.bundle.hbc index.android.bundle -O -output-source-map > /dev/null 2>&1

cp index.android.bundle.hbc.map index.android.bundle.compiler.map

Expand Down