Skip to content

Commit ac50687

Browse files
Ref: make .env.sentry-build-plugin optional (#5029)
* make .ent.sentry-build-plugin optional * changelog * Fix CHANGELOG.md typo --------- Co-authored-by: Antonis Lilis <antonis.lilis@gmail.com>
1 parent 553e027 commit ac50687

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Fixes
1212

13+
- Warnings when .env.sentry-build-plugin is not set on Sentry/CLI ([#5029](https://github.com/getsentry/sentry-react-native/pull/5029))
1314
- Fix for `sentry-cli` path discovery not working on Android ([#5009](https://github.com/getsentry/sentry-react-native/pull/5009))
1415
- Export `addIntegration` from `@sentry/core` ([#5020](https://github.com/getsentry/sentry-react-native/pull/5020))
1516

packages/core/scripts/expo-upload-sourcemaps.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ try {
129129
console.warn(error);
130130
}
131131

132-
loadDotenv(path.join(projectRoot, '.env.sentry-build-plugin'));
132+
const sentryBuildPluginPath = path.join(projectRoot, '.env.sentry-build-plugin');
133+
if (fs.existsSync(sentryBuildPluginPath)) {
134+
loadDotenv();
135+
}
133136

134137
let sentryOrg = getEnvVar(SENTRY_ORG);
135138
let sentryUrl = getEnvVar(SENTRY_URL);

packages/core/scripts/sentry-xcode-debug-files.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ LOCAL_NODE_BINARY=${NODE_BINARY:-node}
2424
RN_PROJECT_ROOT="${PROJECT_DIR}/.."
2525

2626
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
27-
[ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
27+
[ -z "$SENTRY_DOTENV_PATH" ] && [ -f "$RN_PROJECT_ROOT/.env.sentry-build-plugin" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
2828

2929
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
3030
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"

packages/core/scripts/sentry-xcode.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LOCAL_NODE_BINARY=${NODE_BINARY:-node}
1313
RN_PROJECT_ROOT="${PROJECT_DIR}/.."
1414

1515
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
16-
[ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
16+
[ -z "$SENTRY_DOTENV_PATH" ] && [ -f "$RN_PROJECT_ROOT/.env.sentry-build-plugin" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
1717
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
1818

1919
if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then

packages/core/sentry.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ project.afterEvaluate {
201201

202202
project.logger.lifecycle("Sentry-CLI arguments: ${args}")
203203
def osCompatibility = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c', 'node'] : []
204-
if (!System.getenv('SENTRY_DOTENV_PATH')) {
204+
if (!System.getenv('SENTRY_DOTENV_PATH') && file("$reactRoot/.env.sentry-build-plugin").exists()) {
205205
environment('SENTRY_DOTENV_PATH', "$reactRoot/.env.sentry-build-plugin")
206206
}
207207
commandLine(*osCompatibility, *args)

0 commit comments

Comments
 (0)