62 lines
2.4 KiB
Groovy
62 lines
2.4 KiB
Groovy
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
rootProject.layout.buildDirectory = file('../build')
|
|
subprojects {
|
|
project.layout.buildDirectory = rootProject.layout.buildDirectory.dir(project.name)
|
|
}
|
|
// AGP 9 enables built-in Kotlin, but Flutter's migrator pins
|
|
// android.builtInKotlin=false while the plugin ecosystem catches up. Most
|
|
// plugins honour that flag and fall back to KGP themselves; file_picker and
|
|
// background_downloader only check the AGP major version and silently skip
|
|
// applying KGP, which leaves their Kotlin sources uncompiled (missing
|
|
// FilePickerPlugin/BackgroundDownloaderPlugin at link time). Apply KGP for
|
|
// them as soon as AGP is on the project, i.e. before their android {} block
|
|
// runs. Drop this once both plugins ship a builtInKotlin-aware build script.
|
|
gradle.beforeProject { sub ->
|
|
if (!(sub.name in ['file_picker', 'background_downloader'])) return
|
|
sub.plugins.withId('com.android.library') {
|
|
sub.pluginManager.apply('org.jetbrains.kotlin.android')
|
|
}
|
|
}
|
|
|
|
// Pin every Android subproject to JVM 17 so plugins that ship Kotlin sources
|
|
// compiled with a higher target (e.g. receive_sharing_intent at 21) or stale
|
|
// Java compatibility (e.g. home_widget at 1.8) don't break the build under
|
|
// newer Gradle/Kotlin tooling. Registered before evaluationDependsOn so the
|
|
// afterEvaluate fires at the right point in the lifecycle.
|
|
subprojects { sub ->
|
|
sub.afterEvaluate {
|
|
if (sub.hasProperty('android')) {
|
|
sub.android {
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
// Some plugins (e.g. app_settings) hard-pin an older compileSdk
|
|
// than their transitive AndroidX deps require, which fails the
|
|
// AAR metadata check. Align every plugin with the app's
|
|
// compileSdk (flutter.compileSdkVersion) so the build passes.
|
|
compileSdkVersion 36
|
|
}
|
|
}
|
|
sub.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
kotlinOptions {
|
|
jvmTarget = '17'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
project.evaluationDependsOn(':app')
|
|
}
|
|
|
|
tasks.register("clean", Delete) {
|
|
delete rootProject.layout.buildDirectory
|
|
}
|