1
1
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
2
2
import com.github.benmanes.gradle.versions.updates.gradle.GradleReleaseChannel
3
+ import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
4
+ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
5
+ import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
3
6
4
7
plugins {
8
+ alias(libs.plugins.kotlin.multiplatform)
5
9
alias(libs.plugins.versions)
10
+ `maven- publish`
11
+ signing
6
12
}
7
13
8
14
tasks.withType<DependencyUpdatesTask > {
@@ -14,3 +20,175 @@ tasks.withType<DependencyUpdatesTask> {
14
20
}
15
21
}
16
22
}
23
+
24
+ kotlin {
25
+ explicitApi()
26
+
27
+ jvmToolchain(8 )
28
+
29
+ jvm()
30
+
31
+ js(IR ) {
32
+ browser()
33
+ nodejs()
34
+ }
35
+
36
+ @OptIn(ExperimentalWasmDsl ::class )
37
+ wasmJs {
38
+ binaries.executable()
39
+ nodejs()
40
+ }
41
+
42
+ /* https://kotlinlang.org/docs/native-target-support.html#tier-1 */
43
+
44
+ macosX64()
45
+ macosArm64()
46
+ iosSimulatorArm64()
47
+ iosX64()
48
+
49
+ /* https://kotlinlang.org/docs/native-target-support.html#tier-2 */
50
+
51
+ linuxX64()
52
+ linuxArm64()
53
+
54
+ watchosSimulatorArm64()
55
+ watchosX64()
56
+ watchosArm32()
57
+ watchosArm64()
58
+
59
+ tvosSimulatorArm64()
60
+ tvosX64()
61
+ tvosArm64()
62
+
63
+ iosArm64()
64
+
65
+ /* https://kotlinlang.org/docs/native-target-support.html#tier-3 */
66
+
67
+ androidNativeArm32()
68
+ androidNativeArm64()
69
+ androidNativeX86()
70
+ androidNativeX64()
71
+
72
+ mingwX64()
73
+
74
+ watchosDeviceArm64()
75
+
76
+ sourceSets {
77
+ all {
78
+ languageSettings.apply {
79
+ optIn(" kotlin.contracts.ExperimentalContracts" )
80
+ }
81
+ }
82
+
83
+ commonTest {
84
+ dependencies {
85
+ implementation(kotlin(" test" ))
86
+ }
87
+ }
88
+
89
+ jvmTest {
90
+ dependencies {
91
+ implementation(kotlin(" test-junit" ))
92
+ }
93
+ }
94
+
95
+ jsTest {
96
+ dependencies {
97
+ implementation(kotlin(" test-js" ))
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ tasks.withType<Jar > {
104
+ from(rootDir.resolve(" LICENSE" )) {
105
+ into(" META-INF" )
106
+ }
107
+ }
108
+
109
+ /* https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0 */
110
+ rootProject.the<NodeJsRootExtension >().apply {
111
+ nodeVersion = " 21.0.0-v8-canary202309143a48826a08"
112
+ nodeDownloadBaseUrl = " https://nodejs.org/download/v8-canary"
113
+ }
114
+
115
+ rootProject.tasks.withType<KotlinNpmInstallTask > {
116
+ args.add(" --ignore-engines" )
117
+ }
118
+
119
+ publishing {
120
+ repositories {
121
+ maven {
122
+ if (project.version.toString().endsWith(" SNAPSHOT" )) {
123
+ setUrl(" https://oss.sonatype.org/content/repositories/snapshots" )
124
+ } else {
125
+ setUrl(" https://oss.sonatype.org/service/local/staging/deploy/maven2" )
126
+ }
127
+
128
+ credentials {
129
+ val ossrhUsername: String? by project
130
+ val ossrhPassword: String? by project
131
+
132
+ username = ossrhUsername
133
+ password = ossrhPassword
134
+ }
135
+ }
136
+ }
137
+
138
+ publications.withType<MavenPublication > {
139
+ val targetName = this @withType.name
140
+
141
+ artifact(tasks.register(" ${targetName} JavadocJar" , Jar ::class ) {
142
+ group = LifecycleBasePlugin .BUILD_GROUP
143
+ description = " Assembles a jar archive containing the Javadoc API documentation of target '$targetName '."
144
+ archiveClassifier.set(" javadoc" )
145
+ archiveAppendix.set(targetName)
146
+ })
147
+
148
+ pom {
149
+ name.set(project.name)
150
+ description.set(project.description)
151
+ url.set(" https://github.com/michaelbull/kotlin-itertools" )
152
+ inceptionYear.set(" 2024" )
153
+
154
+ licenses {
155
+ license {
156
+ name.set(" ISC License" )
157
+ url.set(" https://opensource.org/licenses/isc-license.txt" )
158
+ }
159
+ }
160
+
161
+ developers {
162
+ developer {
163
+ name.set(" Michael Bull" )
164
+ url.set(" https://www.michael-bull.com" )
165
+ }
166
+ }
167
+
168
+ scm {
169
+ connection.set(" scm:git:https://github.com/michaelbull/kotlin-itertools" )
170
+ developerConnection.set(
" scm:git:[email protected] :michaelbull/kotlin-itertools.git" )
171
+ url.set(" https://github.com/michaelbull/kotlin-itertools" )
172
+ }
173
+
174
+ issueManagement {
175
+ system.set(" GitHub Issues" )
176
+ url.set(" https://github.com/michaelbull/kotlin-itertools/issues" )
177
+ }
178
+
179
+ ciManagement {
180
+ system.set(" GitHub Actions" )
181
+ url.set(" https://github.com/michaelbull/kotlin-itertools/actions" )
182
+ }
183
+ }
184
+ }
185
+ }
186
+
187
+ signing {
188
+ val signingKeyId: String? by project // must be the last 8 digits of the key
189
+ val signingKey: String? by project
190
+ val signingPassword: String? by project
191
+
192
+ useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
193
+ sign(publishing.publications)
194
+ }
0 commit comments