Exclude non Android plugins from Gradle build (#40640)
Before this change, having an Android app depend on a plugin that has no android implementation resulted in a Gradle build failure. This scenario is likely to become more common if we're enabling federated plugins, as the package implementing just the desktop implementation of a plugin won't have an Android implementation. This changes the Gradle plugin to not try to build any plugins that doesn't have an android/build.gradle file.
This commit is contained in:
@@ -329,7 +329,18 @@ class FlutterPlugin implements Plugin<Project> {
|
||||
|
||||
private Properties getPluginList() {
|
||||
File pluginsFile = new File(project.projectDir.parentFile.parentFile, '.flutter-plugins')
|
||||
return readPropertiesIfExist(pluginsFile)
|
||||
Properties allPlugins = readPropertiesIfExist(pluginsFile)
|
||||
Properties androidPlugins = new Properties()
|
||||
allPlugins.each { name, path ->
|
||||
File editableAndroidProject = new File(path, 'android' + File.separator + 'build.gradle')
|
||||
if (editableAndroidProject.exists()) {
|
||||
androidPlugins.setProperty(name, path)
|
||||
}
|
||||
// TODO(amirh): log an error if this plugin was specified to be an Android
|
||||
// plugin according to the new schema, and was missing a build.gradle file.
|
||||
// https://github.com/flutter/flutter/issues/40784
|
||||
}
|
||||
return androidPlugins
|
||||
}
|
||||
|
||||
private void addPluginTasks() {
|
||||
|
||||
Reference in New Issue
Block a user