File tree 3 files changed +22
-8
lines changed
kotlin-jupyter-publish/src/main/kotlin/org/jetbrains/kotlinx/jupyter
3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
1
package org.jetbrains.kotlinx.jupyter.plugin
2
2
3
+ import de.marcphilipp.gradle.nexus.NexusPublishPlugin
3
4
import org.gradle.api.Plugin
4
5
import org.gradle.api.Project
5
6
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
@@ -11,6 +12,7 @@ class ApiPublishGradlePlugin : Plugin<Project> {
11
12
target.pluginManager.run {
12
13
apply (DokkaPlugin ::class .java)
13
14
apply (MavenPublishPlugin ::class .java)
15
+ apply (NexusPublishPlugin ::class .java)
14
16
apply (SigningPlugin ::class .java)
15
17
}
16
18
}
Original file line number Diff line number Diff line change @@ -17,6 +17,17 @@ fun getNexusPassword(): String? {
17
17
return System .getenv(" SONATYPE_PASSWORD" )
18
18
}
19
19
20
+ fun Project.configureNexusPublish () {
21
+ extensions.configure<NexusPublishExtension >(" nexusPublishing" ) {
22
+ repositories {
23
+ sonatype {
24
+ username.set(getNexusUser())
25
+ password.set(getNexusPassword())
26
+ }
27
+ }
28
+ }
29
+ }
30
+
20
31
fun Project.applyNexusPlugin () {
21
32
pluginManager.run {
22
33
apply (NexusStagingPlugin ::class .java)
@@ -30,12 +41,5 @@ fun Project.applyNexusPlugin() {
30
41
repositoryDescription = " kotlin-jupyter project, v. ${project.version} "
31
42
}
32
43
33
- extensions.configure<NexusPublishExtension >(" nexusPublishing" ) {
34
- repositories {
35
- sonatype {
36
- username.set(getNexusUser())
37
- password.set(getNexusPassword())
38
- }
39
- }
40
- }
44
+ configureNexusPublish()
41
45
}
Original file line number Diff line number Diff line change @@ -109,12 +109,20 @@ fun Project.addPublication(configuration: ArtifactPublication.() -> Unit) {
109
109
}
110
110
111
111
val thisProjectName = project.name
112
+ val thisProject = project
112
113
113
114
if (rootProject.findProperty(" isMainProject" ) == true ) {
114
115
rootProject.tasks {
115
116
named(" publishLocal" ) {
116
117
dependsOn(" :$thisProjectName :publishAllPublicationsToLocalBuildRepository" )
117
118
}
119
+
120
+ if (settings.publishToSonatype) {
121
+ thisProject.configureNexusPublish()
122
+ named(" publishToSonatype" ) {
123
+ dependsOn(" :$thisProjectName :publishToSonatype" )
124
+ }
125
+ }
118
126
}
119
127
}
120
128
You can’t perform that action at this time.
0 commit comments