Skip to content

Commit

Permalink
Kotlin 1.9 (#357)
Browse files Browse the repository at this point in the history
* Updates to run with the new Kotlin 1.9-RC version

* Kotlin gradle plugin adds stdlib automatically

* We dont need to freeze() anymore

* Update to Kotlin 1.9.0

Also update yarn.lock, remove deprecated targets and some other cleanup

---------

Co-authored-by: Paul Hawke <[email protected]>
  • Loading branch information
russhwolf and psh authored Jul 21, 2023
1 parent 84a15f1 commit afddc6f
Show file tree
Hide file tree
Showing 29 changed files with 342 additions and 406 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: build
#on: workflow_dispatch
on:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
Expand Down
9 changes: 4 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ buildscript {

plugins {
kotlin("multiplatform") apply false
id("com.android.library") version "7.3.1" apply false
id("com.android.library") version "7.4.2" apply false
id("com.github.gmazzo.buildconfig") version "2.1.0" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.12.1"
id("org.jetbrains.dokka") version "1.7.20" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
id("org.jetbrains.dokka") version "1.8.20" apply false
id("co.touchlab.touchlabtools.docusaurusosstemplate") version "0.1.10"
}
apiValidation {
Expand All @@ -48,8 +48,7 @@ allprojects {
allprojects {
apply(plugin = "org.jetbrains.dokka")
repositories {
mavenLocal()
mavenCentral()
google()
}
}
}
3 changes: 1 addition & 2 deletions extensions/kermit-bugsnag/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins {

apply(from = "../../gradle/configure-crash-logger.gradle")
kotlin {
android {
androidTarget {
publishAllLibraryVariants()
}

Expand All @@ -30,7 +30,6 @@ kotlin {

val androidMain by sourceSets.getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions extensions/kermit-crashlytics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
apply(from = "../../gradle/configure-crash-logger.gradle")

kotlin {
android {
androidTarget {
publishAllLibraryVariants()
}

Expand All @@ -31,7 +31,6 @@ kotlin {

val androidMain by sourceSets.getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions extensions/kermit-koin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ plugins {
}

kotlin {
android {
androidTarget {
publishAllLibraryVariants()
}
jvm()
js(BOTH) {
js {
browser()
nodejs()
}
Expand All @@ -30,7 +30,6 @@ kotlin {
macosArm64()
iosX64()
iosArm64()
iosArm32()
iosSimulatorArm64()
watchosArm32()
watchosArm64()
Expand All @@ -45,7 +44,6 @@ kotlin {
mingwX64()

// TODO: These targets aren't supported by Koin yet:
// mingwX86()
// androidNativeArm32()
// androidNativeArm64()
// androidNativeX86()
Expand Down
7 changes: 3 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ org.gradle.jvmargs=-Xmx2g
SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true
GROUP=co.touchlab
VERSION_NAME=2.0.0-RC4
KOTLIN_VERSION=1.8.10
VERSION_NAME=2.0.0-RC5
KOTLIN_VERSION=1.9.0

POM_NAME=Kermit
POM_DESCRIPTION=Kermit The Log
Expand All @@ -24,5 +24,4 @@ POM_DEVELOPER_NAME=Kevin Galligan
POM_DEVELOPER_ORG=Touchlab
POM_DEVELOPER_URL=https://touchlab.co/

kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.commonizerLogLevel=info
kotlin.js.ir.output.granularity=whole-program
8 changes: 0 additions & 8 deletions gradle/configure-crash-logger.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ kotlin {
macosArm64(),
iosX64(),
iosArm64(),
// iosArm32(),
iosSimulatorArm64(),
tvosArm64(),
tvosSimulatorArm64(),
Expand All @@ -36,7 +35,6 @@ kotlin {
watchosArm64(),
watchosSimulatorArm64(),
watchosDeviceArm64(),
// watchosX86(),
watchosX64()
].forEach { target ->
// target.compilations.main.cinterops.create(project.name) {
Expand All @@ -53,11 +51,5 @@ kotlin {

commonMain.dependencies {
implementation project(":kermit-core")
implementation "org.jetbrains.kotlin:kotlin-stdlib-common"
}

commonTest.dependencies {
implementation "org.jetbrains.kotlin:kotlin-test-common"
implementation "org.jetbrains.kotlin:kotlin-test-annotations-common"
}
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ targetSdk = "33"
compileSdk = "33"

# Dependencies
kotlin = "1.8.0"
binaryCompatability = "0.11.0"
kotlin = "1.9.0"
binaryCompatability = "0.13.2"

androidx-core = "1.8.0"
androidx-appcompat = "1.5.1"
Expand Down
1 change: 1 addition & 0 deletions kermit-core/api/android/kermit-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public final class co/touchlab/kermit/Severity : java/lang/Enum {
public static final field Info Lco/touchlab/kermit/Severity;
public static final field Verbose Lco/touchlab/kermit/Severity;
public static final field Warn Lco/touchlab/kermit/Severity;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lco/touchlab/kermit/Severity;
public static fun values ()[Lco/touchlab/kermit/Severity;
}
Expand Down
1 change: 1 addition & 0 deletions kermit-core/api/jvm/kermit-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public final class co/touchlab/kermit/Severity : java/lang/Enum {
public static final field Info Lco/touchlab/kermit/Severity;
public static final field Verbose Lco/touchlab/kermit/Severity;
public static final field Warn Lco/touchlab/kermit/Severity;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lco/touchlab/kermit/Severity;
public static fun values ()[Lco/touchlab/kermit/Severity;
}
Expand Down
14 changes: 4 additions & 10 deletions kermit-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ plugins {
}

kotlin {
android {
androidTarget {
publishAllLibraryVariants()
}
jvm()
js(BOTH) {
js {
browser()
nodejs()
}
Expand All @@ -30,23 +30,18 @@ kotlin {
macosArm64()
iosX64()
iosArm64()
iosArm32()
iosSimulatorArm64()
watchosArm32()
watchosArm64()
watchosSimulatorArm64()
watchosDeviceArm64()
watchosX86()
watchosX64()
tvosArm64()
tvosSimulatorArm64()
tvosX64()

mingwX64()
mingwX86()
linuxX64()
linuxArm32Hfp()
linuxMips32()

androidNativeArm32()
androidNativeArm64()
Expand Down Expand Up @@ -75,7 +70,7 @@ kotlin {
val androidMain by sourceSets.getting {
dependsOn(commonJvmMain)
}
val androidTest by sourceSets.getting {
val androidUnitTest by sourceSets.getting {
dependsOn(androidMain)
dependsOn(commonJvmTest)
}
Expand Down Expand Up @@ -136,7 +131,7 @@ kotlin {
implementation(libs.testhelp)
}

androidTest.dependencies {
androidUnitTest.dependencies {
implementation("org.jetbrains.kotlin:kotlin-test")
implementation("org.jetbrains.kotlin:kotlin-test-junit")
implementation("androidx.test:runner:1.4.0")
Expand All @@ -154,7 +149,6 @@ kotlin {
}

jsMain.dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
}

jsTest.dependencies {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

package co.touchlab.kermit

import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.ptr
import platform.darwin.OS_LOG_DEFAULT
import platform.darwin.OS_LOG_TYPE_DEBUG
Expand All @@ -19,6 +20,7 @@ import platform.darwin.OS_LOG_TYPE_FAULT
import platform.darwin.OS_LOG_TYPE_INFO
import platform.darwin.__dso_handle
import platform.darwin._os_log_internal
import kotlin.experimental.ExperimentalNativeApi

/**
* Write log statements to darwin oslog.
Expand Down Expand Up @@ -49,6 +51,7 @@ open class OSLogWriter internal constructor(
}
}

@OptIn(ExperimentalNativeApi::class)
open fun logThrowable(osLogSeverity: UByte, throwable: Throwable){
darwinLogger.log(osLogSeverity, throwable.getStackTrace().joinToString("\n"))
}
Expand All @@ -71,6 +74,7 @@ internal interface DarwinLogger {
}

private object DarwinLoggerActual : DarwinLogger {
@OptIn(ExperimentalForeignApi::class)
override fun log(osLogSeverity: UByte, message: String) {
_os_log_internal(
__dso_handle.ptr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

package co.touchlab.kermit

import kotlin.experimental.ExperimentalNativeApi

/**
* Development-focused LogWriter. Will write a colored emoji according to Severity, and write the Throwable stack trace
* to println rather than oslog, as oslog will cut off long strings.
Expand All @@ -18,6 +20,7 @@ open class XcodeSeverityWriter(private val messageStringFormatter: MessageString
override fun formatMessage(severity: Severity, tag: Tag, message: Message): String =
"${emojiPrefix(severity)} ${messageStringFormatter.formatMessage(null, tag, message)}"

@OptIn(ExperimentalNativeApi::class)
override fun logThrowable(osLogSeverity: UByte, throwable: Throwable) {
// oslog cuts off longer strings, so for local development, println is more useful
println(throwable.getStackTrace().joinToString("\n"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@

package co.touchlab.kermit

import kotlin.native.concurrent.AtomicReference
import kotlin.native.concurrent.freeze
import kotlin.concurrent.AtomicReference

internal class AtomicMutableLoggerConfig(logWriters: List<LogWriter>) : MutableLoggerConfig {
private val _minSeverity = AtomicReference(DEFAULT_MIN_SEVERITY)
private val _loggerList = AtomicReference(logWriters.freeze())
private val _loggerList = AtomicReference(logWriters)

override var minSeverity: Severity
get() = _minSeverity.value
set(value) {
_minSeverity.value = value.freeze()
_minSeverity.value = value
}
override var logWriterList: List<LogWriter>
get() = _loggerList.value
set(value) {
_loggerList.value = value.freeze()
_loggerList.value = value
}
}

actual fun mutableLoggerConfigInit(logWriters: List<LogWriter>): MutableLoggerConfig = AtomicMutableLoggerConfig(logWriters)
actual fun mutableLoggerConfigInit(logWriters: List<LogWriter>): MutableLoggerConfig = AtomicMutableLoggerConfig(logWriters)
Loading

0 comments on commit afddc6f

Please sign in to comment.