Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

### Fixes

- Gradle Plugin: allow new supported targets to be installed ([#429](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/429))

## 0.17.0

### Features

- Add stubs/no-op support for unsupported targets ([#426](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/426))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ internal fun Project.installSentryForKmp(
return
}

val unsupportedTargets = listOf("wasm", "js", "mingw", "linux", "androidNative")
val unsupportedTargets = listOf("androidNative")
kmpExtension.targets.forEach { target ->
if (unsupportedTargets.any { unsupported -> target.name.contains(unsupported) }) {
throw GradleException(
"Unsupported target: ${target.name}. " +
"Cannot auto install in commonMain. " +
"Please create an intermediate sourceSet with targets that the Sentry SDK " +
"supports (apple, jvm, android) and add the dependency manually."
"supports and add the dependency manually."
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.gradle.api.plugins.ExtensionAware
import org.gradle.testfixtures.ProjectBuilder
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Assertions.assertNull
Expand Down Expand Up @@ -154,9 +153,8 @@ class SentryPluginTest {
assertTrue(commonMainConfiguration!!.dependencies.contains(sentryDependency))
}

@OptIn(ExperimentalWasmDsl::class)
@ParameterizedTest(name = "installSentryForKmp throws if build contains unsupported target {0}")
@ValueSource(strings = ["wasm", "js", "mingw", "linux", "androidNative"])
@ValueSource(strings = ["androidNative"])
fun `installSentryForKmp throws if build contains any unsupported target`(unsupportedTarget: String) {
val project = ProjectBuilder.builder().build()
project.pluginManager.apply("org.jetbrains.kotlin.multiplatform")
Expand All @@ -165,10 +163,6 @@ class SentryPluginTest {
val kmpExtension = project.extensions.getByType(KotlinMultiplatformExtension::class.java)
kmpExtension.apply {
when (unsupportedTarget) {
"wasm" -> wasmJs()
"js" -> js()
"mingw" -> mingwX64()
"linux" -> linuxX64()
"androidNative" -> androidNativeArm64()
}
}
Expand Down
Loading