Skip to content

Commit

Permalink
Merge branch 'main' into release/0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Oct 17, 2024
2 parents 2aa98e3 + abf8a8e commit f738c20
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ targets:
mavenRepoUrl: https://oss.sonatype.org/service/local/staging/deploy/maven2/
android:
distDirRegex: /^(sentry-android-|.*-android).*$/
fileReplaceeRegex: /\d\.\d\.\d(-\w+(\.\d)?)?(-SNAPSHOT)?/
fileReplaceeRegex: /\d+\.\d+\.\d+(-\w+(\.\d+)?)?(-SNAPSHOT)?/
fileReplacerStr: release.aar
kmp:
rootDistDirRegex: /^(?!.*(?:jvm|android|ios|watchos|tvos|macos)).*$/
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/upload-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
cd sentry-kotlin-multiplatform-gradle-plugin
./gradlew distZip sentryPluginMarkerDistZip
- name: Validate distributions
run: |
./gradlew validateDistributions
- name: Archive packages
uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Sentry.init { options ->

### Dependencies

- Bump Cocoa SDK from v8.36.0 to v8.37.0 ([#279](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/279))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8370)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.36.0...8.37.0)
- Bump Cocoa SDK from v8.36.0 to v8.38.0 ([#279](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/279), [#285](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/285))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8380)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.36.0...8.38.0)
- Bump Java SDK from v7.14.0 to v7.15.0 ([#284](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/284))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7150)
- [diff](https://github.com/getsentry/sentry-java/compare/7.14.0...7.15.0)
Expand Down
100 changes: 97 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import com.diffplug.spotless.LineEnding
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.MavenPublishPluginExtension
import io.gitlab.arturbosch.detekt.Detekt
import java.util.zip.ZipFile

plugins {
id(Config.gradleMavenPublishPlugin).version(Config.gradleMavenPublishPluginVersion)
Expand All @@ -15,7 +16,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).apply(false)
id(Config.QualityPlugins.binaryCompatibility).version(Config.QualityPlugins.binaryCompatibilityVersion)
.apply(false)
}

allprojects {
Expand All @@ -39,8 +41,8 @@ subprojects {
val distributionFilePath =
"${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
val file = File(distributionFilePath)
if (!file.exists()) throw IllegalStateException("Distribution file: $distributionFilePath does not exist")
if (file.length() == 0L) throw IllegalStateException("Distribution file: $distributionFilePath is empty")
if (!file.exists()) throw GradleException("Distribution file: $distributionFilePath does not exist")
if (file.length() == 0L) throw GradleException("Distribution file: $distributionFilePath is empty")
}
}

Expand All @@ -61,6 +63,98 @@ subprojects {
}
}

tasks.register("validateDistributions") {
subprojects {
val subproject = this@subprojects
if (subproject.name == "sentry-kotlin-multiplatform") {
subproject.validateKotlinMultiplatformCoreArtifacts()
}
}
}

private fun Project.validateKotlinMultiplatformCoreArtifacts() {
val distributionDir = project.layout.buildDirectory.dir("distributions").get().asFile
val expectedNumOfFiles = 15
val filesList = distributionDir.listFiles()
val actualNumOfFiles = filesList?.size ?: 0

if (actualNumOfFiles == expectedNumOfFiles) {
println("✅ Found $actualNumOfFiles distribution files as expected.")
} else {
throw GradleException("❌ Expected $expectedNumOfFiles distribution files, but found $actualNumOfFiles")
}

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

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()) {
throw GradleException("❌ Artifact file: ${artifactFile.path} does not exist")
}
if (artifactFile.length() == 0L) {
throw GradleException("❌ Artifact file: ${artifactFile.path} is empty")
}

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

commonRequiredEntries.forEach { requiredEntry ->
if (entries.none { it.contains(requiredEntry) }) {
throw GradleException("$requiredEntry not found in ${artifactFile.name}")
} else {
println("✅ Found $requiredEntry in ${artifactFile.name}")
}
}

when {
artifactFile.name.contains("ios", ignoreCase = true) ||
artifactFile.name.contains("macos", ignoreCase = true) ||
artifactFile.name.contains("watchos", ignoreCase = true) ||
artifactFile.name.contains("tvos", ignoreCase = true) -> {
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")
} else {
println("✅ Found $expectedNumOfKlibFiles klib files in ${artifactFile.name}")
}
}

artifactFile.name.contains("android", ignoreCase = true) -> {
if (entries.none { it.contains("aar") }) {
throw GradleException("❌ aar file not found in ${artifactFile.name}")
} else {
println("✅ Found aar file in ${artifactFile.name}")
}
}
}
}
}
}

subprojects {
if (project.name.contains("sentry-kotlin-multiplatform")) {
apply(plugin = Config.dokka)
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Config {
val sentryAndroid = "io.sentry:sentry-android:$sentryJavaVersion"
val sentryJava = "io.sentry:sentry:$sentryJavaVersion"

val sentryCocoaVersion = "8.37.0"
val sentryCocoaVersion = "8.38.0"
val sentryCocoa = "Sentry"

object Samples {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ id=io.sentry.kotlin.multiplatform.gradle
implementationClass=io.sentry.kotlin.multiplatform.gradle.SentryPlugin
versionName=0.10.0
group=io.sentry
sentryCocoaVersion=8.37.0
sentryCocoaVersion=8.38.0

# publication pom properties
POM_NAME=Sentry Kotlin Multiplatform Gradle Plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Pod::Spec.new do |spec|
spec.osx.deployment_target = '10.13'
spec.tvos.deployment_target = '11.0'
spec.watchos.deployment_target = '4.0'
spec.dependency 'Sentry', '8.37.0'
spec.dependency 'Sentry', '8.38.0'

if !Dir.exist?('build/cocoapods/framework/sentry_kotlin_multiplatform.framework') || Dir.empty?('build/cocoapods/framework/sentry_kotlin_multiplatform.framework')
raise "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ internal fun SentryOptions.toIosOptionsConfiguration(): (CocoaSentryOptions?) ->
"errorSampleRate" to kmpOptions.experimental.sessionReplay.onErrorSampleRate?.toFloat()
)
).apply {
setRedactAllText(kmpOptions.experimental.sessionReplay.maskAllText)
setRedactAllImages(kmpOptions.experimental.sessionReplay.maskAllImages)
setMaskAllText(kmpOptions.experimental.sessionReplay.maskAllText)
setMaskAllImages(kmpOptions.experimental.sessionReplay.maskAllImages)
kmpOptions.experimental.sessionReplay.sessionSampleRate?.let { setSessionSampleRate(it.toFloat()) }
setQuality(kmpOptions.experimental.sessionReplay.quality.ordinal.toLong())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ actual fun ApplePlatformOptions.assertApplePlatformSpecificOptions(options: Sent
assertEquals(attachViewHierarchy, options.attachViewHierarchy)
assertEquals(enableAppHangTracking, options.enableAppHangTracking)
assertEquals(appHangTimeoutIntervalMillis, options.appHangTimeoutIntervalMillis)
assertEquals(sessionReplay.redactAllText(), options.experimental.sessionReplay.maskAllText)
assertEquals(sessionReplay.redactAllImages(), options.experimental.sessionReplay.maskAllImages)
assertEquals(sessionReplay.maskAllText(), options.experimental.sessionReplay.maskAllText)
assertEquals(sessionReplay.maskAllImages(), options.experimental.sessionReplay.maskAllImages)
assertEquals(sessionReplay.onErrorSampleRate().toDouble(), options.experimental.sessionReplay.onErrorSampleRate)
assertEquals(sessionReplay.sessionSampleRate().toDouble(), options.experimental.sessionReplay.sessionSampleRate)
assertEquals(sessionReplay.quality(), options.experimental.sessionReplay.quality.ordinal.toLong())
Expand Down
12 changes: 6 additions & 6 deletions sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Sentry (8.37.0):
- Sentry/Core (= 8.37.0)
- Sentry/Core (8.37.0)
- Sentry (8.38.0):
- Sentry/Core (= 8.38.0)
- Sentry/Core (8.38.0)
- shared (1.0):
- Sentry (= 8.37.0)
- Sentry (= 8.38.0)

DEPENDENCIES:
- shared (from `../shared`)
Expand All @@ -17,8 +17,8 @@ EXTERNAL SOURCES:
:path: "../shared"

SPEC CHECKSUMS:
Sentry: ee060c09b2f7ec1240e95c766ab44c04c7bdb052
shared: 4717ae7bad4e94adc1177508d0519ab174142885
Sentry: 205813e7e758b53df157cedb8c55b31a14300645
shared: 29ad91c0e6392887a08175041ce5c1ff1cb63ee7

PODFILE CHECKSUM: f282da88f39e69507b0a255187c8a6b644477756

Expand Down
2 changes: 1 addition & 1 deletion sentry-samples/kmp-app-cocoapods/shared/shared.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.vendored_frameworks = 'build/cocoapods/framework/shared.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '14.1'
spec.dependency 'Sentry', '8.37.0'
spec.dependency 'Sentry', '8.38.0'

if !Dir.exist?('build/cocoapods/framework/shared.framework') || Dir.empty?('build/cocoapods/framework/shared.framework')
raise "
Expand Down

0 comments on commit f738c20

Please sign in to comment.