Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jesswrd
Copy link
Contributor

@jesswrd jesswrd commented Jul 23, 2025

Merged hardcoded compileSdkVersion instead of using flutter.compileSdkVersion. Reverting back to flutter.compileSdkVersion.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@jesswrd jesswrd requested a review from camsim99 as a code owner July 23, 2025 18:19
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly reverts a hardcoded compileSdkVersion in the camera_android plugin's build.gradle file, replacing it with the flutter.compileSdkVersion variable. This is the correct approach, ensuring the plugin respects the SDK version of the consuming Flutter application, which improves compatibility and maintainability. The change is sound and aligns with best practices for Flutter plugin development. I have no further comments.

@jesswrd jesswrd added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Jul 23, 2025
if (!compileSdkLine.contains('flutter.compileSdkVersion') && minFlutterVersion! >= Version(3, 27, 0)) {
printError('${indentation}Please use flutter.compileSdkVersion instead '
'of a hardcoded compileSdk version number');
return false;
Copy link
Contributor Author

@jesswrd jesswrd Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return false;

@@ -469,6 +471,11 @@ for more details.''';
return false;
}
}
if (!compileSdkLine.contains('flutter.compileSdkVersion') && minFlutterVersion! >= Version(3, 27, 0)) {
printError('${indentation}Please use flutter.compileSdkVersion instead '
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
printError('${indentation}Please use flutter.compileSdkVersion instead '
printError('${indentation}Warning: please use flutter.compileSdkVersion instead '

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@@ -31,7 +31,7 @@ buildFeatures {
buildConfig true
}
namespace 'io.flutter.plugins.camera'
compileSdk = 36
compileSdk = flutter.compileSdkVersion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should get a package version bump since it affected clients.

@@ -469,6 +471,11 @@ for more details.''';
return false;
}
}
if (!compileSdkLine.contains('flutter.compileSdkVersion') && minFlutterVersion! >= Version(3, 27, 0)) {
printError('${indentation}Please use flutter.compileSdkVersion instead '
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: camera platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants