48 lines
1.7 KiB
Kotlin
48 lines
1.7 KiB
Kotlin
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
|
|
rootProject.layout.buildDirectory.value(newBuildDir)
|
|
|
|
subprojects {
|
|
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
|
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
|
}
|
|
// Plugins such as tflite_flutter set a Java target but no Kotlin target, so on a
|
|
// newer JDK Kotlin picks a default that fails Gradle's JVM target validation.
|
|
// Keep each module's Kotlin target in line with its own Java target.
|
|
subprojects {
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
val javaTaskName = name.replace("Kotlin", "JavaWithJavac")
|
|
val projectTasks = project.tasks
|
|
compilerOptions.jvmTarget.set(
|
|
project.provider {
|
|
(projectTasks.findByName(javaTaskName) as? JavaCompile)
|
|
?.targetCompatibility
|
|
?.let { org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(it) }
|
|
},
|
|
)
|
|
}
|
|
}
|
|
// Older plugins such as tflite_flutter pin a low compileSdk, which fails the AAR
|
|
// metadata check against current AndroidX. compileSdk only affects which APIs a
|
|
// module compiles against, not runtime behavior, so raise it for those modules.
|
|
subprojects {
|
|
afterEvaluate {
|
|
extensions.findByType<com.android.build.gradle.LibraryExtension>()?.let { android ->
|
|
if ((android.compileSdk ?: 0) < 36) android.compileSdk = 36
|
|
}
|
|
}
|
|
}
|
|
subprojects {
|
|
project.evaluationDependsOn(":app")
|
|
}
|
|
|
|
tasks.register<Delete>("clean") {
|
|
delete(rootProject.layout.buildDirectory)
|
|
}
|