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
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*.{kt,kts}]
# ktlint 1.x defaults to the new ktlint_official code style, which would reformat
# most of the codebase (multiline expression wrapping, trailing commas, signature
# wrapping). Pin the pre-1.x style until a dedicated style-migration PR adopts
# ktlint_official deliberately.
ktlint_code_style = intellij_idea
# ktlint 1.x adds trailing commas by default regardless of code style; the
# codebase doesn't use them.
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
# ktlint 1.x also enables stricter naming rules by default. The codebase relies on
# backtick-wrapped test function names and constant-style vals that predate
# these rules, so keep them disabled to match existing conventions.
ktlint_standard_function-naming = disabled
ktlint_standard_property-naming = disabled
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased

### Dependencies

- Bump Kotlin from `2.1.21` to `2.2.21` and Gradle from `8.6` to `8.13` ([#556](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/556))
- Also bumps AGP to `8.7.3` and `compileSdk` to 35

## 0.27.0

### Features
Expand Down
127 changes: 84 additions & 43 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
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
Expand All @@ -18,7 +17,8 @@ plugins {
id(Config.BuildPlugins.buildConfig).version(Config.BuildPlugins.buildConfigVersion).apply(false)
kotlin(Config.kotlinSerializationPlugin).version(Config.kotlinVersion).apply(false)
id(Config.QualityPlugins.kover).version(Config.QualityPlugins.koverVersion).apply(false)
id(Config.QualityPlugins.binaryCompatibility).version(Config.QualityPlugins.binaryCompatibilityVersion)
id(Config.QualityPlugins.binaryCompatibility)
.version(Config.QualityPlugins.binaryCompatibilityVersion)
.apply(false)
}

Expand Down Expand Up @@ -52,18 +52,17 @@ subprojects {
}

afterEvaluate {
val platformDists = project.tasks.filter { task ->
task.name.matches(Regex("(.*)DistZip"))
}.toTypedArray()
val platformDists =
project.tasks
.filter { task ->
task.name.matches(Regex("(.*)DistZip"))
}.toTypedArray()
project.tasks.getByName("distZip").finalizedBy(*platformDists)

// signing is done when uploading files to MC
// via gpg:sign-and-deploy-file (release.kts); disabled here via
// the RELEASE_SIGNING_ENABLED Gradle property (see gradle.properties)
apply<MavenPublishPlugin>()

configure<MavenPublishPluginExtension> {
// signing is done when uploading files to MC
// via gpg:sign-and-deploy-file (release.kts)
releaseSigningEnabled = false
}
}
}
}
Expand All @@ -78,7 +77,11 @@ tasks.register("validateDistributions") {
}

