Skip to content

Commit 8810c1f

Browse files
committed
Replace resources library with okio and re-add web targets
1 parent af82252 commit 8810c1f

File tree

10 files changed

+55
-8
lines changed

10 files changed

+55
-8
lines changed

build-logic/convention/src/main/kotlin/io/github/elcolto/geokjson/convention/Multiplatform.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.gradle.kotlin.dsl.getValue
77
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
88
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
99
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
10+
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
1011

1112
@OptIn(ExperimentalKotlinGradlePluginApi::class)
1213
internal fun Project.configureKotlinMultiplatform(
@@ -28,6 +29,18 @@ internal fun Project.configureKotlinMultiplatform(
2829
}
2930
}
3031

32+
js(IR) {
33+
browser()
34+
nodejs()
35+
}
36+
37+
@OptIn(ExperimentalWasmDsl::class)
38+
wasmJs {
39+
browser()
40+
nodejs()
41+
}
42+
43+
3144

3245
val iosArm64 = iosArm64()
3346
val iosX64 = iosX64()

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
[versions]
22
kotlin = "2.0.0"
3-
resources = "0.4.1"
43
benchmark = "0.4.11"
54
agp = "8.4.1"
65
ktlint = "12.1.1"
76
detekt = "1.23.6"
87
binary-validator = "0.15.0-Beta.2"
98
kover = "0.8.0"
9+
okio = "3.9.0"
1010

1111
[libraries]
12-
resources = { module = "com.goncalossilva:resources", version.ref = "resources" }
1312
kotlinx-serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0"
1413
kotlinx-benchmark = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "benchmark" }
1514
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }
@@ -18,14 +17,15 @@ ktlint-gradle-plugin = { module = "org.jlleitschuh.gradle.ktlint:org.jlleitschuh
1817
detekt-gradle-plugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
1918
binary-validator-plugin = { module = "org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin", version.ref = "binary-validator" }
2019
kover-gradle-plugin = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kover" }
20+
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
21+
okio-nodefilesystem = { module = "com.squareup.okio:okio-nodefilesystem", version.ref = "okio" }
2122

2223
[plugins]
2324
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
2425
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
2526
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "benchmark" }
2627
publish = { id = "com.vanniktech.maven.publish", version = "0.28.0" }
2728
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
28-
resources = { id = "com.goncalossilva.resources", version.ref = "resources" }
2929
android-library = { id = "com.android.library", version.ref = "agp" }
3030
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
3131
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }

turf/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
22

33
plugins {
44
id("io.github.elcolto.geokjson.library")
5-
alias(libs.plugins.resources)
65
}
76

87
kotlin {
@@ -16,10 +15,14 @@ kotlin {
1615

1716
val commonTest by getting {
1817
dependencies {
19-
implementation(libs.resources)
18+
implementation(libs.okio)
19+
}
20+
}
21+
val jsTest by getting {
22+
dependencies {
23+
implementation(libs.okio.nodefilesystem)
2024
}
2125
}
22-
2326
}
2427
}
2528

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.github.elcolto.geokjson.turf.utils
2+
3+
import okio.FileSystem
4+
5+
actual val FILE_SYSTEM: FileSystem = FileSystem.SYSTEM
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.github.elcolto.geokjson.turf.utils
2+
3+
import okio.FileSystem
4+
5+
expect val FILE_SYSTEM: FileSystem
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.github.elcolto.geokjson.turf.utils
22

3-
import com.goncalossilva.resources.Resource
3+
import okio.Path.Companion.toPath
44

55
const val RESOURCE_PATH = "./src/commonTest/resources"
66

7-
fun readResource(name: String) = Resource("$RESOURCE_PATH/$name").readText()
7+
fun readResource(name: String) = FILE_SYSTEM.read("$RESOURCE_PATH/$name".toPath()) { readUtf8() }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package io.github.elcolto.geokjson.turf.utils
2+
3+
import okio.FileSystem
4+
import okio.NodeJsFileSystem
5+
6+
actual val FILE_SYSTEM: FileSystem = NodeJsFileSystem
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.github.elcolto.geokjson.turf.utils
2+
3+
import okio.FileSystem
4+
5+
actual val FILE_SYSTEM: FileSystem = FileSystem.SYSTEM
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.github.elcolto.geokjson.turf.utils
2+
3+
import okio.FileSystem
4+
5+
actual val FILE_SYSTEM: FileSystem = FileSystem.SYSTEM
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.github.elcolto.geokjson.turf.utils
2+
3+
import okio.FileSystem
4+
5+
actual val FILE_SYSTEM: FileSystem = TODO("Not yet stable on Okio")

0 commit comments

Comments
 (0)