Skip to content

Commit 24e3c84

Browse files
authored
Update to kotlinx-datetime:0.7.0 and fix binary incompatible changes. (#1645)
* Update to kotlinx-datetime:0.7.0 and fix binary incompatible changes. * Update API and add secondary constructor.
1 parent 9db5ee3 commit 24e3c84

File tree

15 files changed

+29
-19
lines changed

15 files changed

+29
-19
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jmh-gradle-plugin = { module = "me.champeau.jmh:jmh-gradle-plugin", version = "0
1818
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
1919
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" }
2020
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit" }
21-
kotlin-time = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version = "0.6.2" }
21+
kotlin-time = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version = "0.7.0" }
2222
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "7.0.4" }
2323
test-assertj = { module = "org.assertj:assertj-core", version = "3.27.3" }
2424
test-assertk = "com.willowtreeapps.assertk:assertk:0.28.1"

okio-fakefilesystem/api/okio-fakefilesystem.api

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
public final class okio/fakefilesystem/FakeFileSystem : okio/FileSystem {
2-
public final field clock Lkotlinx/datetime/Clock;
2+
public final field clock Lkotlin/time/Clock;
33
public fun <init> ()V
4-
public fun <init> (Lkotlinx/datetime/Clock;)V
5-
public synthetic fun <init> (Lkotlinx/datetime/Clock;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
4+
public fun <init> (Lkotlin/time/Clock;)V
5+
public synthetic fun <init> (Lkotlin/time/Clock;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
66
public final fun allPaths ()Ljava/util/Set;
77
public fun appendingSink (Lokio/Path;Z)Lokio/Sink;
88
public fun atomicMove (Lokio/Path;Lokio/Path;)V

okio-fakefilesystem/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ kotlin {
3535
configureOrCreateNativePlatforms()
3636
}
3737
sourceSets {
38+
all {
39+
languageSettings.apply {
40+
optIn("kotlin.time.ExperimentalTime")
41+
}
42+
}
3843
val commonMain by getting {
3944
dependencies {
4045
api(libs.kotlin.time)

okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ package okio.fakefilesystem
1818
import kotlin.jvm.JvmField
1919
import kotlin.jvm.JvmName
2020
import kotlin.reflect.KClass
21-
import kotlinx.datetime.Clock
22-
import kotlinx.datetime.Instant
21+
import kotlin.time.Clock
22+
import kotlin.time.Instant
2323
import okio.ArrayIndexOutOfBoundsException
2424
import okio.Buffer
2525
import okio.ByteString
@@ -71,6 +71,9 @@ class FakeFileSystem(
7171
val clock: Clock = Clock.System,
7272
) : FileSystem() {
7373

74+
// Avoid propagating 'ExperimentalTime' if 'clock' is not specified.
75+
constructor() : this(Clock.System)
76+
7477
/** File system roots. Each element is a Directory and is created on-demand. */
7578
private val roots = mutableMapOf<Path, Directory>()
7679

okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FileMetadataCommon.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package okio.fakefilesystem
1919

2020
import kotlin.jvm.JvmName
2121
import kotlin.reflect.KClass
22-
import kotlinx.datetime.Instant
22+
import kotlin.time.Instant
2323
import okio.FileMetadata
2424
import okio.Path
2525

okio-nodefilesystem/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ kotlin {
2525
}
2626
}
2727
sourceSets {
28-
all {
29-
languageSettings.optIn("kotlin.RequiresOptIn")
30-
}
3128
matching { it.name.endsWith("Test") }.all {
3229
languageSettings {
3330
optIn("kotlin.time.ExperimentalTime")

okio-nodefilesystem/src/commonTest/kotlin/okio/NodeJsFileSystemTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package okio
1717

18-
import kotlinx.datetime.Clock
18+
import kotlin.time.Clock
1919

2020
class NodeJsFileSystemTest : AbstractFileSystemTest(
2121
clock = Clock.System,

okio-testing-support/src/nonWasmMain/kotlin/okio/TestingNonWasm.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ package okio
1717

1818
import okio.fakefilesystem.FakeFileSystem
1919

20-
actual typealias Clock = kotlinx.datetime.Clock
20+
actual typealias Clock = kotlin.time.Clock
2121

22-
actual typealias Instant = kotlinx.datetime.Instant
22+
actual typealias Instant = kotlin.time.Instant
2323

2424
actual fun fromEpochSeconds(
2525
epochSeconds: Long,

okio/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ kotlin {
6363
optIn("kotlin.contracts.ExperimentalContracts")
6464
}
6565
}
66+
matching { it.name.endsWith("Test") }.all {
67+
languageSettings {
68+
optIn("kotlin.time.ExperimentalTime")
69+
}
70+
}
6671

6772
val commonMain by getting
6873
val commonTest by getting {

okio/src/jvmTest/kotlin/okio/FileHandleFileSystemTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package okio
1818
import com.google.common.jimfs.Configuration
1919
import com.google.common.jimfs.Jimfs
2020
import java.nio.file.FileSystems
21-
import kotlinx.datetime.Clock
21+
import kotlin.time.Clock
2222
import okio.FileHandleFileSystemTest.FileHandleTestingFileSystem
2323
import okio.FileSystem.Companion.asOkioFileSystem
2424

0 commit comments

Comments
 (0)