@@ -62,7 +62,6 @@ internal val ALLOWED_KOTLIN_NATIVE_PUBLICATION_NAMES = setOf(
6262 " iosArm64" ,
6363 " iosSimulatorArm64" ,
6464 " iosX64" ,
65-
6665 " linuxArm64" ,
6766 " linuxX64" ,
6867 " macosArm64" ,
@@ -321,14 +320,22 @@ fun Project.configureJReleaser() {
321320 return
322321 }
323322
324- // Collect a set of native artifact IDs from every project
323+ // Collect a set of native artifact IDs (with platform suffix removed) from every project
325324 val nativeArtifactIds = providers.provider {
326325 allprojects.flatMap {
327326 it.extensions.findByType(PublishingExtension ::class .java)
328327 ?.publications
329328 ?.withType(MavenPublication ::class .java)
330329 ?.filter { it.name in ALLOWED_KOTLIN_NATIVE_PUBLICATION_NAMES }
331- ?.map { it.artifactId }
330+ ?.map {
331+ // Remove platform from artifact ID. This allows us to register artifact overrides for _all_ platforms,
332+ // not just for the targets enabled on the current host.
333+ var artifactIdWithoutPlatform = it.artifactId
334+ ALLOWED_KOTLIN_NATIVE_PUBLICATION_NAMES .forEach { platform ->
335+ artifactIdWithoutPlatform = artifactIdWithoutPlatform.removeSuffix(" -${platform.lowercase()} " )
336+ }
337+ artifactIdWithoutPlatform
338+ }
332339 ? : emptySet()
333340 }.toSet()
334341 }
@@ -368,14 +375,17 @@ fun Project.configureJReleaser() {
368375 verifyPom = false // JReleaser fails when processing <packaging>toml</packaging> tag: `Unknown packaging: toml`
369376 }
370377 gradle.projectsEvaluated {
371- nativeArtifactIds.get().forEach {
372- artifactOverride {
373- artifactId = it
374- jar = false // Native artifacts produce klibs, not JARs
375- verifyPom = false // JReleaser fails when processing <packaging>klib</packaging> tag: `Unknown packaging: klib`
378+ nativeArtifactIds.get().forEach { artifactIdWithoutPlatform ->
379+ // Add an artifact override rule for each platform
380+ ALLOWED_KOTLIN_NATIVE_PUBLICATION_NAMES .forEach { platform ->
381+ logger.info(" Configuring JReleaser artifact override for $artifactIdWithoutPlatform -${platform.lowercase()} " )
382+ artifactOverride {
383+ artifactId = " $artifactIdWithoutPlatform -${platform.lowercase()} "
384+ jar = false // Native artifacts produce klibs, not JARs
385+ verifyPom = false // JReleaser fails when processing <packaging>klib</packaging> tag: `Unknown packaging: klib`
386+ }
376387 }
377388 }
378- logger.info(" Configured JReleaser artifact overrides for the following artifacts: ${nativeArtifactIds.get().joinToString()} " )
379389 }
380390 }
381391 maxRetries = 100
0 commit comments