File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
20
20
21
21
@OptIn(ExperimentalStdlibApi ::class )
22
22
fun Project.publishPluginMarkers (withEmptyJars : Boolean = true) {
23
+
24
+ fun Project.isSonatypePublish (): Boolean =
25
+ hasProperty(" isSonatypePublish" ) && property(" isSonatypePublish" ) as Boolean
26
+
23
27
val pluginDevelopment = extensions.getByType<PluginBundleExtension >()
24
28
val publishingExtension = extensions.getByType<PublishingExtension >()
25
29
val mainPublication = publishingExtension.publications[KotlinBuildPublishingPlugin .PUBLICATION_NAME ] as MavenPublication
@@ -32,7 +36,12 @@ fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
32
36
33
37
tasks.named<PublishToMavenRepository >(
34
38
" publish${markerPublication.name.capitalize(Locale .ROOT )} PublicationTo${KotlinBuildPublishingPlugin .REPOSITORY_NAME } Repository"
35
- ).configureRepository()
39
+ ).apply {
40
+ configureRepository()
41
+ configure {
42
+ onlyIf { ! isSonatypePublish() }
43
+ }
44
+ }
36
45
}
37
46
}
38
47
You can’t perform that action at this time.
0 commit comments