diff --git a/.craft.yml b/.craft.yml index 900ba86a..118af607 100644 --- a/.craft.yml +++ b/.craft.yml @@ -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)).*$/ diff --git a/.github/workflows/upload-artifacts.yml b/.github/workflows/upload-artifacts.yml index 8cf701d1..3e9de9fd 100644 --- a/.github/workflows/upload-artifacts.yml +++ b/.github/workflows/upload-artifacts.yml @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index 28eba5b6..37c9b62f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/build.gradle.kts b/build.gradle.kts index 7a15ad86..da79214f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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) @@ -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 { @@ -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") } } @@ -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) diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index e9302819..2939b8a3 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -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 { diff --git a/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties b/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties index b85dd285..bef779ab 100644 --- a/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties +++ b/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties @@ -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 diff --git a/sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec b/sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec index e22cd9fd..9cfc4359 100644 --- a/sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec +++ b/sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec @@ -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 " diff --git a/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt b/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt index c523db66..ff4a849d 100644 --- a/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt +++ b/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt @@ -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()) } diff --git a/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt b/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt index 3fac591f..c5fc88c3 100644 --- a/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt +++ b/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt @@ -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()) diff --git a/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock b/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock index 05a32779..8d3f404c 100644 --- a/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock +++ b/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock @@ -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`) @@ -17,8 +17,8 @@ EXTERNAL SOURCES: :path: "../shared" SPEC CHECKSUMS: - Sentry: ee060c09b2f7ec1240e95c766ab44c04c7bdb052 - shared: 4717ae7bad4e94adc1177508d0519ab174142885 + Sentry: 205813e7e758b53df157cedb8c55b31a14300645 + shared: 29ad91c0e6392887a08175041ce5c1ff1cb63ee7 PODFILE CHECKSUM: f282da88f39e69507b0a255187c8a6b644477756 diff --git a/sentry-samples/kmp-app-cocoapods/shared/shared.podspec b/sentry-samples/kmp-app-cocoapods/shared/shared.podspec index 462cf732..87cbe4c3 100644 --- a/sentry-samples/kmp-app-cocoapods/shared/shared.podspec +++ b/sentry-samples/kmp-app-cocoapods/shared/shared.podspec @@ -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 "