bugsnag / bugsnag-android-gradle-plugin

Gradle plugin for BugSnag which uploads ProGuard, DexGuard and NDK mapping files, and sends build notifications
https://docs.bugsnag.com/build-integrations/gradle/
MIT License
70 stars 38 forks source link

Only set mappingFilesProvider on release task if obfuscation enabled #292

Closed fractalwrench closed 4 years ago

fractalwrench commented 4 years ago

Goal

The BugsnagReleaseTask takes the JVM mapping file as a task input. This is used to invalidate the task's caching - if the mapping file has changed, then the code has also changed so new release information needs to be sent to Bugsnag.

If the NDK and release uploads are enabled but JVM minification is disabled, then no mapping file will exist. This means that the value of jvmMappingFileProperty will not exist, which will cause Gradle to throw an invalid user data exception on AGP 4.1.0/Gradle 6.6, because task inputs should be a valid file.

The jvmMappingFileProperty is already marked as @Optional to try and avoid this scenario. This changeset fixes the issue by only setting the property value if obfuscation is enabled, as Gradle will not attempt to validate the property in this case.

Testing

Verified changes manually by running the ndk_app_agp400 scenarios on a6ec99235e8732fb5c7f3ff52aa4cc2e4a8e4617 with and without the changes.

fractalwrench commented 4 years ago

CI appears to be flaking on one scenario due to a change in request order. This will be addressed in #291