-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[tool] Add initial gradle validation command #3715
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
[tool] Add initial gradle validation command #3715
Conversation
This will obsolete #3712 if it's ready to land before that gets a no-test exception. |
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 know changing file names can be a pain but can we name this something more specific. I think we will have more gradle checks moving forward. Maybe gradle_conventions_check_command
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 was assuming that future gradle checks would be added here; is there a reason we'd want new commands for those instead of having them all here? If you look at things like pubspec-check, we do a bunch of different checks related to the file in the one command.
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.
So I had assumed that this command was only for the gradle files at the top of packages since that was what was parsed. Basically the implementation was the behavior you desired but the documentation was incorrect. Based on this update if all checks will live in this file then then the name makes sense.
import 'common/package_looping_command.dart'; | ||
import 'common/repository_package.dart'; | ||
|
||
/// A command to enforce gradle file conventions and best practices. |
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.
This is not true based on the implementation. I think this will only impact topline gradle files and does not check gradle files in app.
Also from a structural perspective I think you might want to logically separate example gradle files from gradle files of plugins that are published.
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 this will only impact topline gradle files and does not check gradle files in app.
This is currently true, because the check I've added didn't seem important for apps. If that's not the case we can definitely change that.
Also from a structural perspective I think you might want to logically separate example gradle files from gradle files of plugins that are published.
Yes, that's why I have it only iterating over top-level packages, rather than setting the command to iterate over everything. My thought was that we could add example checks later, but I can definitely implement the structure for that now.
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.
It now iterates over everything, and just skips the current check for examples, so it will be easy to add things for all gradle files later.
(Let me know if you want this specific check to run for examples; currently it's not even in the flutter
template for apps.)
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.
So I had assumed that this command was only for the gradle files at the top of packages since that was what was parsed. Basically the implementation was the behavior you desired but the documentation was incorrect. Based on this update if all checks will live in this file then then the name makes sense.
flutter/packages@0277f2a...faf53fb 2023-04-18 engine-flutter-autoroll@skia.org Manual roll Flutter from 50171bb to 15cb1f8 (9 revisions) (flutter/packages#3749) 2023-04-17 reidbaker@google.com [palette_generator] run agp update for example (flutter/packages#3747) 2023-04-17 47866232+chunhtai@users.noreply.github.com [go_router] Fixes a bug that go_router would crash if pageBuilder depends on InheritedWidgets.s. (flutter/packages#3714) 2023-04-17 49699333+dependabot[bot]@users.noreply.github.com [pigeon]: Bump com.android.tools.build:gradle from 7.3.1 to 8.0.0 in /packages/pigeon/platform_tests/alternate_language_test_plugin/android (flutter/packages#3727) 2023-04-17 49699333+dependabot[bot]@users.noreply.github.com [pigeon]: Bump com.android.tools.build:gradle from 7.3.1 to 8.0.0 in /packages/pigeon/platform_tests/test_plugin/android (flutter/packages#3726) 2023-04-17 49699333+dependabot[bot]@users.noreply.github.com [pigeon]: Bump io.mockk:mockk from 1.13.4 to 1.13.5 in /packages/pigeon/platform_tests/test_plugin/android (flutter/packages#3725) 2023-04-17 stuartmorgan@google.com [tool] Add initial gradle validation command (flutter/packages#3715) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Adds a repo tool command to validate that all plugins set an explicit Java compatibility version, instead of using whatever the local toolchain happens to be (which creates the potential for issues like flutter/flutter#124839 where our CI passes but builds fail for some clients because our default is newer than theirs). Currently that's all it checks, but we can add any other gradle best practices we want to enforce here in the future. This also enables the new check in CI, and fixes all the violations it found. Fixes flutter/flutter#124839
Adds a repo tool command to validate that all plugins set an explicit Java compatibility version, instead of using whatever the local toolchain happens to be (which creates the potential for issues like flutter/flutter#124839 where our CI passes but builds fail for some clients because our default is newer than theirs).
Currently that's all it checks, but we can add any other gradle best practices we want to enforce here in the future.
This also enables the new check in CI, and fixes all the violations it found.
Fixes flutter/flutter#124839
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).