73 lines
2.0 KiB
Groovy
73 lines
2.0 KiB
Groovy
buildscript {
|
|
ext.kotlin_version = '2.2.20'
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
|
|
configurations.all {
|
|
resolutionStrategy {
|
|
cacheDynamicVersionsFor 2, 'minutes'
|
|
}
|
|
}
|
|
}
|
|
|
|
rootProject.buildDir = '../build'
|
|
subprojects {
|
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
|
}
|
|
subprojects {
|
|
project.evaluationDependsOn(':app')
|
|
}
|
|
|
|
gradle.beforeProject { proj ->
|
|
proj.afterEvaluate {
|
|
if (proj.plugins.hasPlugin("com.android.library")) {
|
|
try {
|
|
if (!proj.android.namespace) {
|
|
def manifestFile = proj.file("src/main/AndroidManifest.xml")
|
|
if (manifestFile.exists()) {
|
|
def manifest = new groovy.xml.XmlSlurper().parse(manifestFile)
|
|
def packageName = manifest.'@package'?.toString()
|
|
if (packageName) {
|
|
proj.android.namespace = packageName
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception ignored) {}
|
|
}
|
|
// Force Java 17 for all Android subprojects to match global Kotlin JVM target 17
|
|
if (proj.plugins.hasPlugin("com.android.library") || proj.plugins.hasPlugin("com.android.application")) {
|
|
try {
|
|
proj.android.compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
} catch (Exception ignored) {}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register("clean", Delete) {
|
|
delete rootProject.layout.buildDirectory
|
|
}
|
|
|
|
allprojects {
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
}
|
|
}
|