[flutter_tools] Migrate detectLowCompileSdkVersionOrNdkVersion to AGP task#184731
[flutter_tools] Migrate detectLowCompileSdkVersionOrNdkVersion to AGP task#184731reidbaker wants to merge 11 commits intoflutter:masterfrom
Conversation
… task Migrates the evaluation of detectLowCompileSdkVersionOrNdkVersion from project.afterEvaluate to a modern Android Gradle Plugin (AGP) task-based approach.
There was a problem hiding this comment.
Code Review
This pull request refactors the Android SDK and NDK version validation logic into a dedicated Gradle task, ValidateCompileSdkVersionTask, which is now wired to run before the preBuild task. The changes include migrating the validation logic from FlutterPluginUtils and updating the test suite accordingly. Feedback was provided to improve Gradle performance by adhering to the Task Configuration Avoidance API, specifically by configuring the task lazily instead of forcing immediate realization.
|
Leaving in draft until tests pass. |
- Applied ktlint formatting using CI configuration - Used editorconfig and ktlint-baseline from dev/bots/test/analyze-test-input - Validated all changes pass ktlint checks
…ment on github for ways to resolve false positives
There was a problem hiding this comment.
Code Review
This pull request refactors the Android SDK and NDK version validation logic by introducing a new 'ValidateCompileSdkVersionTask' and removing the legacy 'logPluginCompileSdkWarnings' and 'logPluginNdkWarnings' methods from 'FlutterPluginUtils'. The review identified several critical issues: missing imports for 'AndroidComponentsExtension', potential NullPointerExceptions when accessing Android extensions, and the need to restore default NDK version handling to prevent runtime crashes.
…ce and configuration cache compatible
|
An existing Git SHA, To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with |
| val name = requireNotNull(plugin["name"] as? String) { "Missing valid \"name\" property for plugin object: $plugin" } | ||
| val pluginProject = project.rootProject.findProject(":$name") | ||
| if (pluginProject != null) { | ||
| val androidExtensionWrapper = |
There was a problem hiding this comment.
Should this be pluginAndroidExtension and the existing extension be projectAndroidExtension ? The current naming makes it seem like one is a wrapper and one is the direct object
but these are just actually both the direct object right, just for the different projects
Migrates the evaluation of detectLowCompileSdkVersionOrNdkVersion from project.afterEvaluate to a modern Android Gradle Plugin (AGP) task-based approach.
Fixes #184415
Pre-launch Checklist
///).