2
0
Him188 3 жил өмнө
parent
commit
7dbb1a5ad7

+ 33 - 0
.run/Build mirai-core for Host Native.run.xml

@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Build mirai-core for host Native" type="GradleRunConfiguration"
+                   factoryName="Gradle" folderName="Build mirai-core">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core:linkDebugTestHost"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 34 - 0
.run/Build mirai-core libraries for host Native.run.xml

@@ -0,0 +1,34 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Build mirai-core libraries for host Native" type="GradleRunConfiguration"
+                   factoryName="Gradle" folderName="Build mirai-core">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core:linkReleaseSharedHost"/>
+                    <option value=":mirai-core:linkReleaseStaticHost"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 33 - 0
.run/Compile everything.run.xml

@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Compile everything" type="GradleRunConfiguration" factoryName="Gradle"
+                   folderName="Build">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value="assemble"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 33 - 0
.run/Compile mirai-console.run.xml

@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Compile mirai-console" type="GradleRunConfiguration" factoryName="Gradle"
+                   folderName="Build">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-console:assemble"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 38 - 0
.run/Compile mirai-core for JVM.run.xml

@@ -0,0 +1,38 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Compile mirai-core for JVM" type="GradleRunConfiguration" factoryName="Gradle"
+                   folderName="Build mirai-core">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core-utils:compileKotlinJvm"/>
+                    <option value=":mirai-core-utils:compileKotlinAndroid"/>
+                    <option value=":mirai-core-api:compileKotlinJvm"/>
+                    <option value=":mirai-core-api:compileKotlinAndroid"/>
+                    <option value=":mirai-core:compileKotlinJvm"/>
+                    <option value=":mirai-core:compileKotlinAndroid"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 40 - 0
.run/Run Native Main host.run.xml

@@ -0,0 +1,40 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Run Native Main host" type="GradleRunConfiguration" factoryName="Gradle"
+                   folderName="Native Main">
+        <ExternalSystemSettings>
+            <option name="env">
+                <map>
+                    <entry key="mirai.native.test.main" value="true"/>
+                </map>
+            </option>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$/mirai-core"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core:hostTest"/>
+                    <option value="--tests"/>
+                    <option value="&quot;net.mamoe.mirai.internal.test.NativeTestWrapper.test&quot;"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 33 - 0
.run/Test everything.run.xml

@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Test everything" type="GradleRunConfiguration" factoryName="Gradle"
+                   folderName="Build">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value="check"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 36 - 0
.run/Test mirai-console.run.xml

@@ -0,0 +1,36 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Test mirai-console" type="GradleRunConfiguration" factoryName="Gradle"
+                   folderName="Build">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-console:check"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2">
+            <option name="RunConfigurationTask" enabled="true" run_configuration_name="Compile mirai-console"
+                    run_configuration_type="GradleRunConfiguration"/>
+        </method>
+    </configuration>
+</component>

+ 41 - 0
.run/Test mirai-core for JVM.run.xml

@@ -0,0 +1,41 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Test mirai-core for JVM" type="GradleRunConfiguration" factoryName="Gradle"
+                   folderName="Build mirai-core">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core-utils:jvmTest"/>
+                    <option value=":mirai-core-utils:androidTest"/>
+                    <option value=":mirai-core-api:jvmTest"/>
+                    <option value=":mirai-core-api:androidTest"/>
+                    <option value=":mirai-core:jvmTest"/>
+                    <option value=":mirai-core:androidTest"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2">
+            <option name="RunConfigurationTask" enabled="true" run_configuration_name="Compile mirai-core-api for JVM"
+                    run_configuration_type="GradleRunConfiguration"/>
+        </method>
+    </configuration>
+</component>

+ 33 - 0
.run/Test mirai-core for host Native.run.xml

@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Test mirai-core for host Native" type="GradleRunConfiguration"
+                   factoryName="Gradle" folderName="Build mirai-core">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core:hostTest"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 33 - 0
.run/Test mirai-core-api for host Native.run.xml

@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Test mirai-core-api for host Native" type="GradleRunConfiguration"
+                   factoryName="Gradle" folderName="Build mirai-core">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core-api:hostTest"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 33 - 0
.run/Test mirai-core-utils for host Native.run.xml

@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2019-2022 Mamoe Technologies and contributors.
+  ~
+  ~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
+  ~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
+  ~
+  ~ https://github.com/mamoe/mirai/blob/dev/LICENSE
+  -->
+
+<component name="ProjectRunConfigurationManager">
+    <configuration default="false" name="Test mirai-core-utils for host Native" type="GradleRunConfiguration"
+                   factoryName="Gradle" folderName="Build mirai-core">
+        <ExternalSystemSettings>
+            <option name="executionName"/>
+            <option name="externalProjectPath" value="$PROJECT_DIR$"/>
+            <option name="externalSystemIdString" value="GRADLE"/>
+            <option name="scriptParameters" value=""/>
+            <option name="taskDescriptions">
+                <list/>
+            </option>
+            <option name="taskNames">
+                <list>
+                    <option value=":mirai-core-api:hostTest"/>
+                </list>
+            </option>
+            <option name="vmOptions"/>
+        </ExternalSystemSettings>
+        <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+        <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+        <DebugAllEnabled>false</DebugAllEnabled>
+        <method v="2"/>
+    </configuration>
+</component>

+ 67 - 20
buildSrc/src/main/kotlin/HmppConfigure.kt

@@ -38,22 +38,45 @@ val ANDROID_ENABLED = System.getProperty("mirai.enable.android", "true").toBoole
 
 
 val OS_NAME = System.getProperty("os.name").toLowerCase()
 val OS_NAME = System.getProperty("os.name").toLowerCase()
 
 
-enum class HostKind {
-    LINUX, WINDOWS, MACOS,
+lateinit var osDetector: OsDetector
+
+// aarch = arm
+val OsDetector.isAarch
+    get() = osDetector.arch.run {
+        contains("aarch", ignoreCase = true) || contains("arm", ignoreCase = true)
+    }
+
+@Suppress("ClassName")
+sealed class HostKind(
+    val targetName: String
+) {
+    object LINUX : HostKind("linuxX64")
+    object WINDOWS : HostKind("windowsX64")
+
+    abstract class MACOS(targetName: String) : HostKind(targetName)
+
+    object MACOS_X64 : MACOS("macosX64")
+    object MACOS_ARM64 : MACOS("macosArm64")
 }
 }
 
 
-val HOST_KIND = when {
-    OS_NAME.contains("windows", true) -> HostKind.WINDOWS
-    OS_NAME.contains("mac", true) -> HostKind.MACOS
-    else -> HostKind.LINUX
+val HOST_KIND by lazy {
+    when {
+        OS_NAME.contains("windows", true) -> HostKind.WINDOWS
+        OS_NAME.contains("mac", true) -> {
+            if (osDetector.isAarch) {
+                HostKind.MACOS_ARM64
+            } else {
+                HostKind.MACOS_X64
+            }
+        }
+        else -> HostKind.LINUX
+    }
 }
 }
 
 
 enum class HostArch {
 enum class HostArch {
     X86, X64, ARM32, ARM64
     X86, X64, ARM32, ARM64
 }
 }
 
 
