Skip to content

Commit 4ad6fd7

Browse files
committed
update docs
1 parent 752a05e commit 4ad6fd7

File tree

8 files changed

+163
-51
lines changed

8 files changed

+163
-51
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Gradle Plugin
3+
sidebar_order: 5
4+
description: "Learn more about the Sentry's Kotlin Multiplatform Gradle Plugin."
5+
---
6+
7+
The [Sentry Kotlin Multiplatform Gradle Plugin](https://github.com/getsentry/sentry-kotlin-multiplatform/tree/main/sentry-kotlin-multiplatform-gradle-plugin) is an additional plugin that can be used to configure the Sentry SDK for Kotlin Multiplatform projects and allows an easier setup.
8+
9+
It supports the following features:
10+
- Auto installation of the Sentry Kotlin Multiplatform SDK.
11+
- Auto installation of the Sentry Cocoa SDK via Cocoapods if the Kotlin Cocoapods plugin is applied.
12+
- Automatic configuration of the Kotlin/Native linker for seamless usage with Swift Package Manager.
13+
14+
## Setup
15+
16+
### Install
17+
18+
Using Gradle in your `shared/build.gradle.kts` add:
19+
20+
```kotlin {filename:shared/build.gradle.kts}
21+
plugins {
22+
id("io.sentry.kotlin.multiplatform.gradle") version "{{@inject packages.version('sentry.kotlin.kmp', '0.9.0') }}"
23+
}
24+
```
25+
26+
### Configure
27+
28+
We expose the following configuration values:
29+
30+
```kotlin {filename:shared/build.gradle.kts}
31+
sentryKmp {
32+
// Configure auto-installation of Sentry components.
33+
autoInstall {
34+
// Enable auto-installation of Sentry components:
35+
// - Sentry Kotlin Multiplatform SDK
36+
// - Sentry Cocoa SDK with Cocoapods if Kotlin Cocoapods plugin is applied.
37+
// Default is enabled.
38+
enabled = true
39+
40+
// Configure the commonMain source set.
41+
commonMain {
42+
// Enable auto-installation of the Sentry Kotlin Multiplatform SDK in commonMain.
43+
// Default is enabled.
44+
enabled = true
45+
46+
// Specify the version of the Sentry Kotlin Multiplatform SDK to use.
47+
// Default is the corresponding Kotlin Multiplatform SDK version.
48+
sentryKmpVersion = "{{@inject packages.version('sentry.kotlin.kmp', '0.9.0') }}"
49+
}
50+
51+
// Configure the Cocoapods plugin.
52+
cocoapods {
53+
// Enable auto-installation of the Sentry Cocoa SDK with Cocoapods.
54+
// Default is enabled.
55+
enabled = true
56+
57+
// Specify the version of the Sentry Cocoa SDK to install.
58+
// Default is the Cocoa SDK version used in the Kotlin Multiplatform SDK.
59+
sentryCocoaVersion = "8.38.0"
60+
}
61+
62+
// Configure the linker. This is only relevant if you are using SPM.
63+
linker {
64+
// Enable auto-configuration of the Kotlin/Native linker for Sentry Cocoa framework.
65+
// Default is enabled.
66+
enabled = true
67+
68+
// Path to the Xcode project that will be used to link the framework.
69+
// This is used to find the derived data path in which the framework is stored for SPM.
70+
// Default is the current project directory.
71+
xcodeProjectPath = "path/to/your/project.xcodeproj"
72+
73+
// Path to the framework that will be linked.
74+
// Takes precedence over xcodeprojPath if both are set.
75+
// Default is null.
76+
frameworkPath = "path/to/your/framework.framework"
77+
}
78+
}
79+
}
80+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Features
3+
sidebar_order: 0
4+
description: "Learn about the features of Sentry's Kotlin Multiplatform SDK."
5+
---
6+
7+
Sentry's Kotlin Multiplatform SDK enables automatic reporting of errors and exception.
8+
The SDK provides a unified API for all supported platforms, directly leveraging the native SDKs for each platform.
9+
Therefore it also supports the same features as the native SDKs.
10+
11+
- [Apple features](/platforms/apple/features)
12+
- [Android features](/platforms/android/features)
13+
- [Java features](/platforms/java/features)
14+
15+
<Note>
16+
Some functionality might not yet be available in the shared Kotlin Multiplatform layer therefore it might be necessary to use the native SDKs directly or write your own platform specific code.
17+
18+
If you require access to the native SDK init options we recommend using the [Native Platform Options initialization](/platforms/kotlin-multiplatform/initialization-strategies/#native-platform-options).
19+
</Note>
20+
21+
## Supported Platforms
22+
23+
The table below lists supported platforms and their corresponding presets.
24+
25+
| Target Platform | Target Preset |
26+
| --------------- | ------------------------------------------------------------------------------------------------------------ |
27+
| Android | <ul><li>`androidTarget`</li></ul> |
28+
| Kotlin/JVM | <ul><li>`jvm`</li></ul> |
29+
| iOS | <ul><li>`iosArm64`</li><li>`iosX64`</li><li>`iosSimulatorArm64`</li></ul> |
30+
| macOS | <ul><li>`macosArm64`</li><li>`macosX64`</li></ul> |
31+
| watchOS | <ul><li>`watchosArm32`</li><li>`watchosArm64`</li><li>`watchosX64`</li><li>`watchosSimulatorArm64`</li></ul> |
32+
| tvOS | <ul><li>`tvosArm64`</li><li>`tvosX64`</li><li>`tvosSimulatorArm64`</li></ul> |

docs/platforms/kotlin-multiplatform/index.mdx

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,9 @@ Learn more about manually capturing an error or message in our <PlatformLink to=
3838

3939
To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
4040

41-
## Supported Platforms
41+
## Next Steps
4242

43-
The table below lists supported platforms and their corresponding presets.
44-
45-
| Target Platform | Target Preset |
46-
| --------------- | ------------------------------------------------------------------------------------------------------------ |
47-
| Android | <ul><li>`androidTarget`</li></ul> |
48-
| Kotlin/JVM | <ul><li>`jvm`</li></ul> |
49-
| iOS | <ul><li>`iosArm64`</li><li>`iosX64`</li><li>`iosSimulatorArm64`</li></ul> |
50-
| macOS | <ul><li>`macosArm64`</li><li>`macosX64`</li></ul> |
51-
| watchOS | <ul><li>`watchosArm32`</li><li>`watchosArm64`</li><li>`watchosX64`</li><li>`watchosSimulatorArm64`</li></ul> |
52-
| tvOS | <ul><li>`tvosArm64`</li><li>`tvosX64`</li><li>`tvosSimulatorArm64`</li></ul> |
53-
54-
## Overview of Features
55-
56-
- Native crash reporting for Android and JVM, leveraging our [Android SDK](/platforms/android) and [Java SDK](/platforms/java)
57-
- Native crash reporting for iOS, macOS, tvOS, and watchOS, leveraging our [Cocoa SDK](/platforms/apple)
58-
- Automatic breadcrumbs for app lifecycle and UI events
59-
60-
## Plugin Configuration
61-
62-
The Sentry Kotlin Multiplatform Plugin can be configured in the `build.gradle.kts` file of your shared module.
63-
64-
```kotlin {filename:shared/build.gradle.kts}
65-
sentryKmp {
66-
autoInstall {
67-
// Configure auto installation
68-
}
69-
70-
linker {
71-
// Configure the linker (only relevant if you are using SPM)
72-
}
73-
}
74-
```
43+
- <PlatformLink to="/features">Learn more about Sentry's Kotlin Multiplatform SDK features</PlatformLink>
44+
- <PlatformLink to="/initialization-strategies">Get to know different ways initialize the SDK</PlatformLink>
45+
- <PlatformLink to="/configuration/gradle">Configuration options for the Kotlin Multiplatform Gradle Plugin</PlatformLink>
46+
- <PlatformLink to="/debug-symbols">Add readable stack traces to your errors</PlatformLink>

docs/platforms/kotlin-multiplatform/initialization-strategies.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ func application(
4848
<Note>
4949
Requires Sentry SDK version `0.7.1` or higher.
5050
</Note>
51+
<Note>
52+
Available options are determined by the native SDK versions used in the build.
53+
For example, Kotlin Multiplatform SDK `0.10.0` uses Sentry Android `7.16.0` and Sentry Cocoa `8.38.0`, so it supports all options from these versions.
54+
</Note>
5155

5256
This approach involves initializing the SDK with the platform's specific options directly, using `PlatformOptionsConfiguration`. This strategy is ideal for projects that require configuring options that are not yet supported by the KMP SDK, such as experimental options.
5357
For example, if you configure your KMP application for Android, you will have access to every option that the Android SDK provides.

docs/platforms/kotlin-multiplatform/manual-setup/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ kotlin {
4545

4646
cocoapods {
4747
// rest of configuration
48+
summary = "Some description for the Shared Module"
49+
homepage = "Link to the Shared Module homepage"
50+
ios.deploymentTarget = "14.1"
51+
podfile = project.file("../iosApp/Podfile")
52+
// Make sure you use the proper version according to our Cocoa SDK Version Compatibility Table.
53+
// TODO: link to table in sentry-kotlin-multiplatform gh repo
4854
pod("Sentry") {
4955
// Check the version compatibility table for the correct version
5056
version = "8.36.0"
Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,39 @@
1-
```kotlin
1+
```kotlin {filename:SentrySetup.kt}{tabTitle: commonMain}
22
import io.sentry.kotlin.multiplatform.Sentry
33

4-
Sentry.init { ->
5-
options.dsn = "___PUBLIC_DSN___"
4+
fun initializeSentry() {
5+
Sentry.init { options ->
6+
options.dsn = "___PUBLIC_DSN___"
7+
}
8+
}
9+
```
10+
```swift {tabTitle: iosApp}
11+
import shared
12+
13+
func application(
14+
_ application: UIApplication,
15+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
16+
) -> Bool {
17+
SentrySetupKt.initializeSentry()
18+
return true
19+
}
20+
21+
// OR if you're using SwiftUI:
22+
23+
@main
24+
struct SwiftUIApp: App {
25+
init() {
26+
initializeSentry()
27+
}
28+
}
29+
```
30+
```kotlin {filename:MainActivity.kt}{tabTitle: androidApp}
31+
import your.kmp.app.initializeSentry
32+
33+
class YourApplication : Application() {
34+
override fun onCreate() {
35+
super.onCreate()
36+
initializeSentry()
37+
}
638
}
739
```

platform-includes/getting-started-install/kotlin-multiplatform.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ To install the Kotlin Multiplatform SDK, you need to add the following to your `
22

33
```kotlin {filename:shared/build.gradle.kts}
44
plugins {
5-
id("io.sentry.kotlin.multiplatform.gradle") version "{{@inject packages.version('sentry.kotlin.kmp.gradle-plugin', '0.9.0') }}"
5+
id("io.sentry.kotlin.multiplatform.gradle") version "{{@inject packages.version('sentry.kotlin.kmp', '0.9.0') }}"
66
}
77
```
88

platform-includes/getting-started-primer/kotlin-multiplatform.mdx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,6 @@ Installing this SDK will enable native crash reporting and automatic breadcrumbs
88

99
Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page.
1010

11-
### Cocoa SDK Version Compatibility Table
12-
13-
Every version of our Kotlin Multiplatform SDK is compiled with a specific version of the [Sentry Cocoa SDK](/platforms/apple/).
14-
Use the Kotlin Multiplatform and Cocoa SDK combinations listed in the table below to ensure the best compatibility and stability.
15-
16-
| Kotlin Multiplatform SDK Version | Cocoa SDK Version |
17-
| -------------------------------- | ----------------- |
18-
| Up to 0.3.0 | 8.4.0 |
19-
| 0.4.0 | 8.17.2 |
20-
| 0.5.0 | 8.21.0 |
21-
| 0.6.0 | 8.25.0 |
22-
| 0.7.0 | 8.26.0 |
23-
| 0.8.0, 0.9.0 | 8.36.0 |
24-
2511
<Note>
2612
Xcode 16 support starts with Sentry Cocoa SDK version `8.36.0` or higher.
2713
</Note>

0 commit comments

Comments
 (0)