Closed diegov closed 3 years ago
This pull request has been linked to Clubhouse Story #85159: [L2][SEV 2] Notifier version shows code_version due to Gradle Shadow plugin.
@basoko requesting re-review since I had accidentally pushed the code review fix to a different branch earlier. Thanks!
Description of the change
This PR updates the method we use to find the notifier version, to use a generated Java class instead of the jar's manifest attributes.
This fixes the notifier version attribute when users shade rollbar-java, since until now we could end up reporting the version of the user's application as the notifier version instead of our own, due to the fact that our classes had been merged into the user's jar, and only one manifest resource (the user's) remained.
The approach we take now is to generate a static class at build time, with a single method returning the version. This removes the need for any dynamic resource loading, which could fail under relocation since the references are strings.
Automated test coverage isn't great on this change, but I ran a shading + relocation test using the
com.github.johnrengelman.shadow
gradle plugin, with relocated classes:I've verified that the classes are actually relocated in the Jar:
Using
rollbar-java
1.7.6:With this fix:
Type of change
Related issues
[ch85159]
Checklists
Development
Code review