Skip to content

Remove AGP-internal imports from VersionFetcher and migrate compileSdk/ndk reads to the public DSL - #2

Open
reidbaker-agent wants to merge 1 commit into
agp-api-docfrom
agp-internal-utils
Open

Remove AGP-internal imports from VersionFetcher and migrate compileSdk/ndk reads to the public DSL#2
reidbaker-agent wants to merge 1 commit into
agp-api-docfrom
agp-internal-utils

Conversation

@reidbaker-agent

@reidbaker-agent reidbaker-agent commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Phase 2 of 11 of the AGP public-API migration; stacked on #1.

Phase P1 of the AGP public-API migration (flutter#180137,
flutter#166550):

  • VersionFetcher no longer calls the internal
    com.android.build.gradle.internal.utils.getKotlinAndroidPluginVersion.
    getKGPVersion now relies on the existing public fallback chain
    (kotlin_version property -> KotlinAndroidPluginWrapper.pluginVersion ->
    reflection) and documents that null is the expected result when KGP is
    absent (e.g. under AGP built-in Kotlin). DependencyVersionChecker
    already treats null as "KGP not required".
  • AgpCommonExtensionWrapper gains compileSdkPreview.
  • getCompileSdkFromProject now reads compileSdk/compileSdkPreview from
    the new DSL via the wrapper and returns a structured CompileSdkVersion
    instead of parsing the legacy "android-NN" string. The PluginHandler
    compileSdk mismatch warning uses CompileSdkVersion.isHigherThan, which
    defines the preview semantics the old string comparison got wrong
    (resolves the PluginHandler TODO): preview > numeric, distinct preview
    codenames incomparable (no warning), numeric compared numerically.
    Warning message text is unchanged.
  • getConfiguredNdkVersion reads through the wrapper instead of the
    legacy BaseExtension fallback.
  • Deletes the setAgpKotlinVersionToNull test helper (existed only to
    stub the internal AGP call) and updates unit tests accordingly; adds
    tests for both preview-vs-numeric directions and the codename reset
    case.

Verification note: the FGP unit test suite could not be executed in this
sandbox (the network policy blocks dl.google.com, so AGP artifacts do
not resolve); run 'gradle test' in packages/flutter_tools/gradle in CI.

Revert-safe until P2 lands.

CI must run the FGP unit tests (the Kotlin suite in packages/flutter_tools/gradle could not run in the delivery sandbox: dl.google.com returns 403, so AGP artifacts do not resolve).

…k/ndk reads to the public DSL

Phase P1 of the AGP public-API migration (flutter#180137,
flutter#166550):

- VersionFetcher no longer calls the internal
  com.android.build.gradle.internal.utils.getKotlinAndroidPluginVersion.
  getKGPVersion now relies on the existing public fallback chain
  (kotlin_version property -> KotlinAndroidPluginWrapper.pluginVersion ->
  reflection) and documents that null is the expected result when KGP is
  absent (e.g. under AGP built-in Kotlin). DependencyVersionChecker
  already treats null as "KGP not required".
- AgpCommonExtensionWrapper gains compileSdkPreview.
- getCompileSdkFromProject now reads compileSdk/compileSdkPreview from
  the new DSL via the wrapper and returns a structured CompileSdkVersion
  instead of parsing the legacy "android-NN" string. The PluginHandler
  compileSdk mismatch warning uses CompileSdkVersion.isHigherThan, which
  defines the preview semantics the old string comparison got wrong
  (resolves the PluginHandler TODO): preview > numeric, distinct preview
  codenames incomparable (no warning), numeric compared numerically.
  Warning message text is unchanged.
- getConfiguredNdkVersion reads through the wrapper instead of the
  legacy BaseExtension fallback.
- Deletes the setAgpKotlinVersionToNull test helper (existed only to
  stub the internal AGP call) and updates unit tests accordingly; adds
  tests for both preview-vs-numeric directions and the codename reset
  case.

Verification note: the FGP unit test suite could not be executed in this
sandbox (the network policy blocks dl.google.com, so AGP artifacts do
not resolve); run 'gradle test' in packages/flutter_tools/gradle in CI.

Revert-safe until P2 lands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants