Skip to content

Commit 65f4e8d

Browse files
authored
fix: build and bump versions (#48)
* fix build errors and test features * bump android and jvm sentry versions and migrate to new android sourceset layout * add default value for attachment contentType * change android min sdk * change xcode selection during build * update readme * manage versions through config * review improvements * remove unnecessary contentType
1 parent 2842bc3 commit 65f4e8d

File tree

24 files changed

+164
-122
lines changed

24 files changed

+164
-122
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ format:
2222
# build and run tests
2323
compile:
2424
./gradlew build
25-
sudo xcode-select --switch /Applications/Xcode_12.5.1.app && /usr/bin/xcodebuild -version
25+
sudo xcode-select --switch /Applications/Xcode.app && /usr/bin/xcodebuild -version
2626
cd ./sentry-samples/kmp-app/iosApp; pod install
2727
xcodebuild -workspace ./sentry-samples/kmp-app/iosApp/iosApp.xcworkspace -scheme iosApp -configuration Debug -sdk iphonesimulator -arch arm64
2828

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ cocoapods {
6060
// ...
6161
6262
// Make sure Sentry Cocoa in your project matches this version
63-
pod("Sentry", "~> 7.21.0")
63+
pod("Sentry", "~> 8.2.0")
6464
6565
framework {
6666
baseName = "shared"
@@ -176,7 +176,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
176176

177177
## Debug Symbols for Apple targets
178178

179-
A dSYM upload is required for Sentry to symbolicate your crash logs for viewing. The symbolication process unscrambles Apple’s crash logs to reveal the function, variables, file names, and line numbers of the crash. The dSYM file can be uploaded through the sentry-cli tool or through a Fastlane action. Please visit our [sentry.io guide](https://docs.sentry.io/clients/cocoa/dsym/) to get started on uploading debug symbols.
179+
A dSYM upload is required for Sentry to symbolicate your crash logs for viewing. The symbolication process unscrambles Apple’s crash logs to reveal the function, variables, file names, and line numbers of the crash. The dSYM file can be uploaded through the sentry-cli tool or through a Fastlane action. Please visit our [sentry.io guide](https://docs.sentry.io/platforms/apple/dsym/) to get started on uploading debug symbols.
180180

181181
## Troubleshooting
182182

build.gradle.kts

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,21 @@ import com.vanniktech.maven.publish.MavenPublishPlugin
33
import com.vanniktech.maven.publish.MavenPublishPluginExtension
44

55
plugins {
6-
`maven-publish`
7-
id("com.vanniktech.maven.publish") version "0.18.0"
8-
id("com.diffplug.spotless") version "6.7.2"
9-
}
10-
11-
buildscript {
12-
repositories {
13-
gradlePluginPortal()
14-
google()
15-
mavenCentral()
16-
}
17-
dependencies {
18-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
19-
classpath("com.android.tools.build:gradle:7.2.2")
20-
}
21-
}
22-
23-
spotless {
24-
lineEndings = LineEnding.UNIX
25-
26-
kotlin {
27-
target("**/*.kt")
28-
ktlint()
29-
}
30-
kotlinGradle {
31-
target("**/*.kts")
32-
ktlint()
33-
}
6+
id(Config.gradleMavenPublishPlugin).version(Config.gradleMavenPublishPluginVersion)
7+
id(Config.QualityPlugins.spotless).version(Config.QualityPlugins.spotlessVersion)
8+
kotlin(Config.multiplatform).version(Config.kotlinVersion).apply(false)
9+
kotlin(Config.cocoapods).version(Config.kotlinVersion).apply(false)
10+
id(Config.jetpackCompose).version(Config.composeVersion).apply(false)
11+
id(Config.androidGradle).version(Config.agpVersion).apply(false)
3412
}
3513

3614
allprojects {
37-
repositories {
38-
mavenCentral()
39-
mavenLocal()
40-
google()
41-
}
4215
group = "io.sentry"
4316
version = properties["versionName"].toString()
44-
45-
apply(plugin = "com.diffplug.spotless")
4617
}
4718

4819
subprojects {
49-
if (!this.name.contains("samples") && !this.name.contains("shared")) {
20+
if (this.name.contains("sentry-kotlin-multiplatform")) {
5021
apply<DistributionPlugin>()
5122

5223
val sep = File.separator
@@ -77,3 +48,16 @@ subprojects {
7748
}
7849
}
7950
}
51+
52+
spotless {
53+
lineEndings = LineEnding.UNIX
54+
55+
kotlin {
56+
target("**/*.kt")
57+
ktlint()
58+
}
59+
kotlinGradle {
60+
target("**/*.kts")
61+
ktlint()
62+
}
63+
}

buildSrc/build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ repositories {
99
}
1010

1111
tasks.withType<KotlinCompile>().configureEach {
12-
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
12+
kotlinOptions {
13+
jvmTarget = properties["jvm.version"].toString()
14+
}
1315
}

buildSrc/src/main/java/Config.kt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
object Config {
2+
val agpVersion = "7.4.2"
3+
val kotlinVersion = "1.8.0"
4+
val composeVersion = "1.3.1-rc01"
5+
val gradleMavenPublishPluginVersion = "0.18.0"
6+
7+
val multiplatform = "multiplatform"
8+
val cocoapods = "native.cocoapods"
9+
val jetpackCompose = "org.jetbrains.compose"
10+
val gradleMavenPublishPlugin = "com.vanniktech.maven.publish"
11+
val androidGradle = "com.android.library"
12+
13+
object QualityPlugins {
14+
val spotless = "com.diffplug.spotless"
15+
val spotlessVersion = "6.11.0"
16+
}
17+
18+
object Libs {
19+
val kotlinStd = "org.jetbrains.kotlin:kotlin-stdlib"
20+
21+
val sentryJavaVersion = "6.14.0"
22+
val sentryAndroid = "io.sentry:sentry-android:$sentryJavaVersion"
23+
val sentryJava = "io.sentry:sentry:$sentryJavaVersion"
24+
25+
val sentryCocoaVersion = "~> 8.2.0"
26+
val sentryCocoa = "Sentry"
27+
}
28+
29+
object TestLibs {
30+
val kotlinCommon = "org.jetbrains.kotlin:kotlin-test-common"
31+
val kotlinCommonAnnotation = "org.jetbrains.kotlin:kotlin-test-annotations-common"
32+
val kotlinJunit = "org.jetbrains.kotlin:kotlin-test-junit"
33+
}
34+
35+
object Android {
36+
private val sdkVersion = 33
37+
38+
val minSdkVersion = 16
39+
val targetSdkVersion = sdkVersion
40+
val compileSdkVersion = sdkVersion
41+
}
42+
43+
object Cocoa {
44+
val iosDeploymentTarget = "11.0"
45+
val osxDeploymentTarget = "10.13"
46+
val tvosDeploymentTarget = "11.0"
47+
val watchosDeploymentTarget = "4.0"
48+
}
49+
}

gradle.properties

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# Kotlin
2-
kotlin.version=1.7.10
2+
kotlin.version=1.8.0
33
kotlin.incremental.multiplatform=true
44
kotlin.code.style=official
55
kotlin.mpp.stability.nowarn=true
66
android.useAndroidX=true
77

88
# Jetpack Compose
9-
compose.version=1.2.0-alpha01-dev753
9+
compose.version=1.3.1-rc01
10+
11+
# JVM target when compiling Kotlin
12+
jvm.version=1.8
1013

1114
# Release information
1215
versionName=0.0.1
1316

1417
# Increase memory for in-process compiler execution.
1518
org.gradle.jvmargs=-Xmx3g
1619

17-
# because of: Please try to disable compiler caches and rerun the build. To disable compiler caches, add the following line to the gradle.properties file in the project's root directory
20+
# Because of: Please try to disable compiler caches and rerun the build. To disable compiler caches, add the following line to the gradle.properties file in the project's root directory
1821
kotlin.native.cacheKind=none
1922

2023
# https://kotlinlang.org/docs/migrating-multiplatform-project-to-14.html#migrate-to-the-hierarchical-project-structure
@@ -23,8 +26,9 @@ kotlin.mpp.enableCompatibilityMetadataVariant=true
2326
kotlin.native.enableDependencyPropagation=false
2427
kotlin.mpp.enableCInteropCommonization=true
2528
kotlin.mpp.enableHierarchicalCommonization=true
29+
kotlin.mpp.androidSourceSetLayoutVersion=2
2630

27-
# publication pom properties
31+
# Publication pom properties
2832
POM_NAME=Sentry Kotlin Multiplatform SDK
2933
POM_DESCRIPTION=SDK for sentry.io
3034
POM_URL=https://github.com/getsentry/sentry-kotlin-multiplatform

gradle/wrapper/gradle-wrapper.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Mon Feb 27 16:36:52 CET 2023
12
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
24
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
5+
zipStorePath=wrapper/dists
46
zipStoreBase=GRADLE_USER_HOME
5-
zipStorePath=wrapper/dists

sentry-kotlin-multiplatform/build.gradle.kts

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@ plugins {
88
}
99

1010
android {
11-
compileSdk = 30
11+
compileSdk = Config.Android.compileSdkVersion
1212
defaultConfig {
13-
minSdk = 16
14-
targetSdk = 30
13+
minSdk = Config.Android.minSdkVersion
1514
}
1615

1716
buildTypes {
1817
getByName("release") {
1918
isMinifyEnabled = false
2019
}
2120
}
22-
// linking the manifest file manually due to having it in the "androidMain" source set
23-
sourceSets.getByName("main").manifest.srcFile("src/androidMain/AndroidManifest.xml")
2421
}
2522

2623
kotlin {
@@ -40,25 +37,25 @@ kotlin {
4037
sourceSets {
4138
val commonMain by getting {
4239
dependencies {
43-
implementation("org.jetbrains.kotlin:kotlin-stdlib")
40+
implementation(Config.Libs.kotlinStd)
4441
}
4542
}
4643
val commonTest by getting {
4744
dependencies {
48-
implementation("org.jetbrains.kotlin:kotlin-test-common")
49-
implementation("org.jetbrains.kotlin:kotlin-test-annotations-common")
45+
implementation(Config.TestLibs.kotlinCommon)
46+
implementation(Config.TestLibs.kotlinCommonAnnotation)
5047
}
5148
}
5249

5350
val androidMain by getting {
5451
dependencies {
55-
implementation("io.sentry:sentry-android:6.3.1") {
52+
implementation(Config.Libs.sentryAndroid) {
5653
// avoid duplicate dependencies since we depend on commonJvmMain
5754
exclude("io.sentry", "sentry")
5855
}
5956
}
6057
}
61-
val androidTest by getting
58+
val androidUnitTest by getting
6259
val jvmMain by getting
6360
val jvmTest by getting
6461

@@ -67,18 +64,30 @@ kotlin {
6764
jvmMain.dependsOn(this)
6865
androidMain.dependsOn(this)
6966
dependencies {
70-
implementation("io.sentry:sentry:6.3.1")
67+
implementation(Config.Libs.sentryJava)
7168
}
7269
}
7370
val commonJvmTest by creating {
7471
dependsOn(commonTest)
7572
jvmTest.dependsOn(this)
76-
androidTest.dependsOn(this)
73+
androidUnitTest.dependsOn(this)
7774
dependencies {
78-
implementation("org.jetbrains.kotlin:kotlin-test-junit")
75+
implementation(Config.TestLibs.kotlinJunit)
7976
}
8077
}
8178

79+
cocoapods {
80+
summary = "Official Sentry SDK Kotlin Multiplatform"
81+
homepage = "https://github.com/getsentry/sentry-kotlin-multiplatform"
82+
83+
pod(Config.Libs.sentryCocoa, Config.Libs.sentryCocoaVersion)
84+
85+
ios.deploymentTarget = Config.Cocoa.iosDeploymentTarget
86+
osx.deploymentTarget = Config.Cocoa.osxDeploymentTarget
87+
tvos.deploymentTarget = Config.Cocoa.tvosDeploymentTarget
88+
watchos.deploymentTarget = Config.Cocoa.watchosDeploymentTarget
89+
}
90+
8291
val iosMain by getting
8392
val iosSimulatorArm64Main by getting
8493
val iosTest by getting
@@ -135,18 +144,6 @@ kotlin {
135144
commonIosTest.dependsOn(this)
136145
commonTvWatchMacOsTest.dependsOn(this)
137146
}
138-
139-
cocoapods {
140-
summary = "Official Sentry SDK Kotlin Multiplatform"
141-
homepage = "https://github.com/getsentry/sentry-kotlin-multiplatform"
142-
143-
pod("Sentry", "~> 7.24.1")
144-
145-
ios.deploymentTarget = "9.0"
146-
osx.deploymentTarget = "10.10"
147-
tvos.deploymentTarget = "9.0"
148-
watchos.deploymentTarget = "2.0"
149-
}
150147
}
151148

152149
listOf(

sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Pod::Spec.new do |spec|
88
spec.summary = 'Official Sentry SDK Kotlin Multiplatform'
99
spec.vendored_frameworks = 'build/cocoapods/framework/sentry_kotlin_multiplatform.framework'
1010
spec.libraries = 'c++'
11-
spec.ios.deployment_target = '9.0'
12-
spec.osx.deployment_target = '10.10'
13-
spec.tvos.deployment_target = '9.0'
14-
spec.watchos.deployment_target = '2.0'
15-
spec.dependency 'Sentry', '~> 7.24.1'
11+
spec.ios.deployment_target = '11.0'
12+
spec.osx.deployment_target = '10.13'
13+
spec.tvos.deployment_target = '11.0'
14+
spec.watchos.deployment_target = '4.0'
15+
spec.dependency 'Sentry', '~> 8.2.0'
1616

1717
spec.pod_target_xcconfig = {
1818
'KOTLIN_PROJECT_PATH' => ':sentry-kotlin-multiplatform',
@@ -25,8 +25,8 @@ Pod::Spec.new do |spec|
2525
:execution_position => :before_compile,
2626
:shell_path => '/bin/sh',
2727
:script => <<-SCRIPT
28-
if [ "YES" = "$COCOAPODS_SKIP_KOTLIN_BUILD" ]; then
29-
echo "Skipping Gradle build task invocation due to COCOAPODS_SKIP_KOTLIN_BUILD environment variable set to \"YES\""
28+
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
29+
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
3030
exit 0
3131
fi
3232
set -ev

sentry-kotlin-multiplatform/src/commonAppleMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ internal fun CocoaSentryOptions.applyCocoaBaseOptions(options: SentryOptions) {
1919
this.dsn = options.dsn
2020
this.attachStacktrace = options.attachStackTrace
2121
this.dist = options.dist
22-
this.environment = options.environment
22+
options.environment?.let {
23+
this.environment = it
24+
}
2325
this.releaseName = options.release
2426
this.debug = options.debug
2527
this.sessionTrackingIntervalMillis = options.sessionTrackingIntervalMillis.convert()

0 commit comments

Comments
 (0)