Skip to content

Commit d72cf37

Browse files
committed
Merge branch 'chore/update-distribution-generation' into cursor/add-js-browser-target-for-sentry-kmp-235a
2 parents 32b61a9 + d9f06ca commit d72cf37

File tree

14 files changed

+282
-246
lines changed

14 files changed

+282
-246
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Internal
6+
7+
- Update `distZip` task to use the locally published artifacts via `publishToMavenLocal` ([#425](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/425))
8+
9+
## 0.15.0
10+
11+
### Enhancements
12+
13+
- Gradle Plugin: implement conditional Cocoa linking for targets ([#421](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/421), [#423](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/423))
14+
15+
### Dependencies
16+
17+
- Bump Cocoa SDK from v8.53.1 to v8.53.2 ([#419](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/419))
18+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8532)
19+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.53.1...8.53.2)
20+
- Bump Java SDK from v8.16.0 to v8.17.0 ([#418](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/418))
21+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8170)
22+
- [diff](https://github.com/getsentry/sentry-java/compare/8.16.0...8.17.0)
23+
324
## 0.14.0
425

526
### Dependencies

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ that can be used on Kotlin Multiplatform.
2020

2121
| Packages | Maven Central
2222
|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
23-
| sentry-kotlin-multiplatform | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-kotlin-multiplatform/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-kotlin-multiplatform)
23+
| sentry-kotlin-multiplatform | [![Maven Central](https://maven-badges.sml.io/sonatype-central/io.sentry/sentry-kotlin-multiplatform/badge.svg?style=flat)](https://central.sonatype.com/artifact/io.sentry/sentry-kotlin-multiplatform)
24+
| sentry-kotlin-multiplatform-gradle-plugin | [![Maven Central](https://maven-badges.sml.io/sonatype-central/io.sentry/sentry-kotlin-multiplatform-gradle-plugin/badge.svg?style=flat)](https://central.sonatype.com/artifact/io.sentry/sentry-kotlin-multiplatform-gradle-plugin)
2425

2526
## Supported Platforms
2627

@@ -48,6 +49,7 @@ Use the Kotlin Multiplatform and Cocoa SDK combinations listed in the table belo
4849
| 0.12.0 | 8.49.0 (Xcode 16.3 compatible) |
4950
| 0.13.0 | 8.49.1 |
5051
| 0.14.0 | 8.53.1 |
52+
| 0.15.0 | 8.53.2 |
5153

5254
## Usage
5355

build.gradle.kts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ subprojects {
3131
apply<DistributionPlugin>()
3232

3333
val sep = File.separator
34+
// The path where we want publishToMavenLocal to output the artifacts to
35+
val buildPublishDir = "${project.layout.buildDirectory.get().asFile.path}${sep}sentry-local-publish$sep"
3436

3537
configure<DistributionContainer> {
36-
this.configureForMultiplatform(this@subprojects)
38+
configureForMultiplatform(this@subprojects, buildPublishDir)
3739
}
3840

3941
tasks.named("distZip").configure {
40-
this.dependsOn("publishToMavenLocal")
41-
this.doLast {
42+
System.setProperty("maven.repo.local", buildPublishDir)
43+
dependsOn("publishToMavenLocal")
44+
doLast {
4245
val distributionFilePath =
43-
"${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
46+
"${project.layout.buildDirectory.get().asFile.path}${sep}distributions${sep}${project.name}-${project.version}.zip"
4447
val file = File(distributionFilePath)
4548
if (!file.exists()) throw GradleException("Distribution file: $distributionFilePath does not exist")
4649
if (file.length() == 0L) throw GradleException("Distribution file: $distributionFilePath is empty")

buildSrc/src/main/java/Config.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ object Config {
3333
object Libs {
3434
val kotlinStd = "org.jetbrains.kotlin:kotlin-stdlib"
3535

36-
val sentryJavaVersion = "8.16.0"
36+
val sentryJavaVersion = "8.17.0"
3737
val sentryAndroid = "io.sentry:sentry-android:$sentryJavaVersion"
3838
val sentryJava = "io.sentry:sentry:$sentryJavaVersion"
3939

40-
val sentryCocoaVersion = "8.53.1"
40+
val sentryCocoaVersion = "8.53.2"
4141
val sentryCocoa = "Sentry"
4242

4343
object Samples {

buildSrc/src/main/java/Publication.kt

Lines changed: 35 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -1,228 +1,47 @@
1+
import org.gradle.api.GradleException
12
import org.gradle.api.Project
23
import org.gradle.api.distribution.DistributionContainer
3-
import org.gradle.api.file.CopySpec
44
import java.io.File
55

6-
val sep: String = File.separator
6+
private val sep: String = File.separator
77

8-
// configure distZip tasks for multiplatform
9-
fun DistributionContainer.configureForMultiplatform(project: Project) {
10-
val version = project.properties["versionName"].toString()
11-
this.getByName("main").contents {
12-
from("build${sep}publications${sep}kotlinMultiplatform") {
13-
renameModule(project.name, version = version)
14-
}
15-
// The current Kotlin version doesn't generate this *-all.jar anymore.
16-
// This is a placeholder for backwards compatibility with craft until we fix it there directly.
17-
from("build${sep}libs") {
18-
include("${project.name}-metadata-$version*")
19-
rename {
20-
it.replace("metadata-$version", "$version-all")
21-
}
22-
}
23-
from("build${sep}kotlinToolingMetadata") {
24-
rename {
25-
it.replace(
26-
"kotlin-tooling-metadata.json",
27-
"${project.name}-$version-kotlin-tooling-metadata.json"
28-
)
29-
}
30-
}
31-
from("build${sep}libs") {
32-
include("${project.name}-kotlin*")
33-
include("${project.name}-metadata*")
34-
withJavadoc(project.name)
35-
rename {
36-
it.replace("multiplatform-kotlin", "multiplatform").replace("-metadata", "")
37-
}
38-
}
39-
}
40-
this.maybeCreate("android").contents {
41-
from("build${sep}publications${sep}androidRelease") {
42-
renameModule(project.name, "android", version)
43-
}
44-
from("build${sep}outputs${sep}aar${sep}${project.name}-release.aar") {
45-
rename {
46-
it.replace("-release", "-android-release")
47-
}
48-
}
49-
from("build${sep}libs") {
50-
include("*android*")
51-
withJavadoc(project.name, "android")
52-
}
53-
}
54-
this.maybeCreate("jvm").contents {
55-
from("build${sep}publications${sep}jvm") {
56-
renameModule(project.name, "jvm", version)
57-
}
58-
from("build${sep}libs$sep") {
59-
include("*jvm*")
60-
withJavadoc(project.name, "jvm")
61-
}
62-
}
63-
this.maybeCreate("iosarm64").contents {
64-
from("build${sep}publications${sep}iosArm64") {
65-
renameModule(project.name, "iosarm64", version)
66-
}
67-
from("build${sep}libs$sep") {
68-
include("${project.name}-iosarm64*")
69-
withJavadoc(project.name, "iosarm64")
70-
}
71-
fromKlib(project.name, "iosArm64", version)
72-
}
73-
this.maybeCreate("iosx64").contents {
74-
from("build${sep}publications${sep}iosX64") {
75-
renameModule(project.name, "iosx64", version)
76-
}
77-
from("build${sep}libs$sep") {
78-
include("${project.name}-iosx64*")
79-
withJavadoc(project.name, "iosx64")
80-
}
81-
fromKlib(project.name, "iosX64", version)
82-
}
83-
this.maybeCreate("iossimulatorarm64").contents {
84-
from("build${sep}publications${sep}iosSimulatorArm64") {
85-
renameModule(project.name, "iossimulatorarm64", version)
86-
}
87-
from("build${sep}libs$sep") {
88-
include("${project.name}-iossimulatorarm64*")
89-
withJavadoc(project.name, "iossimulatorarm64")
90-
}
91-
fromKlib(project.name, "iosSimulatorArm64", version)
92-
}
93-
this.maybeCreate("macosarm64").contents {
94-
from("build${sep}publications${sep}macosArm64") {
95-
renameModule(project.name, "macosarm64", version)
96-
}
97-
from("build${sep}libs$sep") {
98-
include("${project.name}-macosarm64*")
99-
withJavadoc(project.name, "macosarm64")
100-
}
101-
fromKlib(project.name, "macosArm64", version)
102-
}
103-
this.maybeCreate("macosx64").contents {
104-
from("build${sep}publications${sep}macosX64") {
105-
renameModule(project.name, "macosx64", version)
106-
}
107-
from("build${sep}libs$sep") {
108-
include("${project.name}-macosx64*")
109-
withJavadoc(project.name, "macosx64")
110-
}
111-
fromKlib(project.name, "macosX64", version)
112-
}
113-
this.maybeCreate("watchosx64").contents {
114-
from("build${sep}publications${sep}watchosX64") {
115-
renameModule(project.name, "watchosx64", version)
116-
}
117-
from("build${sep}libs$sep") {
118-
include("${project.name}-watchosx64*")
119-
withJavadoc(project.name, "watchosx64")
120-
}
121-
fromKlib(project.name, "watchosX64", version)
122-
}
123-
this.maybeCreate("watchosarm32").contents {
124-
from("build${sep}publications${sep}watchosArm32") {
125-
renameModule(project.name, "watchosarm32", version)
126-
}
127-
from("build${sep}libs$sep") {
128-
include("${project.name}-watchosarm32*")
129-
withJavadoc(project.name, "watchosarm32")
130-
}
131-
fromKlib(project.name, "watchosArm32", version)
132-
}
133-
this.maybeCreate("watchosarm64").contents {
134-
from("build${sep}publications${sep}watchosArm64") {
135-
renameModule(project.name, "watchosarm64", version)
136-
}
137-
from("build${sep}libs$sep") {
138-
include("${project.name}-watchosarm64*")
139-
withJavadoc(project.name, "watchosarm64")
140-
}
141-
fromKlib(project.name, "watchosArm64", version)
142-
}
143-
this.maybeCreate("watchossimulatorarm64").contents {
144-
from("build${sep}publications${sep}watchosSimulatorArm64") {
145-
renameModule(project.name, "watchossimulatorarm64", version)
146-
}
147-
from("build${sep}libs$sep") {
148-
include("${project.name}-watchossimulatorarm64*")
149-
withJavadoc(project.name, "watchossimulatorarm64")
150-
}
151-
fromKlib(project.name, "watchosSimulatorArm64", version)
152-
}
153-
this.maybeCreate("tvosarm64").contents {
154-
from("build${sep}publications${sep}tvosArm64") {
155-
renameModule(project.name, "tvosarm64", version)
156-
}
157-
from("build${sep}libs$sep") {
158-
include("${project.name}-tvosarm64*")
159-
withJavadoc(project.name, "tvosarm64")
160-
}
161-
fromKlib(project.name, "tvosArm64", version)
162-
}
163-
this.maybeCreate("tvosx64").contents {
164-
from("build${sep}publications${sep}tvosX64") {
165-
renameModule(project.name, "tvosx64", version)
166-
}
167-
from("build${sep}libs$sep") {
168-
include("${project.name}-tvosx64*")
169-
withJavadoc(project.name, "tvosx64")
170-
}
171-
fromKlib(project.name, "tvosX64", version)
172-
}
173-
this.maybeCreate("tvossimulatorarm64").contents {
174-
from("build${sep}publications${sep}tvosSimulatorArm64") {
175-
renameModule(project.name, "tvossimulatorarm64", version)
176-
}
177-
from("build${sep}libs$sep") {
178-
include("${project.name}-tvossimulatorarm64*")
179-
withJavadoc(project.name, "tvossimulatorarm64")
180-
}
181-
fromKlib(project.name, "tvosSimulatorArm64", version)
182-
}
183-
}
8+
fun DistributionContainer.configureForMultiplatform(project: Project, buildPublishDir: String) {
9+
val version = project.property("versionName").toString()
10+
if (version.isEmpty()) {
11+
throw GradleException("DistZip: version name is empty")
12+
}
13+
val projectName = project.name
14+
val platforms = mapOf(
15+
"main" to projectName,
16+
"android" to "$projectName-android",
17+
"jvm" to "$projectName-jvm",
18+
"iosarm64" to "$projectName-iosarm64",
19+
"iossimulatorarm64" to "$projectName-iossimulatorarm64",
20+
"iosx64" to "$projectName-iosx64",
21+
"macosarm64" to "$projectName-macosarm64",
22+
"macosx64" to "$projectName-macosx64",
23+
"tvosarm64" to "$projectName-tvosarm64",
24+
"tvossimulatorarm64" to "$projectName-tvossimulatorarm64",
25+
"tvosx64" to "$projectName-tvosx64",
26+
"watchosarm32" to "$projectName-watchosarm32",
27+
"watchosarm64" to "$projectName-watchosarm64",
28+
"watchossimulatorarm64" to "$projectName-watchossimulatorarm64",
29+
"watchosx64" to "$projectName-watchosx64"
30+
)
18431

185-
private fun CopySpec.fromKlib(projectName: String, target: String, version: String) {
186-
val pos = projectName.length
187-
from("build${sep}classes${sep}kotlin${sep}${target}${sep}main${sep}cinterop") {
188-
include("*.klib")
189-
rename {
190-
it.replaceRange(pos, pos, "-${target.lowercase()}-$version")
191-
}
192-
}
193-
from("build${sep}classes${sep}kotlin${sep}${target}${sep}main${sep}klib") {
194-
rename {
195-
"$projectName-${target.lowercase()}-$version.klib"
196-
}
197-
}
198-
}
32+
platforms.forEach { (distName, projectName) ->
33+
val distribution = if (distName == "main") getByName("main") else maybeCreate(distName)
34+
distribution.contents {
35+
val basePath = "${buildPublishDir}io${sep}sentry${sep}$projectName$sep$version"
19936

200-
private fun CopySpec.renameModule(projectName: String, renameTo: String = "", version: String) {
201-
var target = ""
202-
if (renameTo.isNotEmpty()) {
203-
target = "-$renameTo"
204-
}
205-
rename {
206-
it.replace("module.json", "$projectName$target-$version.module")
207-
}
208-
}
37+
// Rename the POM since craft looks for pom-default.xml
38+
from("$basePath$sep$projectName-$version.pom") {
39+
rename { "pom-default.xml" }
40+
}
20941

210-
private fun CopySpec.withJavadoc(projectName: String, renameTo: String = "") {
211-
include("*javadoc*")
212-
rename { fileName ->
213-
when {
214-
"javadoc" in fileName -> {
215-
val newName = buildString {
216-
append(fileName.substring(0, projectName.length))
217-
if (renameTo.isNotEmpty()) {
218-
append('-')
219-
append(renameTo)
220-
}
221-
append(fileName.substring(projectName.length))
222-
}
223-
newName
42+
from(basePath) {
43+
exclude("*.pom")
22444
}
225-
else -> fileName
22645
}
22746
}
22847
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android.useAndroidX=true
88
compose.version=1.3.1-rc01
99

1010
# Release information
11-
versionName=0.14.0
11+
versionName=0.15.0
1212

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

sentry-kotlin-multiplatform-gradle-plugin/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies {
2525
testImplementation(libs.junit)
2626
testImplementation(libs.junit.params)
2727
testImplementation(libs.mockk)
28+
testImplementation(libs.truth)
2829
}
2930

3031
tasks.test {

sentry-kotlin-multiplatform-gradle-plugin/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
id=io.sentry.kotlin.multiplatform.gradle
22
implementationClass=io.sentry.kotlin.multiplatform.gradle.SentryPlugin
3-
versionName=0.14.0
3+
versionName=0.15.0
44
group=io.sentry
5-
sentryCocoaVersion=8.53.1
5+
sentryCocoaVersion=8.53.2
66

77
# publication pom properties
88
POM_NAME=Sentry Kotlin Multiplatform Gradle Plugin

sentry-kotlin-multiplatform-gradle-plugin/gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover"}
1818
junit = "org.junit.jupiter:junit-jupiter-api:5.10.3"
1919
junit-params = "org.junit.jupiter:junit-jupiter-params:5.10.3"
2020
mockk = "io.mockk:mockk:1.13.12"
21+
truth = { module = "com.google.truth:truth", version = "1.4.4" }

0 commit comments

Comments
 (0)