-lateinit var osDetector: OsDetector
-
 val MAC_TARGETS: Set<String> by lazy {
 val MAC_TARGETS: Set<String> by lazy {
     if (!IDEA_ACTIVE) setOf(
     if (!IDEA_ACTIVE) setOf(
 //        "watchosX86",
 //        "watchosX86",
@@ -78,7 +101,7 @@ val MAC_TARGETS: Set<String> by lazy {
 //        "tvosSimulatorArm64",
 //        "tvosSimulatorArm64",
     ) else setOf(
     ) else setOf(
         // IDEA active, reduce load
         // IDEA active, reduce load
-        if (osDetector.arch.contains("aarch")) "macosArm64" else "macosX64"
+        HOST_KIND.targetName
     )
     )
 }
 }
 
 
@@ -90,16 +113,8 @@ val UNIX_LIKE_TARGETS by lazy { LINUX_TARGETS + MAC_TARGETS }
 
 
 val NATIVE_TARGETS by lazy { UNIX_LIKE_TARGETS + WIN_TARGETS }
 val NATIVE_TARGETS by lazy { UNIX_LIKE_TARGETS + WIN_TARGETS }
 
 
-val HOST_NATIVE_TARGET by lazy {
-    when (HOST_KIND) {
-        HostKind.LINUX -> "linuxX64"
-        HostKind.MACOS -> if (osDetector.arch.contains("aarch")) "macosArm64" else "macosX64"
-        HostKind.WINDOWS -> "mingwX64"
-    }
-}
-
 
 
-fun Project.configureHMPPJvm() {
+fun Project.configureJvmTargetsHierarchical() {
     extensions.getByType(KotlinMultiplatformExtension::class.java).apply {
     extensions.getByType(KotlinMultiplatformExtension::class.java).apply {
         jvm("jvmBase") {
         jvm("jvmBase") {
             compilations.all {
             compilations.all {
@@ -336,6 +351,39 @@ fun KotlinMultiplatformExtension.configureNativeTargetsHierarchical(
         }
         }
     }
     }
 
 
+    // Register platform tasks, e.g. linkDebugSharedHost
+    project.afterEvaluate {
+        val targetName = HOST_KIND.targetName
+        val targetNameCapitalized = targetName.capitalize()
+        project.tasks.run {
+            listOf(
+                "compileKotlin",
+                "linkDebugTest",
+                "linkReleaseTest",
+                "linkDebugShared",
+                "linkReleaseShared",
+                "linkDebugStatic",
+                "linkReleaseStatic",
+            ).forEach { name ->
+                findByName("$name$targetNameCapitalized")?.let { plat ->
+                    register("${name}Host") {
+                        group = "mirai"
+                        description = "Run ${plat.name} which can be run on the current Host."
+                        dependsOn(plat)
+                    }
+                }
+            }
+
+            findByName("${targetName}Test")?.let { plat ->
+                register("hostTest") {
+                    group = "mirai"
+                    description = "Run ${plat.name} which can be run on the current Host."
+                    dependsOn(plat)
+                }
+            }
+        }
+    }
+
     jvmBaseMain.dependsOn(commonMain)
     jvmBaseMain.dependsOn(commonMain)
     jvmBaseTest.dependsOn(commonTest)
     jvmBaseTest.dependsOn(commonTest)
 
 
@@ -359,7 +407,7 @@ fun KotlinMultiplatformExtension.configureNativeTargetsHierarchical(
 // e.g. Linker will try to link curl for mingwX64 but this can't be done on macOS.
 // e.g. Linker will try to link curl for mingwX64 but this can't be done on macOS.
 fun Project.disableCrossCompile() {
 fun Project.disableCrossCompile() {
     project.afterEvaluate {
     project.afterEvaluate {
-        if (HOST_KIND != HostKind.MACOS) {
+        if (HOST_KIND !is HostKind.MACOS) {
             MAC_TARGETS.forEach { target -> disableTargetLink(this, target) }
             MAC_TARGETS.forEach { target -> disableTargetLink(this, target) }
         }
         }
         if (HOST_KIND != HostKind.WINDOWS) {
         if (HOST_KIND != HostKind.WINDOWS) {
@@ -408,7 +456,6 @@ private fun Project.configureNativeInterop(
 
 
     if (nativeInteropDir.exists() && nativeInteropDir.isDirectory && nativeInteropDir.resolve("build.rs").exists()) {
     if (nativeInteropDir.exists() && nativeInteropDir.isDirectory && nativeInteropDir.resolve("build.rs").exists()) {
         val kotlinDylibName = project.name.replace("-", "_") + "_i"
         val kotlinDylibName = project.name.replace("-", "_") + "_i"
-        val kotlinDylibName = project.name.replace("-", "_")
 
 
         val headerName = "$crateName.h"
         val headerName = "$crateName.h"
         val rustLibDir = nativeInteropDir.resolve("target/debug/")
         val rustLibDir = nativeInteropDir.resolve("target/debug/")

+ 1 - 1
mirai-console/tools/compiler-annotations/build.gradle.kts

@@ -20,7 +20,7 @@ description = "Mirai Console compiler annotations"
 kotlin {
 kotlin {
     explicitApi()
     explicitApi()
 
 
-    configureHMPP()
+    configureJvmTargetsHierarchical()
     configureNativeTargetsHierarchical(project)
     configureNativeTargetsHierarchical(project)
 }
 }
 
 

+ 1 - 1
mirai-core-api/build.gradle.kts

@@ -26,7 +26,7 @@ description = "Mirai API module"
 
 
 kotlin {
 kotlin {
     explicitApi()
     explicitApi()
-    configureHMPP()
+    configureJvmTargetsHierarchical()
 
 
     configureNativeTargetsHierarchical(project)
     configureNativeTargetsHierarchical(project)
 
 

+ 1 - 1
mirai-core-utils/build.gradle.kts

@@ -23,7 +23,7 @@ description = "mirai-core utilities"
 kotlin {
 kotlin {
     explicitApi()
     explicitApi()
 
 
-    configureHMPP()
+    configureJvmTargetsHierarchical()
     configureNativeTargetsHierarchical(project)
     configureNativeTargetsHierarchical(project)
 
 
     sourceSets {
     sourceSets {

+ 1 - 1
mirai-core/build.gradle.kts

@@ -27,7 +27,7 @@ description = "Mirai Protocol implementation for QQ Android"
 kotlin {
 kotlin {
     explicitApi()
     explicitApi()
 
 
-    configureHMPP()
+    configureJvmTargetsHierarchical()
     configureNativeTargetsHierarchical(project)
     configureNativeTargetsHierarchical(project)
 
 
     sourceSets.apply {
     sourceSets.apply {