Skip to content

Commit 1db99f3

Browse files
committed
tidy up opt-ins
1 parent be1b016 commit 1db99f3

File tree

3 files changed

+44
-39
lines changed

3 files changed

+44
-39
lines changed

.github/workflows/workflow_release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ concurrency:
1515

1616

1717
jobs:
18+
log-project-version: # log the project version for manual verification since it's inferred from the git status
19+
uses: ./.github/workflows/run_gradle_task.yml
20+
with:
21+
runs-on: ubuntu-latest
22+
gradle-task: projectVersion
1823

1924
tests:
2025
uses: ./.github/workflows/run_tests.yml

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99

1010
project.group = "dev.adamko.kxstsgen"
1111
project.version = object {
12-
val gitVersion = project.gitVersion
12+
private val gitVersion = project.gitVersion
1313
override fun toString(): String = gitVersion.get()
1414
}
1515

buildSrc/src/main/kotlin/buildsrc/convention/maven-publish.gradle.kts

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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

5560
afterEvaluate {
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

7877
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()) {
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

Comments
 (0)