mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-26 04:00:42 +08:00
parent
6d16d77dad
commit
6b571e163d
@ -83,6 +83,7 @@ allprojects {
|
||||
google()
|
||||
}
|
||||
|
||||
preConfigureJvmTarget()
|
||||
afterEvaluate {
|
||||
configureJvmTarget()
|
||||
configureMppShadow()
|
||||
|
@ -28,8 +28,16 @@ fun Project.useIr() {
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.configureJvmTarget() {
|
||||
val defaultVer = JavaVersion.VERSION_1_8
|
||||
private fun Project.jvmVersion(): JavaVersion {
|
||||
return if (project.path.endsWith("mirai-console-intellij")) {
|
||||
JavaVersion.VERSION_11
|
||||
} else {
|
||||
JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.preConfigureJvmTarget() {
|
||||
val defaultVer = jvmVersion()
|
||||
|
||||
tasks.withType(KotlinJvmCompile::class.java) {
|
||||
kotlinOptions.languageVersion = "1.6"
|
||||
@ -37,6 +45,14 @@ fun Project.configureJvmTarget() {
|
||||
kotlinOptions.freeCompilerArgs += "-Xjvm-default=all"
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile::class.java) {
|
||||
sourceCompatibility = defaultVer.toString()
|
||||
targetCompatibility = defaultVer.toString()
|
||||
}
|
||||
}
|
||||
fun Project.configureJvmTarget() {
|
||||
val defaultVer = jvmVersion()
|
||||
|
||||
tasks.withType(KotlinJvmCompile::class)
|
||||
.filter { it.name.startsWith("compileTestKotlin") }
|
||||
.forEach { task ->
|
||||
@ -46,11 +62,6 @@ fun Project.configureJvmTarget() {
|
||||
extensions.findByType(JavaPluginExtension::class.java)?.run {
|
||||
sourceCompatibility = defaultVer
|
||||
targetCompatibility = defaultVer
|
||||
|
||||
if (project.path.endsWith("mirai-console-intellij")) {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
||||
|
||||
kotlinTargets.orEmpty().filterIsInstance<KotlinJvmTarget>().forEach { target ->
|
||||
|
Loading…
Reference in New Issue
Block a user