File tree 2 files changed +41
-4
lines changed
2 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -64,22 +64,24 @@ publishing {
64
64
publications. all {
65
65
MavenCentralKt . configureMavenCentralMetadata(pom, project)
66
66
67
- // add empty javadocs (no need for MPP root publication which publishes only pom file)
68
- if (it. name != ' kotlinMultiplatform' && ! isBom ) {
67
+ // add empty javadocs
68
+ if (! isBom && it. name != " kotlinMultiplatform" ) {
69
69
it. artifact(javadocJar)
70
70
}
71
71
72
72
// Rename MPP artifacts for backward compatibility
73
73
def type = it. name
74
74
switch (type) {
75
75
case ' kotlinMultiplatform' :
76
- it. artifactId = " $project . name -native"
76
+ it. artifactId = " $project . name "
77
+ apply from : " $rootDir /gradle/publish-mpp-root-module-in-platform.gradle"
78
+ publishPlatformArtifactsInRootModule(publications[" jvm" ])
77
79
break
78
80
case ' metadata' :
79
81
it. artifactId = " $project . name -common"
80
82
break
81
83
case ' jvm' :
82
- it. artifactId = " $project . name "
84
+ it. artifactId = " $project . name -jvm "
83
85
break
84
86
case ' js' :
85
87
case ' native' :
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
3
+ */
4
+
5
+
6
+ /* * Publish the platform JAR and POM so that consumers who depend on this module and can't read Gradle module
7
+ metadata can still get the platform artifact and transitive dependencies from the POM: */
8
+ project. ext. publishPlatformArtifactsInRootModule = { platformPublication ->
9
+ def platformPomBuilder = null
10
+
11
+ platformPublication. pom. withXml { platformPomBuilder = asString() }
12
+
13
+ publishing. publications. kotlinMultiplatform {
14
+ platformPublication. artifacts. forEach {
15
+ artifact(it)
16
+ }
17
+
18
+ pom. withXml {
19
+ def pomStringBuilder = asString()
20
+ pomStringBuilder. setLength(0 )
21
+ // The platform POM needs its artifact ID replaced with the artifact ID of the root module:
22
+ def platformPomString = platformPomBuilder. toString()
23
+ platformPomString. eachLine { line ->
24
+ if (! line. contains(" <!--" )) { // Remove the Gradle module metadata marker as it will be added anew
25
+ pomStringBuilder. append(line. replace(platformPublication. artifactId, artifactId))
26
+ pomStringBuilder. append(" \n " )
27
+ }
28
+ }
29
+ }
30
+ }
31
+
32
+ tasks. matching { it. name == " generatePomFileForKotlinMultiplatformPublication" }. configureEach {
33
+ dependsOn(tasks[" generatePomFileFor${ platformPublication.name.capitalize()} Publication" ])
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments