-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Revert hardcoded compilesdk back to flutter.compileSdkVersion in camera_android
#9668
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
Changes from 4 commits
4690dc4
f8f999c
eb5f109
1e12eec
72c63df
2d83876
ef09abb
139e5cd
459ef39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -428,6 +428,15 @@ for more details.'''; | |||||
| final RegExp legacySettingPattern = RegExp(r'^\s*compileSdkVersion'); | ||||||
| final String? compileSdkLine = gradleLines | ||||||
| .firstWhereOrNull((String line) => linePattern.hasMatch(line)); | ||||||
|
|
||||||
| final Pubspec pubspec = package.parsePubspec(); | ||||||
| final VersionConstraint? flutterConstraint = | ||||||
| pubspec.environment['flutter']; | ||||||
| final Version? minFlutterVersion = | ||||||
| flutterConstraint != null && flutterConstraint is VersionRange | ||||||
| ? flutterConstraint.min | ||||||
| : null; | ||||||
|
|
||||||
| if (compileSdkLine == null) { | ||||||
| // Equals regex not found check for method pattern. | ||||||
| final RegExp compileSpacePattern = RegExp(r'^\s*compileSdk'); | ||||||
|
|
@@ -447,13 +456,6 @@ for more details.'''; | |||||
| return false; | ||||||
| } | ||||||
| if (compileSdkLine.contains('flutter.compileSdkVersion')) { | ||||||
| final Pubspec pubspec = package.parsePubspec(); | ||||||
| final VersionConstraint? flutterConstraint = | ||||||
| pubspec.environment['flutter']; | ||||||
| final Version? minFlutterVersion = | ||||||
| flutterConstraint != null && flutterConstraint is VersionRange | ||||||
| ? flutterConstraint.min | ||||||
| : null; | ||||||
| if (minFlutterVersion == null) { | ||||||
| printError('${indentation}Unable to find a Flutter SDK version ' | ||||||
| 'constraint. Use of flutter.compileSdkVersion requires a minimum ' | ||||||
|
|
@@ -469,6 +471,11 @@ for more details.'''; | |||||
| return false; | ||||||
| } | ||||||
| } | ||||||
| if (!compileSdkLine.contains('flutter.compileSdkVersion') && minFlutterVersion! >= Version(3, 27, 0)) { | ||||||
camsim99 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| printError('${indentation}Please use flutter.compileSdkVersion instead ' | ||||||
|
||||||
| printError('${indentation}Please use flutter.compileSdkVersion instead ' | |
| printError('${indentation}Warning: please use flutter.compileSdkVersion instead ' |
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.
A useful warning requires some sort of message at the bottom of the gradle_check_command output. Will probably have to look in package_looping_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.
Per my comment in the other PR, a message at the bottom of the output still won't really be a useful warning most of the time. We have printWarning, which will cause a message in the summary at the end, but as it says in its docs:
/// Warnings are not surfaced in CI summaries, so this is only useful for
/// highlighting something when someone is already looking though the log
/// messages. DO NOT RELY on someone noticing a warning; instead, use it for
/// things that might be useful to someone debugging an unexpected result.
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.
Taking this over--how about we keep the printError and just return false? The validation will fail then they can look through the logs to see the reason why.
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.
Some context got lost here; this thread in the original PR explains the problem with making it an error to use a value.
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.
Understood. I added a check for lower that flutter.compileSdkVersion. Of course, that isn't great because it relies on a hard coded version of that value and not the actual value itself, so we would have to update the command every time flutter.compileSdkVersion is used, so more maintenance burden. But, I'm okay keeping it.
Also, I considered adding a check for version == flutter.compileSdkVersion but I don't think that's a major value add, but let me know if you disagree.
Uh oh!
There was an error while loading. Please reload this page.