Skip to content

Commit

Permalink
Support Kotlin 1.4 (#92)
Browse files Browse the repository at this point in the history
* Build with Kotlin 1.4-M2

* Remove workarounds that should no longer be needed

* Update to Kotlin 1.4-M3

* Revert removal of IDEA hack

* Enable MPP compatibility mode

* Prepare for 0.2.3-1.4-M3 release

* Restore AtomicFU runtime dependency

* Work around Kotlin 1.4 compiler error

* Prepare for 0.2.4-1.4-M3 release

* Prepare for next release

* Bump Kotlin to 1.4.0-rc

* Prepare for 0.2.4-1.4-rc release

* Prepare for next release

* Remove "-1.4-rc" from SNAPSHOT version
  • Loading branch information
erikc5000 authored Aug 5, 2020
1 parent 88b4795 commit 1616551
Show file tree
Hide file tree
Showing 27 changed files with 181 additions and 124 deletions.
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0-rc")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1")
implementation("com.android.tools.build:gradle:4.0.1")
}
Expand Down
12 changes: 5 additions & 7 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Versions {
const val kotlin = "1.3.72"
const val serialization = "0.20.0"
const val atomicfu = "0.14.2"
const val kotlin = "1.4.0-rc"
const val serialization = "1.0-M1-1.4.0-rc"
const val atomicfu = "0.14.3-1.4.0-rc"
const val androidxTest = "1.2.0"
const val googleTruth = "1.0.1"
const val kotlinpoet = "1.6.0"
Expand All @@ -10,14 +10,12 @@ object Versions {

object Libs {
object Serialization {
const val common = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:${Versions.serialization}"
const val jvm = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Versions.serialization}"
const val native = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:${Versions.serialization}"
const val runtime = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Versions.serialization}"
}

object AtomicFU {
const val gradlePlugin = "org.jetbrains.kotlinx:atomicfu-gradle-plugin:${Versions.atomicfu}"
const val native = "org.jetbrains.kotlinx:atomicfu-native:${Versions.atomicfu}"
const val runtime = "org.jetbrains.kotlinx:atomicfu:${Versions.atomicfu}"
}

object AndroidxTest {
Expand Down
6 changes: 0 additions & 6 deletions buildSrc/src/main/kotlin/multiplatform-library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ kotlin {
}
}
}

// Workaround for https://youtrack.jetbrains.com/issue/KT-36721
targets.withType<KotlinNativeTarget>().configureEach {
val moduleName = "${project.group}.${project.name}"
compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-module-name", moduleName)
}
}

