Skip to content

Commit d31c934

Browse files
author
Ali Abdelfattah
authored
Merge pull request #578 from Instabug/Fix/android-sourcemap-upload
[MOB-5167] Fix/android sourcemap upload
2 parents 134f8d9 + e7b2b82 commit d31c934

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

android/upload_sourcemap.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ else
3939
echo "Instabug: Generating sourcemap files..."
4040
IS_HERMES=$(grep "enableHermes:" ./android/app/build.gradle -m 1)
4141
if [[ $IS_HERMES == *"true"* ]]; then
42+
#Find HERMES OS bin directory
43+
case "$OSTYPE" in
44+
darwin*) HERMES_OS_BIN='osx-bin' ;;
45+
linux*) HERMES_OS_BIN='linux64-bin' ;;
46+
msys*) HERMES_OS_BIN='win64-bin' ;;
47+
*) echo "unknown: $OSTYPE" ;;
48+
esac
49+
50+
#Find HERMES command file name
51+
INSTALLED_RN_VERSION_MAJOR=$(node -p "require('./node_modules/react-native/package.json').version" | cut -d "." -f2)
52+
if [ "$INSTALLED_RN_VERSION_MAJOR" -ge 63 ]
53+
then
54+
HERMES_COMMAND_NAME='hermesc'
55+
else
56+
HERMES_COMMAND_NAME='hermes'
57+
58+
fi
4259
#Generate android sourcemap (HERMES)
4360
npx react-native bundle --platform android \
4461
--reset-cache \
@@ -47,7 +64,7 @@ else
4764
--bundle-output index.android.bundle \
4865
--sourcemap-output index.android.bundle.packager.map \
4966

50-
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
67+
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
5168

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

0 commit comments

Comments
 (0)