diff --git a/buildSrc/src/main/kotlin/HmppConfigure.kt b/buildSrc/src/main/kotlin/HmppConfigure.kt index 3c6e71ba3..b15fe8a6e 100644 --- a/buildSrc/src/main/kotlin/HmppConfigure.kt +++ b/buildSrc/src/main/kotlin/HmppConfigure.kt @@ -156,6 +156,10 @@ private val POSSIBLE_NATIVE_TARGETS by lazy { setOf("mingwX64", "macosX64", "mac const val JVM_TOOLCHAIN_VERSION = 8 +val JVM_TOOLCHAIN_ENABLED by projectLazy { + rootProject.getLocalProperty("mirai.enable.jvmtoolchain.special", true) +} + /** * ## Android Test 结构 * @@ -166,8 +170,10 @@ const val JVM_TOOLCHAIN_VERSION = 8 */ fun Project.configureJvmTargetsHierarchical(androidNamespace: String) { extensions.getByType(KotlinMultiplatformExtension::class.java).apply { - jvmToolchain(JVM_TOOLCHAIN_VERSION) - + if (JVM_TOOLCHAIN_ENABLED) { + jvmToolchain(JVM_TOOLCHAIN_VERSION) + } + val commonMain by sourceSets.getting val commonTest by sourceSets.getting diff --git a/docs/contributing/README.md b/docs/contributing/README.md index b07f6bc68..e0bbc6314 100644 --- a/docs/contributing/README.md +++ b/docs/contributing/README.md @@ -163,6 +163,8 @@ projects.module-path.enabled=false projects.mirai-console.enabled=false # 特殊配置,关闭 mirai-logging,这会关闭所有日志转接模块 projects.mirai-logging.enabled=false +# 特殊配置,是否取消指定 jvmToolchain,在本地 jvmTest 中需要访问 JDK 9+ 的内容时需要携带此配置 +mirai.enable.jvmtoolchain.special=false ``` 通常关闭 IDEA 插件和 Gradle 插件可以显著提高初始化速度(IDEA 插件项目在初始化时需要下载 1G 左右编译依赖)。