@@ -40,28 +40,27 @@ signing {
40
40
val key = signingKey.orNull
41
41
val password = signingPassword.orNull
42
42
43
- if (! keyId.isNullOrBlank() && ! key.isNullOrBlank() && ! password.isNullOrBlank()) {
43
+ val signingKeysPresent =
44
+ ! keyId.isNullOrBlank() && ! key.isNullOrBlank() && ! password.isNullOrBlank()
45
+
46
+ if (signingKeysPresent) {
44
47
useInMemoryPgpKeys(keyId, key, password)
45
48
}
46
49
47
50
// only require signing when publishing to Sonatype
48
51
setRequired({
49
- gradle.taskGraph.allTasks.filterIsInstance<PublishToMavenRepository >().any {
50
- it.repository.name == " SonatypeRelease"
51
- }
52
+ signingKeysPresent
53
+ ||
54
+ gradle.taskGraph.allTasks.filterIsInstance<PublishToMavenRepository >().any {
55
+ it.repository.name == " SonatypeRelease"
56
+ }
52
57
})
53
58
}
54
59
55
60
afterEvaluate {
56
61
// Register signatures afterEvaluate, otherwise the signing plugin creates the signing tasks
57
62
// too early, before all the publications are added.
58
- // Use .all { }, not .configureEach { }, otherwise the signing plugin doesn't create the tasks
59
- // soon enough.
60
-
61
- publishing.publications.withType<MavenPublication >().all {
62
- signing.sign(this )
63
- logger.lifecycle(" configuring signature for publication ${this .name} " )
64
- }
63
+ signing.sign(publishing.publications)
65
64
}
66
65
// endregion
67
66
@@ -76,44 +75,45 @@ val javadocJarStub by tasks.creating(Jar::class) {
76
75
77
76
78
77
publishing {
79
- if (sonatypeRepositoryCredentials.isPresent()) {
80
- repositories {
78
+ repositories {
79
+ // publish to local dir, for testing
80
+ maven(rootProject.layout.buildDirectory.dir(" maven-internal" )) {
81
+ name = " MavenInternal"
82
+ }
83
+
84
+ if (sonatypeRepositoryCredentials.isPresent()) {
81
85
maven(sonatypeRepositoryReleaseUrl) {
82
86
name = " SonatypeRelease"
83
87
credentials(sonatypeRepositoryCredentials.get())
84
88
}
85
- // // publish to local dir, for testing
86
- // maven(rootProject.layout.buildDirectory.dir("maven-internal")) {
87
- // name = "maven-internal"
88
- // }
89
89
}
90
- publications.withType< MavenPublication >().configureEach {
91
- pom {
92
- name.set( " Kotlinx Serialization Typescript Generator " )
93
- description .set(" KxsTsGen creates TypeScript interfaces from Kotlinx Serialization @Serializable classes " )
94
- url .set(" https://github.com/adamko-dev/kotlinx-serialization-typescript-generator " )
95
-
96
- licenses {
97
- license {
98
- name.set( " The Apache License, Version 2.0 " )
99
- url .set(" https://www.apache.org/licenses/LICENSE- 2.0.txt " )
100
- }
90
+ }
91
+ publications.withType< MavenPublication >().configureEach {
92
+ pom {
93
+ name .set(" Kotlinx Serialization Typescript Generator " )
94
+ description .set(" KxsTsGen creates TypeScript interfaces from Kotlinx Serialization @Serializable classes " )
95
+ url.set( " https://github.com/adamko-dev/kotlinx-serialization-typescript-generator " )
96
+
97
+ licenses {
98
+ license {
99
+ name .set(" The Apache License, Version 2.0" )
100
+ url.set( " https://www.apache.org/licenses/LICENSE-2.0.txt " )
101
101
}
102
+ }
102
103
103
- developers {
104
- developer {
105
- email.set(" adam@adamko.dev" )
106
- }
104
+ developers {
105
+ developer {
106
+ email.set(" adam@adamko.dev" )
107
107
}
108
+ }
108
109
109
- scm {
110
- connection.set(" scm:git:git://github.com/adamko-dev/kotlinx-serialization-typescript-generator.git" )
111
- developerConnection.set(" scm:git:ssh://github.com:adamko-dev/kotlinx-serialization-typescript-generator.git" )
112
- url.set(" https://github.com/adamko-dev/kotlinx-serialization-typescript-generator" )
113
- }
110
+ scm {
111
+ connection.set(" scm:git:git://github.com/adamko-dev/kotlinx-serialization-typescript-generator.git" )
112
+ developerConnection.set(" scm:git:ssh://github.com:adamko-dev/kotlinx-serialization-typescript-generator.git" )
113
+ url.set(" https://github.com/adamko-dev/kotlinx-serialization-typescript-generator" )
114
114
}
115
- artifact(javadocJarStub)
116
115
}
116
+ artifact(javadocJarStub)
117
117
}
118
118
}
119
119
0 commit comments