-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Exclude non Android plugins from Gradle build #40640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: File.separator instead of File.pathSeparator. This should fix the tests that are failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks.
| 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is this an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
blasten
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what I can do as part of this CL...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print a warning when? both cases (having an android/build.gradle and not having it are legit...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
81da48d to
8026b0e
Compare
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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?