@@ -17,6 +17,16 @@ def requireEnablePublishing(Task task) {
17
17
}
18
18
}
19
19
20
+ def List<String > pubNames () {
21
+ if (plugins. hasPlugin(' java-gradle-plugin' )) {
22
+ return [' PluginMaven' ]
23
+ } else if (plugins. hasPlugin(' org.jetbrains.kotlin.multiplatform' )) {
24
+ return [' KotlinMultiplatform' , ' Jvm' ]
25
+ } else {
26
+ return [' MavenJava' ]
27
+ }
28
+ }
29
+
20
30
if (tasks. names. contains(' changelogCheck' )) {
21
31
spotlessChangelog {
22
32
branch ' release'
@@ -36,8 +46,9 @@ if (tasks.names.contains('changelogCheck')) {
36
46
if (requireEnablePublishing(it)) {
37
47
if (plugins. hasPlugin(' maven-publish' )) {
38
48
if (plugins. hasPlugin(' io.github.gradle-nexus.publish-plugin' )) {
39
- String pubName = plugins. hasPlugin(' java-gradle-plugin' ) ? ' PluginMaven' : ' MavenJava'
40
- dependsOn " publish${ pubName} PublicationToSonatypeRepository"
49
+ for (pubName in pubNames()) {
50
+ dependsOn " publish${ pubName} PublicationToSonatypeRepository"
51
+ }
41
52
// only the root project has closeSonatypeStagingRepository, and it finalizes all publishToSonatype tasks
42
53
// https://github.com/gradle-nexus/publish-plugin
43
54
dependsOn rootProject. tasks. named(' closeAndReleaseSonatypeStagingRepository' )
@@ -69,8 +80,9 @@ if (tasks.names.contains('changelogCheck')) {
69
80
if (requireEnablePublishing(it)) {
70
81
if (childProject. plugins. hasPlugin(' maven-publish' )) {
71
82
if (rootProject. plugins. hasPlugin(' io.github.gradle-nexus.publish-plugin' )) {
72
- String pubName = childProject. plugins. hasPlugin(' java-gradle-plugin' ) ? ' PluginMaven' : ' MavenJava'
73
- dependsOn childProject. tasks. named(" publish${ pubName} PublicationToSonatypeRepository" )
83
+ for (pubName in pubNames()) {
84
+ dependsOn childProject. tasks. named(" publish${ pubName} PublicationToSonatypeRepository" )
85
+ }
74
86
dependsOn rootProject. tasks. named(' closeAndReleaseSonatypeStagingRepository' )
75
87
} else {
76
88
dependsOn childProject. tasks. named(" publishAllPublicationsToGitLabRepository" )
0 commit comments