stage2
This commit is contained in:
@@ -12,6 +12,32 @@ 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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user