Skip to content

Commit b79545e

Browse files
committed
upgrade to Kotlin 2.1.20-Beta1, library upgrades
1 parent 7793e5c commit b79545e

File tree

5 files changed

+48
-69
lines changed

5 files changed

+48
-69
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ local.properties
1111
.gradle
1212
build
1313
kotlin-js-store
14+
15+
node_modules
16+
kotlin-js-store
17+
18+
yarn.lock

build.gradle.kts

Lines changed: 31 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
import io.gitlab.arturbosch.detekt.Detekt
2-
import kotlinx.kover.gradle.plugin.dsl.KoverReportExtension
3-
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
4-
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
5-
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin.Companion.kotlinNodeJsExtension
1+
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
2+
3+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
4+
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin.Companion.kotlinNodeJsEnvSpec
65
import org.jetbrains.kotlin.gradle.targets.js.yarn.yarn
76
import java.util.*
87

98
plugins {
10-
val kotlinVersion = "2.0.20-Beta1"
11-
kotlin("multiplatform") version kotlinVersion
12-
//id("dev.petuska.npm.publish") version "2.1.1"
13-
id("io.gitlab.arturbosch.detekt").version("1.23.0-RC2")
14-
id("org.jetbrains.dokka") version "1.9.0"
15-
id("org.jetbrains.kotlinx.kover") version "0.7.3"
9+
alias(libs.plugins.kotlin.multiplatform)
10+
alias(libs.plugins.detekt)
11+
alias(libs.plugins.dokka)
12+
alias(libs.plugins.kover)
1613
id("maven-publish")
1714
id("signing")
1815
}
1916

2017
val defaultGroupId = "cz.sazel.sqldelight"
21-
val versionBase = "0.3.0"
18+
val versionBase = "0.4.0"
2219