private fun Project.validateKotlinMultiplatformCoreArtifacts() {
val distributionDir = project.layout.buildDirectory.dir("distributions").get().asFile
val distributionDir =
project.layout.buildDirectory
.dir("distributions")
.get()
.asFile
val expectedNumOfFiles = 20
val filesList = distributionDir.listFiles()
val actualNumOfFiles = filesList?.size ?: 0
Expand All @@ -90,34 +93,46 @@ private fun Project.validateKotlinMultiplatformCoreArtifacts() {
}

val baseFileName = "sentry-kotlin-multiplatform"
val platforms = listOf(
"watchosx64", "watchossimulatorarm64", "watchosarm64", "watchosarm32",
"tvosx64", "tvossimulatorarm64", "tvosarm64",
"macosx64", "macosarm64",
"jvm",
"iosx64", "iossimulatorarm64", "iosarm64",
"android",
"js",
"wasm-js",
"linuxx64", "linuxarm64",
"mingwx64"
)

val artifactPaths = buildList {
add(distributionDir.resolve("$baseFileName-$version.zip"))
addAll(
platforms.map { platform ->
distributionDir.resolve("$baseFileName-$platform-$version.zip")
}
val platforms =
listOf(
"watchosx64",
"watchossimulatorarm64",
"watchosarm64",
"watchosarm32",
"tvosx64",
"tvossimulatorarm64",
"tvosarm64",
"macosx64",
"macosarm64",
"jvm",
"iosx64",
"iossimulatorarm64",
"iosarm64",
"android",
"js",
"wasm-js",
"linuxx64",
"linuxarm64",
"mingwx64"
)
}

val commonRequiredEntries = listOf(
"javadoc",
"sources",
"module",
"pom-default.xml"
)
val artifactPaths =
buildList {
add(distributionDir.resolve("$baseFileName-$version.zip"))
addAll(
platforms.map { platform ->
distributionDir.resolve("$baseFileName-$platform-$version.zip")
}
)
}

val commonRequiredEntries =
listOf(
"javadoc",
"sources",
"module",
"pom-default.xml"
)

artifactPaths.forEach { artifactFile ->
if (!artifactFile.exists()) {
Expand All @@ -128,7 +143,12 @@ private fun Project.validateKotlinMultiplatformCoreArtifacts() {
}

ZipFile(artifactFile).use { zip ->
val entries = zip.entries().asSequence().map { it.name }.toList()
val entries =
zip
.entries()
.asSequence()
.map { it.name }
.toList()

commonRequiredEntries.forEach { requiredEntry ->
if (entries.none { it.contains(requiredEntry) }) {
Expand All @@ -146,7 +166,9 @@ private fun Project.validateKotlinMultiplatformCoreArtifacts() {
val expectedNumOfKlibFiles = 3
val actualKlibFiles = entries.count { it.contains("klib") }
if (actualKlibFiles != expectedNumOfKlibFiles) {
throw GradleException("❌ Expected $expectedNumOfKlibFiles klib files in ${artifactFile.name}, but found $actualKlibFiles")
throw GradleException(
"❌ Expected $expectedNumOfKlibFiles klib files in ${artifactFile.name}, but found $actualKlibFiles"
)
} else {
println("✅ Found $expectedNumOfKlibFiles klib files in ${artifactFile.name}")
}
Expand Down Expand Up @@ -177,18 +199,37 @@ subprojects {
}
}

// Keep ktlint 1.x on the pre-1.0 formatting conventions (see .editorconfig for the
// rationale). Spotless does not reliably forward the ij_* properties from
// .editorconfig to ktlint, so pass them explicitly.
val ktlintEditorConfigOverride =
mapOf(
"ktlint_code_style" to "intellij_idea",
"ij_kotlin_allow_trailing_comma" to "false",
"ij_kotlin_allow_trailing_comma_on_call_site" to "false",
"ktlint_standard_argument-list-wrapping" to "disabled",
"ktlint_standard_chain-method-continuation" to "disabled",
"ktlint_standard_class-signature" to "disabled",
"ktlint_standard_condition-wrapping" to "disabled",
"ktlint_standard_function-expression-body" to "disabled",
"ktlint_standard_function-signature" to "disabled",
"ktlint_standard_multiline-expression-wrapping" to "disabled",
"ktlint_standard_function-naming" to "disabled",
"ktlint_standard_property-naming" to "disabled"
)

spotless {
lineEndings = LineEnding.UNIX

kotlin {
target("**/*.kt")
targetExclude("**/generated/**/*.kt")
ktlint()
ktlint().editorConfigOverride(ktlintEditorConfigOverride)
}
kotlinGradle {
target("**/*.kts")
targetExclude("**/generated/**/*.kts")
ktlint()
ktlint().editorConfigOverride(ktlintEditorConfigOverride)
}
}

Expand All @@ -197,7 +238,7 @@ val detektBaselineFilePath = "$rootDir/config/detekt/baseline.xml"

detekt {
buildUponDefaultConfig = true
config = files(detektConfigFilePath)
config.setFrom(files(detektConfigFilePath))
baseline = file(detektBaselineFilePath)
}

Expand Down
26 changes: 13 additions & 13 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
object Config {
val agpVersion = "7.4.2"
val kotlinVersion = "2.1.21"
val composePluginVersion = "1.8.0"
val gradleMavenPublishPluginVersion = "0.18.0"
val agpVersion = "8.7.3"
val kotlinVersion = "2.2.21"
val composePluginVersion = "1.9.0"
val gradleMavenPublishPluginVersion = "0.30.0"

val multiplatform = "multiplatform"
val cocoapods = "native.cocoapods"
Expand All @@ -12,20 +12,20 @@ object Config {
val androidGradle = "com.android.library"
val kotlinSerializationPlugin = "plugin.serialization"
val dokka = "org.jetbrains.dokka"
val dokkaVersion = "1.8.10"
val dokkaVersion = "1.9.20"

object BuildPlugins {
val buildConfig = "com.codingfeline.buildkonfig"
val buildConfigVersion = "0.13.3"
val buildConfigVersion = "0.17.1"
}

object QualityPlugins {
val spotless = "com.diffplug.spotless"
val spotlessVersion = "6.11.0"
val spotlessVersion = "7.0.2"
val kover = "org.jetbrains.kotlinx.kover"
val koverVersion = "0.7.3"
val koverVersion = "0.9.1"
val detekt = "io.gitlab.arturbosch.detekt"
val detektVersion = "1.22.0"
val detektVersion = "1.23.8"
val binaryCompatibility = "org.jetbrains.kotlinx.binary-compatibility-validator"
val binaryCompatibilityVersion = "0.18.0"
}
Expand All @@ -51,9 +51,9 @@ object Config {
val kotlinCommon = "org.jetbrains.kotlin:kotlin-test-common"
val kotlinCommonAnnotation = "org.jetbrains.kotlin:kotlin-test-annotations-common"
val kotlinJunit = "org.jetbrains.kotlin:kotlin-test-junit"
val kotlinCoroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-RC"
val kotlinCoroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.0-RC"
val kotlinxSerializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0"
val kotlinCoroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0"
val kotlinCoroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0"
val kotlinxSerializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3"

val ktorClientCore = "io.ktor:ktor-client-core:2.3.6"
val ktorClientSerialization = "io.ktor:ktor-client-serialization:2.3.6"
Expand All @@ -66,7 +66,7 @@ object Config {
}

object Android {
private val sdkVersion = 33
private val sdkVersion = 35

val minSdkVersion = 21
val targetSdkVersion = sdkVersion
Expand Down
21 changes: 21 additions & 0 deletions config/detekt/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,31 @@
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>MaxLineLength:SentryAttributes.kt$SentryAttributes.Companion$public</ID>
<ID>SwallowedException:CocoaScopeProvider.kt$CocoaScopeProvider$e: Throwable</ID>
<ID>SwallowedException:SentryLevel.kt$SentryLevel.Companion$throwable: Throwable</ID>
<ID>TooGenericExceptionCaught:CocoaScopeProvider.kt$CocoaScopeProvider$e: Throwable</ID>
<ID>TooGenericExceptionCaught:SentryLevel.kt$SentryLevel.Companion$throwable: Throwable</ID>
<ID>TooGenericExceptionThrown:SentryKMP.kt$Sentry$throw RuntimeException("Uncaught Exception from Kotlin Multiplatform.")</ID>
<ID>UndocumentedPublicClass:Attachment.kt$Attachment$Companion</ID>
<ID>UndocumentedPublicClass:Breadcrumb.kt$Breadcrumb$Companion</ID>
<ID>UndocumentedPublicClass:HttpStatusCodeRange.kt$HttpStatusCodeRange$Companion</ID>
<ID>UndocumentedPublicClass:SentryAttributes.kt$SentryAttributes$Companion</ID>
<ID>UndocumentedPublicClass:SentryId.kt$SentryId$Companion</ID>
<ID>UndocumentedPublicProperty:SentryLevel.kt$SentryLevel$DEBUG : SentryLevel</ID>
<ID>UndocumentedPublicProperty:SentryLevel.kt$SentryLevel$ERROR : SentryLevel</ID>
<ID>UndocumentedPublicProperty:SentryLevel.kt$SentryLevel$FATAL : SentryLevel</ID>
<ID>UndocumentedPublicProperty:SentryLevel.kt$SentryLevel$INFO : SentryLevel</ID>
<ID>UndocumentedPublicProperty:SentryLevel.kt$SentryLevel$WARNING : SentryLevel</ID>
<ID>UndocumentedPublicProperty:SentryLogLevel.kt$SentryLogLevel$DEBUG</ID>
<ID>UndocumentedPublicProperty:SentryLogLevel.kt$SentryLogLevel$ERROR</ID>
<ID>UndocumentedPublicProperty:SentryLogLevel.kt$SentryLogLevel$FATAL</ID>
<ID>UndocumentedPublicProperty:SentryLogLevel.kt$SentryLogLevel$INFO</ID>
<ID>UndocumentedPublicProperty:SentryLogLevel.kt$SentryLogLevel$TRACE</ID>
<ID>UndocumentedPublicProperty:SentryLogLevel.kt$SentryLogLevel$WARN</ID>
<ID>UnusedPrivateProperty:Attachment.kt$Attachment$bytes: ByteArray</ID>
<ID>UnusedPrivateProperty:Attachment.kt$Attachment$contentType: String?</ID>
<ID>UnusedPrivateProperty:Attachment.kt$Attachment$filename: String</ID>
<ID>UnusedPrivateProperty:Attachment.kt$Attachment$pathname: String</ID>
</CurrentIssues>
</SmellBaseline>
10 changes: 7 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
android.useAndroidX=true

# Jetpack Compose
compose.version=1.3.1-rc01

# Release information
versionName=0.27.0

# Disable publication signing locally; signing happens at MC upload time
RELEASE_SIGNING_ENABLED=false

# Increase memory for in-process compiler execution.
org.gradle.jvmargs=-Xmx6g

# https://kotlinlang.org/docs/migrating-multiplatform-project-to-14.html#migrate-to-the-hierarchical-project-structure
kotlin.mpp.enableCInteropCommonization=true

# Installed Xcode is newer than the version KGP was tested against; the build works,
# so suppress the (noisy) compatibility warning.
kotlin.apple.xcodeCompatibility.nowarn=true

# Publication pom properties
POM_NAME=Sentry Kotlin Multiplatform SDK
POM_DESCRIPTION=SDK for sentry.io
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 @@
#Mon Feb 27 16:36:52 CET 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading
Loading