Skip to content
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

Use NODE_BINARY as per https://github.com/getsentry/sentry-react-native/pull/2805 #379

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 8 additions & 2 deletions plugin/build/withSentryIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `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;
Expand All @@ -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"
Expand Down Expand Up @@ -66,7 +72,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;
Expand Down
10 changes: 8 additions & 2 deletions plugin/src/withSentryIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `PATH=$PATH:$(dirname $NODE_BINARY) \`$NODE_BINARY --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``;

export const withSentryIOS: ConfigPlugin<string> = (config, sentryProperties: string) => {
config = withXcodeProject(config, (config) => {
Expand All @@ -26,6 +26,12 @@ export const withSentryIOS: ConfigPlugin<string> = (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"
Expand Down Expand Up @@ -71,7 +77,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);
}
Expand Down