Declare dependency on copyFlutterAssetsTask in bundleAarTask (#137370)

Fixes https://github.com/flutter/flutter/issues/129471.

Does so by doing a very similar thing that is done by https://github.com/flutter/flutter/pull/121958, but for a task that is specific to the add to app build process.
This commit is contained in:
Gray Mackall
2023-10-26 15:05:45 -07:00
committed by GitHub
parent 6f093b1db8
commit 383562a713

View File

@@ -1130,12 +1130,19 @@ class FlutterPlugin implements Plugin<Project> {
variantOutput.processResourcesProvider.get() : variantOutput.processResources
processResources.dependsOn(copyFlutterAssetsTask)
}
// Task compressAssets uses the output of copyFlutterAssetsTask,
// so it's necessary to declare it as an dependency.
// The following tasks use the output of copyFlutterAssetsTask,
// so it's necessary to declare it as an dependency since Gradle 8.
// See https://docs.gradle.org/8.1/userguide/validation_problems.html#implicit_dependency.
def compressAssetsTask = project.tasks.findByName("compress${variant.name.capitalize()}Assets")
if (compressAssetsTask) {
compressAssetsTask.dependsOn copyFlutterAssetsTask
}
def bundleAarTask = project.tasks.findByName("bundle${variant.name.capitalize()}Aar")
if (bundleAarTask) {
bundleAarTask.dependsOn copyFlutterAssetsTask
}
return copyFlutterAssetsTask
} // end def addFlutterDeps