mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-06 08:00:10 +08:00
Enable parallel compilation for all Kotlin modules
This commit is contained in:
parent
bb8cd86daa
commit
67a9724143
@ -43,6 +43,12 @@ fun Project.preConfigureJvmTarget() {
|
||||
kotlinOptions.languageVersion = "1.6"
|
||||
kotlinOptions.jvmTarget = defaultVer.toString()
|
||||
kotlinOptions.freeCompilerArgs += "-Xjvm-default=all"
|
||||
|
||||
// Support for parallel compilation: https://youtrack.jetbrains.com/issue/KT-46085
|
||||
// Using /2 processors: jvm and android targets are compiled at the same time, sharing the processors.
|
||||
// Also reserved 2 processors for Gradle multi-tasking
|
||||
// On Apple M1 Max parallelism reduces compilation time by 1/3.
|
||||
kotlinOptions.freeCompilerArgs += "-Xbackend-threads=" + (Runtime.getRuntime().availableProcessors() / 2 - 1).coerceAtLeast(1)
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile::class.java) {
|
||||
|
Loading…
Reference in New Issue
Block a user