Skip to content

Commit 1a49c4d

Browse files
authored
misc(android): update native android sdk name (#353)
* Add native android sdk name * Use native android sdk name * Fix analyze * Update Config.kt * update changelog * update test * Fix test * Fix test * Formatting
1 parent 64cede1 commit 1a49c4d

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Miscellaneous
6+
7+
- Update native android sdk name to `sentry.native.android.kmp` ([#353](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/353))
8+
59
### Dependencies
610

711
- Bump Cocoa SDK from v8.44.0 to v8.48.0 ([#345](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/345))

buildSrc/src/main/java/Config.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ object Config {
8383
val kmpCocoaSdkName = "sentry.cocoa.kmp"
8484
val kmpJavaSdkName = "sentry.java.kmp"
8585
val kmpAndroidSdkName = "sentry.java.android.kmp"
86+
val kmpNativeAndroidSdkName = "sentry.native.android.kmp"
8687
val javaPackageName = "maven:io.sentry:sentry"
8788
val androidPackageName = "maven:io.sentry:sentry-android"
8889
val cocoaPackageName = "cocoapods:sentry-cocoa"

sentry-kotlin-multiplatform/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ buildkonfig {
204204
buildConfigField(STRING, "SENTRY_KMP_COCOA_SDK_NAME", Config.Sentry.kmpCocoaSdkName)
205205
buildConfigField(STRING, "SENTRY_KMP_JAVA_SDK_NAME", Config.Sentry.kmpJavaSdkName)
206206
buildConfigField(STRING, "SENTRY_KMP_ANDROID_SDK_NAME", Config.Sentry.kmpAndroidSdkName)
207+
buildConfigField(STRING, "SENTRY_KMP_NATIVE_ANDROID_SDK_NAME", Config.Sentry.kmpNativeAndroidSdkName)
207208

208209
buildConfigField(STRING, "VERSION_NAME", project.version.toString())
209210
buildConfigField(STRING, "SENTRY_JAVA_PACKAGE_NAME", Config.Sentry.javaPackageName)

sentry-kotlin-multiplatform/src/androidMain/kotlin/io/sentry/kotlin/multiplatform/SentryPlatformOptions.android.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ internal actual fun SentryPlatformOptions.prepareForInit() {
1010
if (sdkVersion?.packageSet?.none { it.name == BuildKonfig.SENTRY_ANDROID_PACKAGE_NAME } == true) {
1111
sdkVersion?.addPackage(BuildKonfig.SENTRY_ANDROID_PACKAGE_NAME, BuildKonfig.SENTRY_ANDROID_VERSION)
1212
}
13+
nativeSdkName = BuildKonfig.SENTRY_KMP_NATIVE_ANDROID_SDK_NAME
1314
}
1415

1516
internal actual fun SentryOptions.toPlatformOptionsConfiguration(): PlatformOptionsConfiguration =
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package io.sentry.kotlin.multiplatform
2+
3+
import io.sentry.kotlin.multiplatform.fakes.FakeSentryInstance
4+
import junit.framework.TestCase.assertEquals
5+
import kotlin.test.BeforeTest
6+
import kotlin.test.Test
7+
8+
class SentryAndroidBridgeTest {
9+
private lateinit var fixture: Fixture
10+
11+
@BeforeTest
12+
fun setup() {
13+
fixture = Fixture()
14+
}
15+
16+
@Test
17+
fun `init sets native android sdk name`() {
18+
val sut = fixture.getSut()
19+
20+
sut.init { }
21+
22+
val option = SentryPlatformOptions().apply {
23+
fixture.sentryInstance.lastConfiguration?.invoke(this)
24+
}
25+
26+
assertEquals(BuildKonfig.SENTRY_KMP_NATIVE_ANDROID_SDK_NAME, option.nativeSdkName)
27+
}
28+
}
29+
30+
internal class Fixture {
31+
val sentryInstance = FakeSentryInstance()
32+
33+
fun getSut(): SentryBridge {
34+
return SentryBridge(sentryInstance)
35+
}
36+
}

0 commit comments

Comments
 (0)