Repository navigation
Conversation
…P fallback silent pdfx 2.10.0 (ScerIO#624) guards the Kotlin Gradle Plugin on `android.builtInKotlin`, but defaults to `false` when the property is unset. On AGP 9 built-in Kotlin is on by default, so an app that never sets the property still gets KGP applied and the build fails with "The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0". The textual `apply plugin: 'kotlin-android'` also trips Flutter's static KGP check, so pdfx shows up in the "plugins that apply KGP" warning even when the guard skips it. - Derive the mode from the AGP major: built-in Kotlin only exists on AGP 9+, where it is on unless `android.builtInKotlin=false` is set explicitly. The property is checked for presence, not truthiness. - Apply KGP through `pluginManager.apply(...)` so Flutter's text match does not flag the plugin. - Set `jvmTarget` for the built-in path through `kotlin.compilerOptions` (the KGP path keeps `kotlinOptions`), so both paths target Java 11 like `compileOptions`. Closes ScerIO#615.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #624 (pdfx 2.10.0, "Supported AGP 9 built-in Kotlin"). Three gaps remain in
packages/pdfx/android/build.gradle:android.builtInKotlintofalsewhen the property is unset. On AGP 9 built-in Kotlin is on by default, so an app that never sets the property still getskotlin-androidapplied and fails withandroid.builtInKotlin=true(orfalse, taking the KGP path) build today.apply plugin: 'kotlin-android', so pdfx is listed even when the guard skips the line. Flutter has said this guarded form will stop building once that check is tightened ([AGP 9] KGP warning lists already-migrated plugins: detectApplyingKotlinGradlePlugin regex-matches guarded 'apply plugin: kotlin-android' lines flutter/flutter#189770).jvmTargeton the built-in path.kotlinOptionsis skipped in built-in mode but nothing sets the Kotlin target there, whilecompileOptionsis Java 11.Fixes #615.
How
false. The property is checked for presence, not truthiness, sofalseis honoured and the AGP 8 behaviour is unchanged whatever the property says.pluginManager.apply(...)keeps Flutter's text check from flagging the plugin.kotlinOptions { jvmTarget = '11' }stays on the KGP path;kotlin { compilerOptions { jvmTarget = JVM_11 } }is added for the built-in path.Truth table (Gradle 9.3.1 / Groovy 4.0.29, AGP major injected)
android.builtInKotlinkotlinOptionscompilerOptions(Row 4 is the case that fails on 2.11.0.)
Real builds (Flutter 3.47.9)
builtInKotlin=truepackages/pdfx/example(AGP/KGP/Gradle bumped locally,kotlin-androidremoved from the app module)BUILD SUCCESSFUL,:pdfx:compileDebugKotlinran, no KGP warningbuiltInKotlin=falsedependency_overridespackages/pdfx/exampleBUILD SUCCESSFUL,:pdfx:compileDebugKotlinran, no KGP warning. Needed--android-skip-build-dependency-validation, Gradle 8.14.3 and a 4 GB heap only because Flutter 3.47 rejects the example's AGP 8.5.2 / Gradle 8.10.2 and its 1.5 GBjvmargsis too small for Jetifier; none of that is related to this changeThe example app is left untouched here; it will need the AGP/Gradle bumps above when it moves to AGP 9.
🤖 Generated with Claude Code