From 448aab452ea23b5270e9b9555f110aa202e9aab5 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Tue, 25 Mar 2025 16:07:52 +0100 Subject: [PATCH 1/2] fix: Changed `gradle.projectsEvaluated` to `project.afterEvaluate` in the Sentry Gradle Plugin to ensure tasks are created correctly with `--configure-on-demand` --- .github/workflows/e2e.yml | 1 + CHANGELOG.md | 4 ++++ packages/core/sentry.gradle | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4e9785d8a2..c6f793aafe 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -159,6 +159,7 @@ jobs: USE_FRAMEWORKS: ${{ matrix.ios-use-frameworks }} PRODUCTION: ${{ matrix.build-type == 'production' && '1' || '0' }} RCT_NEW_ARCH_ENABLED: ${{ matrix.rn-architecture == 'new' && '1' || '0' }} + SENTRY_DISABLE_AUTO_UPLOAD: 'false' strategy: fail-fast: false # keeps matrix running if one fails matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index a64fe000b9..6027bbcbe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,10 @@ }); ``` +### Changes + +- Change `gradle.projectsEvaluated` to `project.afterEvaluate` in the Sentry Gradle Plugin to fix tasks not being created when using `--configure-on-demand` ([#4687](https://github.com/getsentry/sentry-react-native/pull/4687)) + ### Fixes - Considers the `SENTRY_DISABLE_AUTO_UPLOAD` and `SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD` environment variables in the configuration of the Sentry Android Gradle Plugin for Expo plugin ([#4583](https://github.com/getsentry/sentry-react-native/pull/4583)) diff --git a/packages/core/sentry.gradle b/packages/core/sentry.gradle index fbbf567412..587f8e0f6f 100644 --- a/packages/core/sentry.gradle +++ b/packages/core/sentry.gradle @@ -3,7 +3,7 @@ import org.apache.tools.ant.taskdefs.condition.Os import java.util.regex.Matcher import java.util.regex.Pattern -project.ext.shouldSentryAutoUploadNative = { -> +project.ext.shouldSentryAutoUploadNative = { -> return System.getenv('SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD') != 'true' } @@ -17,7 +17,9 @@ project.ext.shouldSentryAutoUpload = { -> def config = project.hasProperty("sentryCli") ? project.sentryCli : []; -gradle.projectsEvaluated { +// gradle.projectsEvaluated doesn't work with --configure-on-demand +// the task are create too late and not executed +project.afterEvaluate { def releases = extractReleasesInfo() if (config.flavorAware && config.sentryProperties) { From 9188ec167ac5e7b5897fe94b3b95ed92dc0a6a16 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 26 Mar 2025 10:43:55 +0100 Subject: [PATCH 2/2] fix xcode upload --- dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js index f9be9e3329..d044817df2 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js @@ -32,7 +32,6 @@ if (semver.satisfies(args['rn-version'], `< ${newBundleScriptRNVersion}`, { incl logger.info('Applying old bundle script patch'); bundleScript = ` export NODE_BINARY=node -export SENTRY_CLI_EXTRA_ARGS="--force-foreground" ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh ../node_modules/react-native/scripts/react-native-xcode.sh `; bundleScriptRegex = /(packager|scripts)\/react-native-xcode\.sh\b/; @@ -40,7 +39,6 @@ export SENTRY_CLI_EXTRA_ARGS="--force-foreground" } else if (semver.satisfies(args['rn-version'], `>= ${newBundleScriptRNVersion}`, { includePrerelease: true })) { logger.info('Applying new bundle script patch'); bundleScript = ` -export SENTRY_CLI_EXTRA_ARGS="--force-foreground" WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh" REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"