|
@@ -8,10 +8,10 @@
|
|
|
*/
|
|
|
|
|
|
import com.google.gradle.osdetector.OsDetector
|
|
|
-import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
import org.gradle.api.Project
|
|
|
import org.gradle.api.attributes.Attribute
|
|
|
import org.gradle.kotlin.dsl.get
|
|
|
+import org.gradle.kotlin.dsl.getByName
|
|
|
import org.gradle.kotlin.dsl.getting
|
|
|
import org.gradle.kotlin.dsl.withType
|
|
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
|
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
|
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation
|
|
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
|
|
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
|
|
+import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
|
|
|
import java.io.File
|
|
|
|
|
|
private val miraiPlatform = Attribute.of(
|
|
@@ -299,6 +300,42 @@ fun KotlinMultiplatformExtension.configureNativeTargetsHierarchical(
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+// NATIVE_TARGETS.forEach { targetName ->
|
|
|
+// val target = targets.getByName(targetName) as KotlinNativeTarget
|
|
|
+// if (!IDEA_ACTIVE && HOST_KIND == HostKind.WINDOWS) {
|
|
|
+// target.binaries.test(listOf(NativeBuildType.RELEASE)) {
|
|
|
+// // add release test to run on CI
|
|
|
+// project.afterEvaluate {
|
|
|
+// // use linkReleaseTestMingwX64 for mingwX64Test to save memory
|
|
|
+// tasks.getByName("mingwX64Test", KotlinNativeTest::class)
|
|
|
+// .executable(linkTask) { linkTask.binary.outputFile }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ NATIVE_TARGETS.forEach { targetName ->
|
|
|
+ val target = targets.getByName(targetName) as KotlinNativeTarget
|
|
|
+ target.binaries {
|
|
|
+ sharedLib(listOf(NativeBuildType.DEBUG, NativeBuildType.RELEASE)) {
|
|
|
+ baseName = project.name.toLowerCase().replace("-", "")
|
|
|
+ }
|
|
|
+ staticLib(listOf(NativeBuildType.DEBUG, NativeBuildType.RELEASE)) {
|
|
|
+ baseName = project.name.toLowerCase().replace("-", "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!IDEA_ACTIVE && HOST_KIND == HostKind.WINDOWS && targetName == "mingwX64") {
|
|
|
+ target.binaries.test(listOf(NativeBuildType.RELEASE)) {
|
|
|
+ // add release test to run on CI
|
|
|
+ project.afterEvaluate {
|
|
|
+ // use linkReleaseTestMingwX64 for mingwX64Test to save memory
|
|
|
+ tasks.getByName("mingwX64Test", KotlinNativeTest::class)
|
|
|
+ .executable(linkTask) { linkTask.binary.outputFile }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
jvmBaseMain.dependsOn(commonMain)
|
|
|
jvmBaseTest.dependsOn(commonTest)
|
|
|
|
|
@@ -336,6 +373,11 @@ fun Project.disableCrossCompile() {
|
|
|
|
|
|
private fun disableTargetLink(project: Project, target: String) {
|
|
|
project.tasks.getByName("linkDebugTest${target.titlecase()}").enabled = false
|
|
|
+ project.tasks.findByName("linkReleaseTest${target.titlecase()}")?.enabled = false
|
|
|
+ project.tasks.findByName("linkDebugShared${target.titlecase()}")?.enabled = false
|
|
|
+ project.tasks.findByName("linkReleaseShared${target.titlecase()}")?.enabled = false
|
|
|
+ project.tasks.findByName("linkDebugStatic${target.titlecase()}")?.enabled = false
|
|
|
+ project.tasks.findByName("linkReleaseStatic${target.titlecase()}")?.enabled = false
|
|
|
project.tasks.getByName("${target}Test").enabled = false
|
|
|
}
|
|
|
|