From a8a734df3724a33d9495eff4bdb7bb14cefc7f39 Mon Sep 17 00:00:00 2001 From: Mateus Craveiro Date: Mon, 15 May 2023 13:40:00 -0300 Subject: [PATCH 1/4] fix(gradle): add resolved sentry package for monorepos fix #2740 --- sentry.gradle | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sentry.gradle b/sentry.gradle index a023126317..1c9a2636d7 100644 --- a/sentry.gradle +++ b/sentry.gradle @@ -163,9 +163,15 @@ gradle.projectsEvaluated { workingDir reactRoot + def resolvedSentryPath = null + try { + resolvedSentryPath = new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile(); + } catch (Throwable ignored) {} + def sentryPackage = resolvedSentryPath != null && resolvedSentryPath.exists() ? resolvedSentryPath.getAbsolutePath() : "$reactRoot/node_modules/@sentry/react-native" + def collectModulesScript = config.collectModulesScript ? file(config.collectModulesScript).getAbsolutePath() - : "$reactRoot/node_modules/@sentry/react-native/dist/js/tools/collectModules.js" + : "$sentryPackage/dist/js/tools/collectModules.js" def modulesPaths = config.modulesPaths ? config.modulesPaths.join(',') : "$reactRoot/node_modules" From d18788726b6656377de1365256be859672d6436f Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Tue, 30 May 2023 14:15:26 +0200 Subject: [PATCH 2/4] Add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d937a905..59a7f35c7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Features + +- Dynamically resolve `collectModulesScript` path to support monorepos ([#3092])(https://github.com/getsentry/sentry-react-native/pull/3092) + ### Dependencies - Bump JavaScript SDK from v7.52.0 to v7.52.1 ([#3071](https://github.com/getsentry/sentry-react-native/pull/3071)) From 6685915984575a11414decf0461501c57c56677c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Fri, 2 Jun 2023 10:50:20 +0200 Subject: [PATCH 3/4] Add comment to the fall back sentry.gradle --- sentry.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry.gradle b/sentry.gradle index 5a3bf3cb63..b4671fa477 100644 --- a/sentry.gradle +++ b/sentry.gradle @@ -169,7 +169,7 @@ gradle.projectsEvaluated { def resolvedSentryPath = null try { resolvedSentryPath = new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile(); - } catch (Throwable ignored) {} + } catch (Throwable ignored) {} // if the resolve fails we fallback to the default path def sentryPackage = resolvedSentryPath != null && resolvedSentryPath.exists() ? resolvedSentryPath.getAbsolutePath() : "$reactRoot/node_modules/@sentry/react-native" def collectModulesScript = config.collectModulesScript From ab95f82858397b9956fd5226f5a99af04301ece0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Fri, 2 Jun 2023 10:51:07 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59a7f35c7e..56a38d20a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -### Features +### Fixes - Dynamically resolve `collectModulesScript` path to support monorepos ([#3092])(https://github.com/getsentry/sentry-react-native/pull/3092)