getsentry / sentry-android-gradle-plugin

Gradle plugin for Sentry Android. Upload proguard, debug files, and more.

Home Page:https://docs.sentry.io/platforms/android/gradle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`generateSentryDebugMetaProperties` cache busts by adding a timestamp to the `sentry-meta-debug.properties`

danielamsel-toast opened this issue · comments

Gradle Version

8.5.0

AGP Version

8.2.2

Code Minifier/Optimizer

None

Version

4.2.0

Sentry SDK Version

7.1.0

Steps to Reproduce

  1. Assemble android app with sentry android gradle plugin + build cache enabled
  2. Assemble again, noticing that the assemble step does not cache

Expected Result

Assembling the application a second time results in a cache hit

Actual Result

Assembling the application, and open the sentry-debug-meta.properties file in the generated assets and observe that a timestamp is commented in the second line of the file like the following

#Generated by sentry-android-gradle-plugin
#Fri Feb 09 12:09:39 MST 2024
io.sentry.build-tool=gradle

This appears to be from using java.util.Properties props.store inside the task action.

hi @danielamsel-toast we've just release version 4.3.0 - could you give it a try? It should improve the task so it's not running if the sources or mapping file have not changed, and should be at least UP-TO-DATE. Thanks

@romtsn Thanks for the quick response. Upgrading to 4.3.0, I can confirm it now will succeed with an UP-TO-DATE check. The task continues to suffer the same issue with caching, which is an issue for us in CI where agents rely heavily on the cache over incremental builds.

Right, it still invalidates the cache, we'll provide a fix!

Let's provide a custom implementation which does not print timestamps into the .properties file.

@danielamsel-toast I've taken a closer look and actually I don't think the timestamp is the problem here but in general we're not declaring the aforementioned task as @CacheableTask, so it never gets cached. I'll open a PR with a fix soon!

@danielamsel-toast version 4.3.1 is out, please give it a try and let us know if that works, thanks! https://github.com/getsentry/sentry-android-gradle-plugin/releases/tag/4.3.1

Works great! Thank you so much Sentry team!