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