Skip to content

Commit b0cf738

Browse files
committed
🔨 improve build reproducibility and enhance publication metadata
1 parent 6a0170c commit b0cf738

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

qs-kotlin/build.gradle.kts

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.gradle.jvm.tasks.Jar
12
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
23
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
34
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -18,6 +19,11 @@ java {
1819

1920
jacoco { toolVersion = "0.8.13" }
2021

22+
tasks.withType<Jar>().configureEach {
23+
isPreserveFileTimestamps = false
24+
isReproducibleFileOrder = true
25+
}
26+
2127
tasks.withType<KotlinCompile> {
2228
compilerOptions.apply {
2329
jvmTarget.set(JvmTarget.JVM_17)
@@ -63,35 +69,60 @@ publishing {
6369
description.set(
6470
"A query string encoding and decoding library for Android and Kotlin/JVM. Ported from qs for JavaScript."
6571
)
66-
url.set("https://github.com/techouse/qs-kotlin")
72+
url.set("https://techouse.github.io/qs-kotlin/")
73+
inceptionYear.set("2025")
6774
licenses {
6875
license {
69-
name.set("BSD-3-Clause License")
70-
url.set("https://opensource.org/license/bsd-3-clause")
76+
name.set("BSD-3-Clause")
77+
url.set("https://github.com/techouse/qs-kotlin/blob/main/LICENSE")
78+
distribution.set("repo")
7179
}
7280
}
7381
scm {
7482
connection.set("scm:git:https://github.com/techouse/qs-kotlin.git")
7583
developerConnection.set("scm:git:ssh://[email protected]/techouse/qs-kotlin.git")
7684
url.set("https://github.com/techouse/qs-kotlin")
85+
tag.set("HEAD")
86+
}
87+
issueManagement {
88+
system.set("GitHub Issues")
89+
url.set("https://github.com/techouse/qs-kotlin/issues")
90+
}
91+
ciManagement {
92+
system.set("GitHub Actions")
93+
url.set("https://github.com/techouse/qs-kotlin/actions")
7794
}
7895
developers {
7996
developer {
8097
id.set("techouse")
8198
name.set("Klemen Tusar")
8299
email.set("[email protected]")
83100
url.set("https://github.com/techouse")
101+
roles.set(listOf("Lead", "Maintainer"))
102+
timezone.set("Europe/London")
103+
properties.put("twitter", "https://x.com/nextk2")
104+
properties.put("linkedin", "https://www.linkedin.com/in/techouse/")
105+
properties.put("sponsor", "https://github.com/sponsors/techouse")
106+
properties.put("paypal", "https://paypal.me/ktusar")
84107
}
85108
}
109+
properties.put(
110+
"changelogUrl",
111+
"https://github.com/techouse/qs_codec/blob/master/CHANGELOG.md",
112+
)
86113
}
87114
}
88115
}
89116
}
90117

91118
signing {
92-
useInMemoryPgpKeys(
93-
providers.gradleProperty("signingInMemoryKey").getOrElse(""),
94-
providers.gradleProperty("signingInMemoryKeyPassword").getOrElse(""),
95-
)
96-
sign(publishing.publications)
119+
val hasKey = providers.gradleProperty("signingInMemoryKey").isPresent
120+
isRequired = hasKey && !project.version.toString().endsWith("SNAPSHOT")
121+
if (hasKey) {
122+
useInMemoryPgpKeys(
123+
providers.gradleProperty("signingInMemoryKey").get(),
124+
providers.gradleProperty("signingInMemoryKeyPassword").getOrElse(""),
125+
)
126+
sign(publishing.publications)
127+
}
97128
}

0 commit comments

Comments
 (0)