Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3d0f8f1
Update Kotlin and Compose version
buenaflor May 16, 2025
5938aac
Missing newline
buenaflor May 16, 2025
39775b7
Update
buenaflor May 16, 2025
ef0aa9c
Update deprecations
buenaflor May 16, 2025
8db72ee
Merge branch 'main' into deps/upgrade-kotlin
buenaflor Jun 25, 2025
530cdf0
Fix K2 compiler issue
buenaflor Jun 27, 2025
305871a
Formatting
buenaflor Jun 27, 2025
cd22321
Fix test
buenaflor Jun 27, 2025
c893986
Update
buenaflor Jun 27, 2025
c856bd6
Update
buenaflor Jun 27, 2025
1e18595
Formatting
buenaflor Jun 27, 2025
23b0ea4
Formatting
buenaflor Jun 27, 2025
e0b6d23
Fix Java 11 config
buenaflor Jun 27, 2025
eecc548
Bump test lib versions
buenaflor Jun 27, 2025
2115539
Versions
buenaflor Jun 27, 2025
1f1a4f6
Java config
buenaflor Jun 27, 2025
e611075
Update
buenaflor Jun 27, 2025
9d5ba95
Merge branch 'main' into deps/upgrade-kotlin
buenaflor Jun 27, 2025
f8c356c
Enable debug temporarily
buenaflor Jun 27, 2025
43ee73a
Revert
buenaflor Jun 27, 2025
0223f5c
Update
buenaflor Jun 27, 2025
fdf6fea
Update
buenaflor Jun 27, 2025
e9c65fd
Update
buenaflor Jun 27, 2025
a5e2d88
Line end
buenaflor Jun 28, 2025
2b5af1f
Formatting
buenaflor Jun 28, 2025
c835f21
Merge branch 'main' into deps/upgrade-kotlin
buenaflor Jun 30, 2025
e0f9abe
Merge branch 'main' into deps/upgrade-kotlin
buenaflor Jul 1, 2025
31e24c6
Add toolchain to java block
buenaflor Jul 4, 2025
0cbb440
Update CHANGELOG
buenaflor Jul 4, 2025
06243bf
Add JavaScript (JS) target support for Sentry Kotlin Multiplatform SDK
cursoragent Jul 15, 2025
737dade
Update publication
buenaflor Jul 16, 2025
06a6695
Update
buenaflor Jul 17, 2025
17c1920
Update
buenaflor Jul 17, 2025
d523c68
Update
buenaflor Jul 17, 2025
b1d21e5
Update
buenaflor Jul 17, 2025
4c6b9c3
Update
buenaflor Jul 17, 2025
d48b16d
Let CI run for testing
buenaflor Jul 17, 2025
3a7acf7
Update
buenaflor Jul 17, 2025
76963f6
Merge branch 'deps/upgrade-kotlin' into chore/update-distribution-gen…
buenaflor Jul 17, 2025
30484fa
Update
buenaflor Jul 17, 2025
973fe5e
Update
buenaflor Jul 17, 2025
d75f8f2
Merge branch 'main' into deps/upgrade-kotlin
buenaflor Jul 17, 2025
6c59179
Merge branch 'deps/upgrade-kotlin' into chore/update-distribution-gen…
buenaflor Jul 17, 2025
3b031f5
Update
buenaflor Jul 17, 2025
09b194a
Update
buenaflor Jul 17, 2025
d9f06ca
Clean up
buenaflor Jul 17, 2025
32b61a9
Merge branch 'deps/upgrade-kotlin' into cursor/add-js-browser-target-…
buenaflor Jul 17, 2025
d72cf37
Merge branch 'chore/update-distribution-generation' into cursor/add-j…
buenaflor Jul 17, 2025
457cca0
Update publicatiojn
buenaflor Jul 17, 2025
57120d8
Add support for stub sourceSet
buenaflor Jul 17, 2025
17f5398
Add wasmJs support
buenaflor Jul 17, 2025
5818c5b
Merge branch 'main' into cursor/add-js-browser-target-for-sentry-kmp-…
buenaflor Jul 18, 2025
c17a936
Update
buenaflor Jul 18, 2025
50d1953
Update
buenaflor Jul 21, 2025
bc5c2a1
Analyze
buenaflor Jul 21, 2025
5fea52e
Fix analyze
buenaflor Jul 21, 2025
e35899e
Update CHANGELOG
buenaflor Jul 21, 2025
aa7e7f6
Update SentryPlatformOptions.commonStub.kt
buenaflor Jul 21, 2025
f1316a7
Update
buenaflor Jul 21, 2025
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Add stubs/no-op support for unsupported targets ([#426](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/426))

## 0.16.0

Potentially breaking: this release bumps the used Kotlin version to `2.1.21`.
Expand Down
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import com.diffplug.spotless.LineEnding
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.MavenPublishPluginExtension
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.dokka.gradle.DokkaTask
import java.util.zip.ZipFile

plugins {
Expand Down Expand Up @@ -161,6 +162,13 @@ private fun Project.validateKotlinMultiplatformCoreArtifacts() {

subprojects {
if (project.name.contains("sentry-kotlin-multiplatform")) {
tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets.configureEach {
if (name.endsWith("Test")) {
suppress.set(true)
}
}
}
apply(plugin = Config.dokka)
}
}
Expand Down
7 changes: 6 additions & 1 deletion buildSrc/src/main/java/Publication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ fun DistributionContainer.configureForMultiplatform(project: Project, buildPubli
"watchosarm32" to "$projectName-watchosarm32",
"watchosarm64" to "$projectName-watchosarm64",
"watchossimulatorarm64" to "$projectName-watchossimulatorarm64",
"watchosx64" to "$projectName-watchosx64"
"watchosx64" to "$projectName-watchosx64",
"js" to "$projectName-js",
"wasm-js" to "$projectName-wasm-js",
"mingwx64" to "$projectName-mingwx64",
"linuxarm64" to "$projectName-linuxarm64",
"linuxx64" to "$projectName-linuxx64"
)

platforms.forEach { (distName, projectName) ->
Expand Down
41 changes: 39 additions & 2 deletions sentry-kotlin-multiplatform/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@file:OptIn(ExperimentalWasmDsl::class)

import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Expand Down Expand Up @@ -63,6 +67,7 @@ kotlin {
tvosX64()
macosX64()
macosArm64()
addNoOpTargets()

sourceSets {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
Expand Down Expand Up @@ -185,8 +190,10 @@ kotlin {

// workaround for https://youtrack.jetbrains.com/issue/KT-41709 due to having "Meta" in the class name
// if we need to use this class, we'd need to find a better way to work it out
targets.withType<KotlinNativeTarget>().all {
compilations["main"].cinterops["Sentry"].extraOpts(
targets.withType<KotlinNativeTarget>().matching {
it.konanTarget.family.isAppleFamily
}.forEach { target ->
target.compilations["main"].cinterops["Sentry"].extraOpts(
"-compiler-option",
"-DSentryMechanismMeta=SentryMechanismMetaUnavailable",
"-compiler-option",
Expand All @@ -195,6 +202,14 @@ kotlin {
"-DSentryMetricsAPIDelegate=SentryMetricsAPIDelegateUnavailable"
)
}

val commonStub by creating {
dependsOn(commonMain.get())
}
jsMain.get().dependsOn(commonStub)
wasmJsMain.get().dependsOn(commonStub)
linuxMain.get().dependsOn(commonStub)
mingwMain.get().dependsOn(commonStub)
}
}

Expand All @@ -216,3 +231,25 @@ buildkonfig {
buildConfigField(STRING, "SENTRY_COCOA_VERSION", Config.Libs.sentryCocoaVersion)
}
}

private fun KotlinMultiplatformExtension.addNoOpTargets() {
js(IR) {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

ah I see, it's too old already

browser()
binaries.library()
compilations.remove(compilations.getByName("test"))
}
wasmJs {
browser()
binaries.library()
compilations.remove(compilations.getByName("test"))
}
mingwX64 {
compilations.remove(compilations.getByName("test"))
}
linuxArm64 {
compilations.remove(compilations.getByName("test"))
}
linuxX64 {
compilations.remove(compilations.getByName("test"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Pod::Spec.new do |spec|
}
]

end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package io.sentry.kotlin.multiplatform

public actual class Attachment {

public actual val bytes: ByteArray?
public actual val contentType: String?
public actual val pathname: String?
public actual val filename: String

public actual companion object {
public actual fun fromScreenshot(screenshotBytes: ByteArray): Attachment =
Attachment(screenshotBytes, "screenshot.png", "image/png")
}

public actual constructor(bytes: ByteArray, filename: String) {
this.bytes = null
this.pathname = null
this.filename = ""
this.contentType = null
}

public actual constructor(bytes: ByteArray, filename: String, contentType: String?) {
this.bytes = null
this.pathname = null
this.filename = ""
this.contentType = null
}

public actual constructor(pathname: String) {
this.bytes = null
this.pathname = null
this.filename = ""
this.contentType = null
}

public actual constructor(pathname: String, filename: String) {
this.bytes = null
this.pathname = null
this.filename = ""
this.contentType = null
}

public actual constructor(pathname: String, filename: String, contentType: String?) {
this.bytes = null
this.pathname = null
this.filename = ""
this.contentType = null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package io.sentry.kotlin.multiplatform

public actual abstract class Context
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package io.sentry.kotlin.multiplatform

import io.sentry.kotlin.multiplatform.protocol.Breadcrumb
import io.sentry.kotlin.multiplatform.protocol.SentryId
import io.sentry.kotlin.multiplatform.protocol.User
import io.sentry.kotlin.multiplatform.protocol.UserFeedback

@Suppress("UnusedPrivateMember")
internal actual class SentryBridge actual constructor(
private val sentryInstance: SentryInstance
) {
actual fun init(context: Context, configuration: OptionsConfiguration) {
// No-op
}

actual fun init(configuration: OptionsConfiguration) {
// No-op
}

actual fun initWithPlatformOptions(configuration: PlatformOptionsConfiguration) {
// No-op
}

actual fun captureMessage(message: String): SentryId {
return SentryId.EMPTY_ID
}

actual fun captureMessage(message: String, scopeCallback: ScopeCallback): SentryId {
return SentryId.EMPTY_ID
}

actual fun captureException(throwable: Throwable): SentryId {
return SentryId.EMPTY_ID
}

actual fun captureException(throwable: Throwable, scopeCallback: ScopeCallback): SentryId {
return SentryId.EMPTY_ID
}

actual fun configureScope(scopeCallback: ScopeCallback) {
// No-op
}

actual fun captureUserFeedback(userFeedback: UserFeedback) {
// No-op
}

actual fun addBreadcrumb(breadcrumb: Breadcrumb) {
// No-op
}

actual fun setUser(user: User?) {
// No-op
}

actual fun isCrashedLastRun(): Boolean {
return false
}

actual fun isEnabled(): Boolean {
return false
}

actual fun close() {
// No-op
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.sentry.kotlin.multiplatform

import io.sentry.kotlin.multiplatform.protocol.Message
import io.sentry.kotlin.multiplatform.protocol.SentryException

public actual class SentryEvent actual constructor() : SentryBaseEvent() {
public actual var message: Message? = null
public actual var logger: String? = null
public actual var level: SentryLevel? = null
public actual var fingerprint: MutableList<String> = mutableListOf()
public actual var exceptions: MutableList<SentryException> = mutableListOf()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.sentry.kotlin.multiplatform

internal actual class SentryPlatformInstance : SentryInstance {
actual override fun init(configuration: PlatformOptionsConfiguration) {
// No-op
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.sentry.kotlin.multiplatform

public actual class SentryPlatformOptions

internal actual fun SentryPlatformOptions.prepareForInit() {
// No-op
}

internal actual fun SentryOptions.toPlatformOptionsConfiguration(): PlatformOptionsConfiguration =
{
// No-op
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.sentry.kotlin.multiplatform.protocol

public actual data class SentryId actual constructor(private val sentryIdString: String) {
public actual companion object {
public actual val EMPTY_ID: SentryId = SentryId("")
}

actual override fun toString(): String = sentryIdString
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.sentry.kotlin.multiplatform
import io.sentry.kotlin.multiplatform.protocol.Breadcrumb

expect class BreadcrumbTestConverter(breadcrumb: Breadcrumb) {

fun getType(): String?
fun getCategory(): String?
fun getMessage(): String?
Expand Down