2320
val localProperties = Properties().apply {
2421
try {
@@ -58,6 +55,7 @@ kotlin {
5855

5956
useCommonJs()
6057
nodejs {
58+
version = libs.versions.node.js.get()
6159
testTask {
6260
// debug=true
6361
}
@@ -88,25 +86,25 @@ kotlin {
8886
}
8987
}
9088
val jsTest by getting {
91-
extensions.configure<KoverReportExtension> {
92-
defaults {
93-
html {
94-
onCheck = true
95-
}
96-
}
97-
}
89+
9890
}
9991

10092
val publicationsFromMainHost =
10193
listOf(js()).map { it.name } + "kotlinMultiplatform"
10294

103-
val javadocJar = tasks.register<Jar>("javadocJar") {
104-
dependsOn(tasks.dokkaHtml)
105-
archiveClassifier.set("javadoc")
106-
from("$buildDir/dokka")
95+
dokka {
96+
moduleName = "node-sqlite3-driver"
97+
moduleVersion = versionStr
98+
99+
dokkaSourceSets {
100+
val jsMain by getting {
101+
102+
}
103+
}
107104
}
108105

109106
publishing {
107+
110108
publications {
111109
matching { it.name in publicationsFromMainHost }.all {
112110
val targetPublication = this@all
@@ -117,7 +115,7 @@ kotlin {
117115

118116

119117
withType<MavenPublication> {
120-
artifact(javadocJar)
118+
artifact(layout.buildDirectory.dir("dokka"))
121119

122120
pom {
123121
name.set("node-sqlite3-driver")
@@ -176,7 +174,7 @@ kotlin {
176174
}
177175
}
178176

179-
extensions.configure<SigningExtension> {
177+
signing {
180178
useInMemoryPgpKeys(
181179
System.getenv("GPG_KEY_SECRET") ?: localProperties["gpg.keySecret"] as String?,
182180
System.getenv("GPG_KEY_PASSWORD") ?: localProperties["gpg.keyPassword"] as String?
@@ -185,28 +183,6 @@ kotlin {
185183
sign(publishing.publications)
186184
}
187185
}
188-
189-
190-
191-
plugins.withType<NodeJsRootPlugin> {
192-
configure<NodeJsRootExtension> {
193-
version = "18.14.2"
194-
}
195-
}
196-
197-
// npmPublishing {
198-
// organization = "wojta"
199-
// access = RESTRICTED
200-
//
201-
// repositories {
202-
// repository("npmjs") {
203-
// registry = uri("https://npm.pkg.github.com") // Registry to publish to
204-
// authToken = localProperties["github.token"] as String?
205-
// ?: System.getenv("GITHUB_TOKEN")// NPM registry authentication token
206-
// }
207-
// }
208-
// }
209-
210186
}
211187

212188
// workaround for missing sqlite3 bindings
@@ -215,18 +191,17 @@ val bindingsInstall = tasks.register("sqlite3BindingsInstall") {
215191

216192
}
217193
doLast {
218-
val sqlite3moduleDir = buildDir.resolve("js/node_modules/sqlite3")
219-
if (!sqlite3moduleDir.resolve("lib/binding").exists()) {
194+
val sqlite3moduleDir = layout.buildDirectory.get().dir("js/node_modules/sqlite3").asFile
195+
if (!sqlite3moduleDir.resolve("build").exists()) {
220196
exec {
221197
workingDir = sqlite3moduleDir
222-
val yarnPath="${yarn.yarnSetupTaskProvider.get().destination.absolutePath}/bin"
223-
val nodePath="${kotlinNodeJsExtension.nodeJsSetupTaskProvider.get().destination.absolutePath}/bin"
198+
val yarnExecutable = yarn.environment.executable
199+
val yarnPath = file(yarnExecutable).parent
200+
val nodePath = file(kotlinNodeJsEnvSpec.executable).parent
224201
environment(
225-
"PATH",
226-
System.getenv("PATH") + ":$yarnPath:$nodePath"
202+
"PATH", System.getenv("PATH") + ":$yarnPath:$nodePath"
227203
)
228-
var commandLine = "$yarnPath/yarn"
229-
commandLine(commandLine)
204+
commandLine(yarnExecutable)
230205
}
231206
}
232207
}
@@ -238,10 +213,9 @@ detekt {
238213
allRules = false // activate all available (even unstable) rules.
239214
config.setFrom("$projectDir/gradle/detekt/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
240215
// baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt
241-
}
242216

243-
tasks.withType<Detekt>().configureEach {
244217
reports {
245218
html.required.set(true) // observe findings in your browser with structure and code snippets
246219
}
247220
}
221+

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
kotlin.code.style=official
22
kotlin.js.generate.executable.default=false
3+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

gradle/libs.versions.toml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
[versions]
2-
kotlin = "2.0.20-Beta1"
3-
kotlinCoroutines = "1.9.0-RC"
4-
schemaCrawler = "16.19.2"
5-
stately = "1.2.3"
6-
node-sqlite3 = "5.1.6"
2+
detekt = "1.23.7"
3+
dokka = "2.0.0"
4+
kotlin = "2.1.20-Beta1"
5+
kotlinCoroutines = "1.10.1"
6+
kover = "0.9.1"
7+
node-sqlite3 = "5.1.7"
8+
node-js = "18.14.2"
79
sqldelight = "2.0.2"
810

911
[libraries]
10-
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
11-
kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" }
1212
kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinCoroutines" }
1313
kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinCoroutines" }
14-
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
15-
stately-core = { module = "co.touchlab:stately-common", version.ref = "stately" }
16-
stately-concurrency = { module = "co.touchlab:stately-concurrency", version.ref = "stately" }
17-
stately-collections = { module = "co.touchlab:stately-collections", version.ref = "stately" }
1814
sqldelight-async-extensions-js = { module = "app.cash.sqldelight:async-extensions-js", version.ref = "sqldelight" }
1915
sqldelight-runtime-js = { module = "app.cash.sqldelight:runtime-js", version.ref = "sqldelight" }
2016

2117
[plugins]
18+
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
19+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
2220
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
2321
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
22+
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)