45 lines
1.3 KiB
Kotlin
45 lines
1.3 KiB
Kotlin
import com.android.build.gradle.BaseExtension
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
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)
|
|
|
|
// tflite_flutter compiles Java as 11 and leaves Kotlin on the toolchain
|
|
// default (25 with Kotlin 2.4). Align both before evaluationDependsOn
|
|
// forces projects to evaluate.
|
|
afterEvaluate {
|
|
if (name == "app") {
|
|
return@afterEvaluate
|
|
}
|
|
extensions.findByType(BaseExtension::class.java)?.compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
tasks.withType<KotlinCompile>().configureEach {
|
|
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
|
|
}
|
|
}
|
|
}
|
|
subprojects {
|
|
project.evaluationDependsOn(":app")
|
|
}
|
|
|
|
tasks.register<Delete>("clean") {
|
|
delete(rootProject.layout.buildDirectory)
|
|
}
|