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

Support for Gradle Configuration Cache #4252

Open
smellouk opened this issue Nov 8, 2024 · 4 comments
Open

Support for Gradle Configuration Cache #4252

smellouk opened this issue Nov 8, 2024 · 4 comments

Comments

@smellouk
Copy link

smellouk commented Nov 8, 2024

What React Native libraries do you use?

React Native without Frameworks

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

5.25.0

How does your development environment look like?

OS: mac-os
arch: arm64
react native: 0.74.3-0
hermes enabled: true

Sentry.init()

 sentry.init({
        dsn: sentryConfig.dsn,
        release: sentryConfig.release,
        enabled: sentryConfig.enabled,
        autoSessionTracking: false,
        ignoreErrors: [],
    });

Steps to Reproduce

  1. Export SENTRY_DISABLE_AUTO_UPLOAD=false
  2. Export SENTRY_AUTH_TOKEN=YOUR_TOKEN
  3. enable org.gradle.configuration-cache=true in gradle.properties
  4. set warn level for configuration cache problems org.gradle.unsafe.configuration-cache-problems=warn in gradle properties
  5. build release app apk or bundle ./gradlew assembleRelease

Expected Result

Building/Assembling APK or bundle tasks should succeed without error.

Actual Result

See the complete report at .../configuration-cache/arbf12exyse0x2d67zxpdnb38/e07xbrg4hyz0msuzuubqcqzuy/configuration-cache-report.html

FAILURE: Build failed with an exception.

* Where:
Script '.../node_modules/@sentry/react-native/sentry.gradle' line: 104

* What went wrong:
Could not evaluate onlyIf predicate for task ':app:createBundleReleaseJsAndAssets_SentryUpload_PACKAGE_ID@VERSION_NAME+VERSION_CODE'.
> Could not evaluate spec for 'Task satisfies onlyIf closure'.
@krystofwoldrich
Copy link
Member

Hi @smellouk,
thank you for the report and the detailed steps, I was able to reproduce the issue in our sample application.

At the moment the Gradle configuration cache doesn't support all gradle features, some of the unsupported features are used in the sentry.gradle.

I can't confirm at the moment if we are able to work around the current gradle configuration cache limitations.


As a workaround, you can exclude the sentry.gradle and upload source maps manually.

https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/

@krystofwoldrich krystofwoldrich changed the title Gradle Configuration Cache Support for Gradle Configuration Cache Nov 21, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs Investigation in Mobile & Cross Platform SDK Nov 22, 2024
@krystofwoldrich krystofwoldrich self-assigned this Nov 22, 2024
@smellouk
Copy link
Author

@krystofwoldrich Thanks so much for looking into this matter 🙏!

We’re working on a project that’s growing in complexity, and we’d like to optimize the Gradle configuration to reduce assembly time. Additionally, we have some automation tasks in place, and as a one-time setup, we’d like to enable the automatic upload of sourcemaps and ProGuard mappings.

It’s not urgent for now, we disabled our gradle configuration cache for now, but we’d appreciate your help when possible.

@krystofwoldrich
Copy link
Member

@romtsn @markushi @stefanosiano Our current sentry.gradle script doesn't work with Gradle Configuration Cache, before we would start refactor of it to support the cache, I want to check does SAGP support Gradle Configuration Cache?

@romtsn
Copy link
Member

romtsn commented Dec 10, 2024

@krystofwoldrich yep, it does. Configuration cache can speed up builds by quite a bit.

@krystofwoldrich krystofwoldrich removed their assignment Dec 10, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Investigation to Needs Discussion in Mobile & Cross Platform SDK Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Needs Discussion
Development

No branches or pull requests

3 participants