From 671451fb6752e79820ae7cb4074ce9e4eb036559 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 26 Jul 2023 12:53:13 +0200 Subject: [PATCH] [stdlib-mpp] publish legacy MPP common metadata additionally in a variant under 'common' classifier --- libraries/stdlib/build.gradle.kts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/libraries/stdlib/build.gradle.kts b/libraries/stdlib/build.gradle.kts index 15386d2c323..04a486a444e 100644 --- a/libraries/stdlib/build.gradle.kts +++ b/libraries/stdlib/build.gradle.kts @@ -743,6 +743,18 @@ publishing { variant("jvmSourcesElements") variant("metadataApiElements") + variant("commonMainMetadataElementsWithClassifier") { + name = "commonMainMetadataElements" + configuration { + isCanBeConsumed = false + } + attributes { + copyAttributes(from = project.configurations["commonMainMetadataElements"].attributes, to = this) + } + artifact(tasks["metadataJar"]) { + classifier = "common" + } + } variant("metadataSourcesElementsFromJvm") { name = "metadataSourcesElements" configuration { @@ -784,16 +796,15 @@ publishing { } } - // TODO: decide what should be published in kotlin-stdlib-common + // we cannot publish legacy common artifact with metadata in kotlin-stdlib-common + // because it will cause problems in explicitly configured stdlib dependencies in project // val common = module("commonModule") { // mavenPublication { -// groupId = "org.example" -// artifactId = "sample-lib-common" -// } -// variant("commonMainMetadataElements") { -// // Multiplatform KGP already added klib artifact to metadataApiElements -// // attributes { kotlinLegacyMetadataAttributes() } +// artifactId = "$artifactBaseName-common" +// configureKotlinPomAttributes(project, "Kotlin Common Standard Library (for compatibility with legacy multiplatform)") +// artifact(tasks["sourcesJar"]) // publish sources.jar just for maven, without including it in Gradle metadata // } +// variant("commonMainMetadataElements") // } val js = module("jsModule") { mavenPublication {