Missing copyFlutterAssetsDebug task dependency
markushi opened this issue · comments
Description
Flutter registers it's own copyAssets task, which get's wired up with the mergeAssets
task here: https://github.com/flutter/flutter/blob/6ce591f7ea3ba827d9340ce03f7d8e3a37ebb03a/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy#L1295-L1298
Our plugin on the other hand uses assets transformer to inject the properties file:
The transformer is used to avoid any tasks dependencies, as copyFlutterAssets
is hooked up in a way that it depends on the minify
task, which is a required input for our task, leading to circular dependencies, see this related issue for more details: getsentry/sentry-react-native#3644
Steps to reproduce:
- setup a blank flutter app
- setup sentry
- setup assets for the flutter app via
pubspec.yaml
assets:
- some/random/file.png
- Try to build the app, it fails with the following error message:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:injectSentryDebugMetaPropertiesIntoAssetsDebug' (type 'InjectSentryMetaPropertiesIntoAssetsTask').
- Gradle detected a problem with the following location: '<app>/build/app/intermediates/assets/debug/mergeDebugAssets'.
Reason: Task ':app:injectSentryDebugMetaPropertiesIntoAssetsDebug' uses this output of task ':app:copyFlutterAssetsDebug' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':app:copyFlutterAssetsDebug' as an input of ':app:injectSentryDebugMetaPropertiesIntoAssetsDebug'.
5. Declare an explicit dependency on ':app:copyFlutterAssetsDebug' from ':app:injectSentryDebugMetaPropertiesIntoAssetsDebug' using Task#dependsOn.
6. Declare an explicit dependency on ':app:copyFlutterAssetsDebug' from ':app:injectSentryDebugMetaPropertiesIntoAssetsDebug' using Task#mustRunAfter.
For more information, please refer to https://docs.gradle.org/8.2/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.