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:
Amir Hardon
2019-09-18 16:42:20 -07:00
committed by GitHub
parent d1e71cd85c
commit 4e108b6f90
3 changed files with 120 additions and 1 deletions

View File

@@ -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() {