Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ out/

# Gradle files
.gradle/
.kotlin/
build/

# Local configuration file (sdk path, etc)
Expand Down
1 change: 0 additions & 1 deletion bugsnag-ios-link/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

plugins {
`kotlin-dsl`
kotlin("jvm")
id("java-gradle-plugin")
id("com.vanniktech.maven.publish.base")
id("com.gradle.plugin-publish")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ private fun KotlinMultiplatformExtension.crashLinkerConfig(linkerOpts: String) {
val hasDynamicFrameworks = binaries.any { it is Framework && !it.isStatic }

if (hasDynamicFrameworks) {
compilations.getByName("main").kotlinOptions.freeCompilerArgs += listOf("-linker-options", linkerOpts)
compilations.getByName("main").compileTaskProvider.configure {
compilerOptions.freeCompilerArgs.addAll("-linker-options", linkerOpts)
}
}
}
}
5 changes: 0 additions & 5 deletions bugsnag/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* the License.
*/
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.library")
Expand Down Expand Up @@ -106,7 +105,3 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ package co.touchlab.crashkios.bugsnag
import com.bugsnag.android.Bugsnag

actual class BugsnagCallsActual : BugsnagCalls {
override fun logMessage(message: String) {
actual override fun logMessage(message: String) {
Bugsnag.leaveBreadcrumb(message)
}

override fun sendHandledException(throwable: Throwable) {
actual override fun sendHandledException(throwable: Throwable) {
Bugsnag.notify(throwable)
}

override fun sendFatalException(throwable: Throwable) {
actual override fun sendFatalException(throwable: Throwable) {
Bugsnag.notify(throwable)
}

override fun setCustomValue(section: String, key: String, value: Any) {
actual override fun setCustomValue(section: String, key: String, value: Any) {
Bugsnag.addMetadata(section, key, value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import kotlinx.cinterop.ExperimentalForeignApi

@OptIn(ExperimentalForeignApi::class)
actual class BugsnagCallsActual : BugsnagCalls {
override fun logMessage(message: String) {
actual override fun logMessage(message: String) {
Bugsnag.leaveBreadcrumbWithMessage(message)
}

override fun sendHandledException(throwable: Throwable) {
actual override fun sendHandledException(throwable: Throwable) {
sendException(throwable, true)
}

override fun sendFatalException(throwable: Throwable) {
actual override fun sendFatalException(throwable: Throwable) {
sendException(throwable, false)
}

override fun setCustomValue(section: String, key: String, value: Any) {
actual override fun setCustomValue(section: String, key: String, value: Any) {
Bugsnag.addMetadata(value, key, section)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ interface BugsnagCalls {
fun setCustomValue(section: String, key: String, value: Any)
}

expect class BugsnagCallsActual() : BugsnagCalls
expect class BugsnagCallsActual() : BugsnagCalls {
override fun logMessage(message: String)
override fun sendHandledException(throwable: Throwable)
override fun sendFatalException(throwable: Throwable)
override fun setCustomValue(section: String, key: String, value: Any)
}
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.maven.publish) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.touchlab.docusaurus.template)
alias(libs.plugins.gradle.publish) apply false
id("org.jlleitschuh.gradle.ktlint") version "12.2.0" apply false
}
Expand Down Expand Up @@ -31,4 +30,4 @@ subprojects {
dependsOn(tasks.getByName("ktlintCheck"))
}
}
}
}
5 changes: 0 additions & 5 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* the License.
*/
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.library")
Expand Down Expand Up @@ -79,8 +78,4 @@ android {
}
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

apply(plugin = "com.vanniktech.maven.publish")
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package co.touchlab.crashkios.core

import kotlin.concurrent.AtomicReference
import kotlin.experimental.ExperimentalNativeApi
import kotlin.native.concurrent.freeze
import kotlin.reflect.KProperty

@OptIn(FreezingIsDeprecated::class, ExperimentalNativeApi::class)
actual class ThreadSafeVar<T> actual constructor(target: T) {
private val atom = AtomicReference(target)

actual operator fun getValue(thisRef: Any?, property: KProperty<*>): T = atom.value

actual operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
if (Platform.memoryModel == MemoryModel.STRICT) {
value.freeze()
}
atom.value = value
}
}
1 change: 0 additions & 1 deletion crashlytics-ios-link/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
plugins {
`kotlin-dsl`
kotlin("jvm")
id("java-gradle-plugin")
id("com.vanniktech.maven.publish.base")
id("com.gradle.plugin-publish")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ private fun KotlinMultiplatformExtension.crashLinkerConfig(linkerOpts: String) {
val hasDynamicFrameworks = binaries.any { it is Framework && !it.isStatic }

if (hasDynamicFrameworks) {
compilations.getByName("main").kotlinOptions.freeCompilerArgs += listOf("-linker-options", linkerOpts)
compilations.getByName("main").compileTaskProvider.configure {
compilerOptions.freeCompilerArgs.addAll("-linker-options", linkerOpts)
}
}
}
}
5 changes: 0 additions & 5 deletions crashlytics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* the License.
*/
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.library")
Expand Down Expand Up @@ -104,7 +103,3 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ package co.touchlab.crashkios.crashlytics
import com.google.firebase.crashlytics.FirebaseCrashlytics

actual class CrashlyticsCallsActual : CrashlyticsCalls {
override fun logMessage(message: String) {
actual override fun logMessage(message: String) {
FirebaseCrashlytics.getInstance().log(message)
}

override fun sendHandledException(throwable: Throwable) {
actual override fun sendHandledException(throwable: Throwable) {
FirebaseCrashlytics.getInstance().recordException(throwable)
}

override fun sendFatalException(throwable: Throwable) {
actual override fun sendFatalException(throwable: Throwable) {
FirebaseCrashlytics.getInstance().recordException(throwable)
}

override fun setCustomValue(key: String, value: Any) {
actual override fun setCustomValue(key: String, value: Any) {
when (value) {
is Boolean -> FirebaseCrashlytics.getInstance().setCustomKey(key, value)
is Double -> FirebaseCrashlytics.getInstance().setCustomKey(key, value)
Expand All @@ -29,7 +29,7 @@ actual class CrashlyticsCallsActual : CrashlyticsCalls {
}
}

override fun setUserId(identifier: String) {
actual override fun setUserId(identifier: String) {
FirebaseCrashlytics.getInstance().setUserId(identifier)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ actual class CrashlyticsCallsActual : CrashlyticsCalls {
FIRCheckLinkDependencies()
}

override fun logMessage(message: String) {
actual override fun logMessage(message: String) {
FIRCrashlyticsLog(message)
}

@OptIn(UnsafeNumber::class)
override fun sendHandledException(throwable: Throwable) {
actual override fun sendHandledException(throwable: Throwable) {
val exceptionClassName = throwable::class.qualifiedName ?: throwable::class.simpleName ?: "kotlin.Throwable"
FIRCrashlyticsRecordHandledException(
exceptionClassName,
Expand All @@ -28,18 +28,18 @@ actual class CrashlyticsCallsActual : CrashlyticsCalls {
)
}

override fun sendFatalException(throwable: Throwable) {
actual override fun sendFatalException(throwable: Throwable) {
val exception = throwable.asNSException(true)
// The recorded exception is persisted, so we can safely terminate afterwards.
// https://github.com/firebase/firebase-ios-sdk/blob/82f163bd86566f83c5d7572a1c2c0024a04eb4dc/Crashlytics/Crashlytics/Handlers/FIRCLSException.mm#L227
tryFIRCLSExceptionRecordNSException(exception)
}

override fun setCustomValue(key: String, value: Any) {
actual override fun setCustomValue(key: String, value: Any) {
FIRCrashlyticsSetCustomValue(key, value)
}

override fun setUserId(identifier: String) {
actual override fun setUserId(identifier: String) {
FIRCrashlyticsSetUserID(identifier)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ interface CrashlyticsCalls {
fun setUserId(identifier: String)
}

expect class CrashlyticsCallsActual() : CrashlyticsCalls
expect class CrashlyticsCallsActual() : CrashlyticsCalls {
override fun logMessage(message: String)
override fun sendHandledException(throwable: Throwable)
override fun sendFatalException(throwable: Throwable)
override fun setCustomValue(key: String, value: Any)
override fun setUserId(identifier: String)
}
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[versions]
## SDK Versions
minSdk = "21"
targetSdk = "34"
compileSdk = "34"
targetSdk = "35"
compileSdk = "35"

# Dependencies
kotlin = "1.9.24"
android-gradle-plugin = "8.2.1"
kotlin = "2.2.10"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are already updating this, is there any reason not to go to a .21 version?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine in this case. The main thing is to keep the 2.x as lower as possible for better compat.

android-gradle-plugin = "8.10.0"
mavenPublish = "0.29.0"
touchlab-docusaurus-template = "0.1.10"
gradlePublish = "1.2.1"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I'm doing on Kermit is already updating to Gradle 9. It may be worth doing the same on other projects to keep them in sync. What do you think?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I can try it out.

networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include(":core")
include(":bugsnag")
include(":bugsnag-ios-link")
include(":crashlytics")
include(":crashlytics-ios-link")
include("bugsnag-ios-link")
include("crashlytics-ios-link")

pluginManagement {
repositories {
Expand All @@ -14,5 +14,5 @@ pluginManagement {
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0")
id("org.gradle.toolchains.foojay-resolver-convention") version ("0.8.0")
}
Loading