-
-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
848 additions
and
76 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
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
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
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
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,52 @@ | ||
const process = require('process'); | ||
const fs = require('fs'); | ||
|
||
console.log('Copy `debugId` from packager source map to Hermes source map...'); | ||
|
||
const packagerSourceMapPath = process.argv[2]; | ||
const hermesSourceMapPath = process.argv[3]; | ||
|
||
if (!packagerSourceMapPath) { | ||
console.log('Please provide packager source map path (A path to copy `debugId` from).'); | ||
process.exit(0); | ||
} | ||
if (!hermesSourceMapPath) { | ||
console.log('Please provide Hermes source map path. ((A path to copy `debugId` to))'); | ||
process.exit(0); | ||
} | ||
if (!fs.existsSync(packagerSourceMapPath)) { | ||
console.log('Packager source map path (A path to copy `debugId` from).'); | ||
process.exit(0); | ||
} | ||
if (!fs.existsSync(hermesSourceMapPath)) { | ||
console.log('Hermes source map not found. ((A path to copy `debugId` to))'); | ||
process.exit(0); | ||
} | ||
|
||
const from = fs.readFileSync(process.argv[2], 'utf8'); | ||
const to = fs.readFileSync(process.argv[3], 'utf8'); | ||
|
||
const fromParsed = JSON.parse(from); | ||
const toParsed = JSON.parse(to); | ||
|
||
if (!fromParsed.debugId && !fromParsed.debug_id) { | ||
console.log('Packager source map does not have `debugId`.'); | ||
process.exit(0); | ||
} | ||
|
||
if (toParsed.debugId || toParsed.debug_id) { | ||
console.log('Hermes combined source map already has `debugId`.'); | ||
process.exit(0); | ||
} | ||
|
||
if (fromParsed.debugId) { | ||
toParsed.debugId = fromParsed.debugId; | ||
toParsed.debug_id = fromParsed.debugId; | ||
} else if (fromParsed.debug_id) { | ||
toParsed.debugId = fromParsed.debug_id; | ||
toParsed.debug_id = fromParsed.debug_id; | ||
} | ||
|
||
fs.writeFileSync(process.argv[3], JSON.stringify(toParsed)); | ||
|
||
console.log('Done.'); |
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,31 @@ | ||
const process = require('process'); | ||
const fs = require('fs'); | ||
|
||
const sourceMapPath = process.argv[2]; | ||
|
||
if (!sourceMapPath) { | ||
console.log('Add source map path as first argument of the script.'); | ||
process.exit(1); | ||
} | ||
|
||
if (!fs.existsSync(sourceMapPath)) { | ||
console.log(`${sourceMapPath} does not exist.`); | ||
process.exit(1); | ||
} | ||
|
||
let sourceMap; | ||
try { | ||
sourceMap = JSON.parse(fs.readFileSync(sourceMapPath, 'utf8')); | ||
} catch (e) { | ||
console.log(`${sourceMapPath} is not valid JSON`, e); | ||
process.exist(1); | ||
} | ||
|
||
if (typeof sourceMap.debugId === 'string' && sourceMap.debugId.length > 0) { | ||
console.log(sourceMap.debugId); | ||
} else if (typeof sourceMap.debug_id === 'string' && sourceMap.debug_id.length > 0) { | ||
console.log(sourceMap.debug_id); | ||
} else { | ||
console.log(`${sourceMapPath} does not contain 'debugId' nor 'debug_id'.`); | ||
process.exist(1); | ||
} |
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,13 @@ | ||
// This is non minified version the debug id injection snippet used in the Metro plugin. | ||
var _sentryDebugIds = {}; | ||
var _sentryDebugIdIdentifier = ''; | ||
try { | ||
var stack = new Error().stack; | ||
if (stack) { | ||
_sentryDebugIds[stack] = '__SENTRY_DEBUG_ID__'; | ||
// eslint-disable-next-line no-unused-vars | ||
_sentryDebugIdIdentifier = 'sentry-dbid-__SENTRY_DEBUG_ID__'; | ||
} | ||
} catch (e) { | ||
/**/ | ||
} |
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,21 @@ | ||
# Upload Debug Symbols to Sentry Xcode Build Phase | ||
# PWD=ios | ||
|
||
# print commands before executing them and stop on first error | ||
set -x -e | ||
|
||
# load envs if loader file exists (since rn 0.68) | ||
WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh" | ||
if [ -f "$WITH_ENVIRONMENT" ]; then | ||
. "$WITH_ENVIRONMENT" | ||
fi | ||
|
||
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties | ||
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="../node_modules/@sentry/cli/bin/sentry-cli" | ||
|
||
[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG="" | ||
|
||
EXTRA_ARGS="$SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_DEBUG_FILES_UPLOAD_EXTRA_ARGS $INCLUDE_SOURCES_FLAG" | ||
|
||
UPLOAD_DEBUG_FILES="\"$SENTRY_CLI_EXECUTABLE\" debug-files upload $EXTRA_ARGS \"$DWARF_DSYM_FOLDER_PATH\"" | ||
/bin/sh -c "$UPLOAD_DEBUG_FILES" |
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,23 @@ | ||
# Sentry Bundle React Native code and images | ||
# PWD=ios | ||
|
||
# print commands before executing them and stop on first error | ||
set -x -e | ||
|
||
# WITH_ENVIRONMENT is executed by React Native | ||
|
||
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties | ||
[ -z "$EXTRA_PACKAGER_ARGS" ] && export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map" | ||
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="../node_modules/@sentry/cli/bin/sentry-cli" | ||
|
||
REACT_NATIVE_XCODE=$1 | ||
|
||
BUNDLE_REACT_NATIVE="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_RN_XCODE_EXTRA_ARGS \"$REACT_NATIVE_XCODE\"" | ||
|
||
/bin/sh -c "$BUNDLE_REACT_NATIVE" | ||
|
||
[ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_COLLECT_MODULES="../../scripts/collect-modules.sh" | ||
|
||
if [ -f "$SENTRY_COLLECT_MODULES" ]; then | ||
/bin/sh "$SENTRY_COLLECT_MODULES" | ||
fi |
Oops, something went wrong.