From 713204b778d255ddfb62cc8810b413f0b57c6618 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Mon, 27 Nov 2023 12:32:03 +0100 Subject: [PATCH 1/6] Use NODE_BINARY as per https://github.com/getsentry/sentry-react-native/pull/2805 --- plugin/build/withSentryIOS.js | 4 ++-- plugin/src/withSentryIOS.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/build/withSentryIOS.js b/plugin/build/withSentryIOS.js index af8b3ba..58fb131 100644 --- a/plugin/build/withSentryIOS.js +++ b/plugin/build/withSentryIOS.js @@ -27,7 +27,7 @@ exports.writeSentryPropertiesTo = exports.modifyExistingXcodeBuildScript = expor const config_plugins_1 = require("expo/config-plugins"); const fs = __importStar(require("fs")); const path = __importStar(require("path")); -const SENTRY_CLI = `\`node --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; +const SENTRY_CLI = `\`$NODE_BINARY --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; const withSentryIOS = (config, sentryProperties) => { config = (0, config_plugins_1.withXcodeProject)(config, (config) => { const xcodeProject = config.modResults; @@ -66,7 +66,7 @@ function modifyExistingXcodeBuildScript(script) { 'export SENTRY_PROPERTIES=sentry.properties\n' + 'export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"\n' + code.replace(/^.*?(packager|scripts)\/react-native-xcode\.sh\s*(\\'\\\\")?/m, (match) => `${SENTRY_CLI} react-native xcode --force-foreground ${match}`) + - "\n\n`node --print \"require.resolve('@sentry/react-native/package.json').slice(0, -13) + '/scripts/collect-modules.sh'\"`"; + "\n\n`$NODE_BINARY --print \"require.resolve('@sentry/react-native/package.json').slice(0, -13) + '/scripts/collect-modules.sh'\"`"; script.shellScript = JSON.stringify(code); } exports.modifyExistingXcodeBuildScript = modifyExistingXcodeBuildScript; diff --git a/plugin/src/withSentryIOS.ts b/plugin/src/withSentryIOS.ts index ffe4d96..1748236 100644 --- a/plugin/src/withSentryIOS.ts +++ b/plugin/src/withSentryIOS.ts @@ -7,7 +7,7 @@ import { import * as fs from 'fs'; import * as path from 'path'; -const SENTRY_CLI = `\`node --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; +const SENTRY_CLI = `\`$NODE_BINARY --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; export const withSentryIOS: ConfigPlugin = (config, sentryProperties: string) => { config = withXcodeProject(config, (config) => { @@ -71,7 +71,7 @@ export function modifyExistingXcodeBuildScript(script: any): void { /^.*?(packager|scripts)\/react-native-xcode\.sh\s*(\\'\\\\")?/m, (match: any) => `${SENTRY_CLI} react-native xcode --force-foreground ${match}` ) + - "\n\n`node --print \"require.resolve('@sentry/react-native/package.json').slice(0, -13) + '/scripts/collect-modules.sh'\"`"; + "\n\n`$NODE_BINARY --print \"require.resolve('@sentry/react-native/package.json').slice(0, -13) + '/scripts/collect-modules.sh'\"`"; script.shellScript = JSON.stringify(code); } From d2b5fedc82ae55339687ee8d5a3f802771d1994c Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Mon, 27 Nov 2023 12:33:29 +0100 Subject: [PATCH 2/6] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f3f428..f33044b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### ๐Ÿ› Bug fixes +- Use NODE_BINARY as per https://github.com/getsentry/sentry-react-native/pull/2805 + ### ๐Ÿงน Chores ## [7.1.1](https://github.com/expo/sentry-expo/releases/tag/v7.1.1) - 2023-10-18 From 9a51bca19e0a332f0f51b80e2e3a6d51b81d3259 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Mon, 27 Nov 2023 12:40:43 +0100 Subject: [PATCH 3/6] Source xcode env in symbol upload script --- plugin/src/withSentryIOS.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/src/withSentryIOS.ts b/plugin/src/withSentryIOS.ts index 1748236..0b81898 100644 --- a/plugin/src/withSentryIOS.ts +++ b/plugin/src/withSentryIOS.ts @@ -26,6 +26,12 @@ export const withSentryIOS: ConfigPlugin = (config, sentryProperties: st { shellPath: '/bin/sh', shellScript: ` +if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then + source "$PODS_ROOT/../.xcode.env" +fi +if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then + source "$PODS_ROOT/../.xcode.env.local" +fi export SENTRY_PROPERTIES=sentry.properties [[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG="" ${SENTRY_CLI} debug-files upload --force-foreground "$INCLUDE_SOURCES_FLAG" "$DWARF_DSYM_FOLDER_PATH" From 7e8e01cf4c4b09601ec0bc7209a0629205dce89b Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Mon, 27 Nov 2023 12:43:41 +0100 Subject: [PATCH 4/6] Also path build directory --- plugin/build/withSentryIOS.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/build/withSentryIOS.js b/plugin/build/withSentryIOS.js index 58fb131..168fab4 100644 --- a/plugin/build/withSentryIOS.js +++ b/plugin/build/withSentryIOS.js @@ -36,6 +36,12 @@ const withSentryIOS = (config, sentryProperties) => { xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, { shellPath: '/bin/sh', shellScript: ` +if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then + source "$PODS_ROOT/../.xcode.env" +fi +if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then + source "$PODS_ROOT/../.xcode.env.local" +fi export SENTRY_PROPERTIES=sentry.properties [[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG="" ${SENTRY_CLI} debug-files upload --force-foreground "$INCLUDE_SOURCES_FLAG" "$DWARF_DSYM_FOLDER_PATH" From 2a27aa12733ded3f52b7a24d075c12662e8187e5 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Mon, 27 Nov 2023 12:51:03 +0100 Subject: [PATCH 5/6] Update version to 7.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b310272..275a0f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sentry-expo", - "version": "7.1.1", + "version": "7.1.2", "description": "Catch your Javascript errors for your production Expo apps!", "main": "build/index.js", "types": "build/index.d.ts", From 228f84a0894b4343122a82ac12bb9e8087c879c1 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Mon, 27 Nov 2023 13:34:12 +0100 Subject: [PATCH 6/6] Call @sentry/cli with NODE_BINARY patched PATH --- plugin/build/withSentryIOS.js | 2 +- plugin/src/withSentryIOS.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/build/withSentryIOS.js b/plugin/build/withSentryIOS.js index 168fab4..467ac38 100644 --- a/plugin/build/withSentryIOS.js +++ b/plugin/build/withSentryIOS.js @@ -27,7 +27,7 @@ exports.writeSentryPropertiesTo = exports.modifyExistingXcodeBuildScript = expor const config_plugins_1 = require("expo/config-plugins"); const fs = __importStar(require("fs")); const path = __importStar(require("path")); -const SENTRY_CLI = `\`$NODE_BINARY --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; +const SENTRY_CLI = `PATH=$PATH:$(dirname $NODE_BINARY) \`$NODE_BINARY --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; const withSentryIOS = (config, sentryProperties) => { config = (0, config_plugins_1.withXcodeProject)(config, (config) => { const xcodeProject = config.modResults; diff --git a/plugin/src/withSentryIOS.ts b/plugin/src/withSentryIOS.ts index 0b81898..611b3e4 100644 --- a/plugin/src/withSentryIOS.ts +++ b/plugin/src/withSentryIOS.ts @@ -7,7 +7,7 @@ import { import * as fs from 'fs'; import * as path from 'path'; -const SENTRY_CLI = `\`$NODE_BINARY --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; +const SENTRY_CLI = `PATH=$PATH:$(dirname $NODE_BINARY) \`$NODE_BINARY --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``; export const withSentryIOS: ConfigPlugin = (config, sentryProperties: string) => { config = withXcodeProject(config, (config) => {