@@ -40,28 +40,27 @@ signing {
4040 val key = signingKey.orNull
4141 val password = signingPassword.orNull
4242
43- if (! keyId.isNullOrBlank() && ! key.isNullOrBlank() && ! password.isNullOrBlank()) {
43+ val signingKeysPresent =
44+ ! keyId.isNullOrBlank() && ! key.isNullOrBlank() && ! password.isNullOrBlank()
45+
46+ if (signingKeysPresent) {
4447 useInMemoryPgpKeys(keyId, key, password)
4548 }
4649
4750 // only require signing when publishing to Sonatype
4851 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+ }
5257 })
5358}
5459
5560afterEvaluate {
5661 // Register signatures afterEvaluate, otherwise the signing plugin creates the signing tasks
5762 // 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)
6564}
6665// endregion
6766
@@ -76,44 +75,45 @@ val javadocJarStub by tasks.creating(Jar::class) {
7675
7776
7877publishing {
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()) {
8185 maven(sonatypeRepositoryReleaseUrl) {
8286 name = " SonatypeRelease"
8387 credentials(sonatypeRepositoryCredentials.get())
8488 }
85- // // publish to local dir, for testing
86- // maven(rootProject.layout.buildDirectory.dir("maven-internal")) {
87- // name = "maven-internal"
88- // }
8989 }
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 " )
101101 }
102+ }
102103
103- developers {
104- developer {
105- email.set(" adam@adamko.dev" )
106- }
104+ developers {
105+ developer {
106+ email.set(" adam@adamko.dev" )
107107 }
108+ }
108109
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" )
114114 }
115- artifact(javadocJarStub)
116115 }
116+ artifact(javadocJarStub)
117117 }
118118}
119119
0 commit comments