val emptySourcesJar by tasks.registering(Jar::class) {
Expand Down
12 changes: 1 addition & 11 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ kotlin {
sourceSets {
val commonMain by getting {
kotlin.srcDirs("src/commonMain/generated")

dependencies {
implementation(kotlin("stdlib-common"))
}
}

val commonTest by getting {
Expand All @@ -27,12 +23,6 @@ kotlin {
}
}

val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
}
}

val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
Expand All @@ -43,7 +33,7 @@ kotlin {

val darwinMain by getting {
dependencies {
implementation(Libs.AtomicFU.native)
implementation(Libs.AtomicFU.runtime)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private class DarwinTimeZoneRules(timeZone: NSTimeZone) : TimeZoneRules {
val offsetAfter = offsetAt(nextTransition)
val dateTimeBefore = nextTransition.toIslandDateTimeAt(offsetBefore)

this += DarwinTimeZoneOffsetTransition(dateTimeBefore, offsetBefore, offsetAfter)
add(DarwinTimeZoneOffsetTransition(dateTimeBefore, offsetBefore, offsetAfter))

currentDate = nextTransition
nextTransition = timeZone.nextDaylightSavingTimeTransitionAfterDate(currentDate)
Expand Down
1 change: 0 additions & 1 deletion extensions/parcelize/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dependencies {
coreLibraryDesugaring(Libs.androidDesugarJdkLibs)

implementation(project(":core"))
implementation(kotlin("stdlib-jdk8"))

androidTestImplementation(Libs.AndroidxTest.runner)
androidTestImplementation(Libs.googleTruth)
Expand Down
16 changes: 1 addition & 15 deletions extensions/serialization/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ kotlin {
val commonMain by getting {
dependencies {
implementation(project(":core"))
implementation(kotlin("stdlib-common"))
implementation(Libs.Serialization.common)
implementation(Libs.Serialization.runtime)
}
}

Expand All @@ -20,24 +19,11 @@ kotlin {
}
}

val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(Libs.Serialization.jvm)
}
}

val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}

val darwinMain by getting {
dependencies {
implementation(Libs.Serialization.native)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.Date
import io.islandtime.toDate
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object DateSerializer : KSerializer<Date> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.DateSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.DateSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: Date) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.DateTime
import io.islandtime.toDateTime
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object DateTimeSerializer : KSerializer<DateTime> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.DateTimeSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.DateTimeSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: DateTime) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.Instant
import io.islandtime.toInstant
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object InstantSerializer : KSerializer<Instant> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.InstantSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.InstantSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: Instant) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.OffsetDateTime
import io.islandtime.toOffsetDateTime
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object OffsetDateTimeSerializer : KSerializer<OffsetDateTime> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.OffsetDateTimeSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.OffsetDateTimeSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: OffsetDateTime) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.OffsetTime
import io.islandtime.toOffsetTime
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object OffsetTimeSerializer : KSerializer<OffsetTime> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.OffsetTimeSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.OffsetTimeSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: OffsetTime) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.Time
import io.islandtime.toTime
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object TimeSerializer : KSerializer<Time> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.TimeSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.TimeSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: Time) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package io.islandtime.extensions.serialization

import io.islandtime.TimeZone
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object TimeZoneSerializer : KSerializer<TimeZone> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.TimeZoneSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.TimeZoneSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: TimeZone) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.YearMonth
import io.islandtime.toYearMonth
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object YearMonthSerializer : KSerializer<YearMonth> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.YearMonthSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.YearMonthSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: YearMonth) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization

import io.islandtime.ZonedDateTime
import io.islandtime.toZonedDateTime
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object ZonedDateTimeSerializer : KSerializer<ZonedDateTime> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.ZonedDateTimeSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.ZonedDateTimeSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: ZonedDateTime) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package io.islandtime.extensions.serialization.measures

import io.islandtime.measures.*
import kotlinx.serialization.*
import io.islandtime.measures.Duration
import io.islandtime.measures.toDuration
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object DurationSerializer : KSerializer<Duration> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.measures.DurationSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.measures.DurationSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: Duration) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package io.islandtime.extensions.serialization.measures

import io.islandtime.measures.*
import kotlinx.serialization.*
import io.islandtime.measures.Period
import io.islandtime.measures.toPeriod
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object PeriodSerializer : KSerializer<Period> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.measures.PeriodSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.measures.PeriodSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: Period) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization.ranges

import io.islandtime.ranges.DateRange
import io.islandtime.ranges.toDateRange
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object DateRangeSerializer : KSerializer<DateRange> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.ranges.DateRangeSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.ranges.DateRangeSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: DateRange) {
encoder.encodeString(value.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package io.islandtime.extensions.serialization.ranges

import io.islandtime.ranges.DateTimeInterval
import io.islandtime.ranges.toDateTimeInterval
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder

object DateTimeIntervalSerializer : KSerializer<DateTimeInterval> {
override val descriptor: SerialDescriptor =
PrimitiveDescriptor("io.islandtime.ranges.DateTimeIntervalSerializer", PrimitiveKind.STRING)
PrimitiveSerialDescriptor("io.islandtime.ranges.DateTimeIntervalSerializer", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: DateTimeInterval) {
encoder.encodeString(value.toString())
Expand Down
Loading

0 comments on commit 1616551

Please sign in to comment.