Exclude non Android plugins from Gradle build#40640
Conversation
| Properties allPlugins = readPropertiesIfExist(pluginsFile) | ||
| Properties androidPlugins = new Properties() | ||
| allPlugins.each { name, path -> | ||
| File editableAndroidProject = new File(path, 'android' + File.pathSeparator + 'build.gradle') |
There was a problem hiding this comment.
nit: File.separator instead of File.pathSeparator. This should fix the tests that are failing.
| allPlugins.each { name, path -> | ||
| File editableAndroidProject = new File(path, 'android' + File.pathSeparator + 'build.gradle') | ||
| if (editableAndroidProject.exists()) { | ||
| project.logger.error("$editableAndroidProject exists adding $name -> $path") |
| Properties androidPlugins = new Properties() | ||
| allPlugins.each { name, path -> | ||
| File editableAndroidProject = new File(path, 'android' + File.separator + 'build.gradle') | ||
| if (editableAndroidProject.exists()) { |
There was a problem hiding this comment.
I think we might want to print some sort of warning here. Assuming that we can fix the platform specific .flutter-plugins issue, this would still be an error.
There was a problem hiding this comment.
Not sure what I can do as part of this CL...?
There was a problem hiding this comment.
There was a problem hiding this comment.
Print a warning when? both cases (having an android/build.gradle and not having it are legit...)
There was a problem hiding this comment.
print a warning when it is missing. You're right for now that isn't an error because it is unavoidable. Maybe leave a todo so we can revisit it in the future.
81da48d to
8026b0e
Compare
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.
As of flutter/flutter#40640 these should no longer be necessary. Also fixes a typo in a plugin pubspec.yaml.
As of flutter/flutter#40640 these should no longer be necessary. Also fixes a typo in a plugin pubspec.yaml.
Description
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.gradlefile.Related Issues
#39657
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?