1
1
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
2
2
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
3
+ import org.jetbrains.kotlin.konan.target.HostManager
3
4
4
5
val bigNumVersion: String by project
5
6
val kotlinCoroutinesVersion: String by project
@@ -11,7 +12,7 @@ plugins {
11
12
id(" maven-publish" )
12
13
}
13
14
14
- group = " com .github.domgew"
15
+ group = " io .github.domgew"
15
16
version = " 0.0.1"
16
17
17
18
kotlin {
@@ -57,6 +58,45 @@ publishing {
57
58
}
58
59
}
59
60
61
+ // smartPublish as per https://github.com/Dominaezzz/kotlin-sqlite/blob/master/build.gradle.kts
62
+ afterEvaluate {
63
+ val publishTasks = tasks.withType<PublishToMavenRepository >()
64
+ .matching {
65
+ when {
66
+ HostManager .hostIsMingw ->
67
+ it.name.startsWith(" publishMingw" )
68
+
69
+ HostManager .hostIsMac ->
70
+ it.name.startsWith(" publishMacos" )
71
+
72
+ HostManager .hostIsLinux ->
73
+ it.name.startsWith(" publishLinux" )
74
+ || it.name.startsWith(" publishJs" )
75
+ || it.name.startsWith(" publishJvmPublication" )
76
+ || it.name.startsWith(" publishMetadata" )
77
+ || it.name.startsWith(" publishKotlinMultiplatform" )
78
+
79
+ else -> throw Exception (" unknown host" )
80
+ }
81
+ }
82
+
83
+ // println("#####################################")
84
+ // println("overallPublishTasks:")
85
+ // for (task in tasks.withType<PublishToMavenRepository>()) {
86
+ // println("\t${task.name}")
87
+ // }
88
+ // println()
89
+ // println("platformPublishTasks:")
90
+ // for (task in publishTasks) {
91
+ // println("\t${task.name}")
92
+ // }
93
+ // println("#####################################")
94
+
95
+ tasks.register(" smartPublish" ) {
96
+ dependsOn(publishTasks)
97
+ }
98
+ }
99
+
60
100
fun KotlinMultiplatformExtension.addNativeTargets (
61
101
block : KotlinNativeTarget .() -> Unit ,
62
102
) {
0 commit comments