Skip to content

Commit

Permalink
Fix project information not being included in the maven poms (konform…
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoepelman authored and lnhrdt committed May 12, 2024
1 parent 615cc3e commit d6bf555
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
# Library is built for JVM 1.8, but we run gradle itself with a newer one because we can
# and the publishing plugin requires it
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
Expand Down
46 changes: 27 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import org.jetbrains.kotlin.cli.common.toBooleanLenient
import org.jetbrains.kotlin.config.JvmTarget

val projectVersion = "0.5.0-SNAPSHOT"
val projectName = "konform"
val projectGroup = "io.konform"
val projectDesc = "Konform: Portable validations for Kotlin"
Expand All @@ -10,8 +9,6 @@ val projectOrg = "konform-kt"
val projectLicense = "MIT"
val projectLicenseUrl = "https://opensource.org/licenses/MIT"
val projectScmUrl = "https://github.com/konform-kt/konform.git"
val projectDevelNick = "nlochschmidt"
val projectDevelName = "Niklas Lochschmidt"
val projectInceptionYear = 2018

val kotlinApiTarget = "1.7"
Expand All @@ -35,7 +32,8 @@ repositories {
}

group = projectGroup
version = System.getenv("CI_VERSION") ?: projectVersion
val projectVersion = System.getenv("CI_VERSION") ?: "0.6.0-SNAPSHOT"
version = projectVersion

kotlin {
// Since we are a library, prevent accidentally making things part of the public API
Expand All @@ -57,7 +55,7 @@ kotlin {
}
}
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
languageVersion = JavaLanguageVersion.of(javaVersion)
}
js(IR) {
browser {}
Expand Down Expand Up @@ -107,37 +105,41 @@ kotlin {
}
}
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("1.2.1")
version = "1.2.1"
}

val javaDocJar =
tasks.register<Jar>("stubJavadoc") {
archiveClassifier.set("javadoc")
archiveClassifier = "javadoc"
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
publications.withType(MavenPublication::class) {
artifact(javaDocJar)
pom {
name.set(projectName)
description.set(projectDesc)
url.set("https://github.com/konform-kt/konform")
name = projectName
description = projectDesc
url = "https://github.com/konform-kt/konform"
licenses {
license {
name.set(projectLicense)
url.set(projectLicenseUrl)
distribution.set("repo")
name = projectLicense
url = projectLicenseUrl
distribution = "repo"
}
}
developers {
developer {
id.set(projectDevelNick)
name.set(projectDevelName)
id = "nlochschmidt"
name = "Niklas Lochschmidt"
}
developer {
id = "dhoepelman"
name = "David Hoepelman"
}
}
scm {
url.set(projectScmUrl)
url = projectScmUrl
}
}
}
Expand All @@ -153,14 +155,20 @@ signing {
}
sign(publishing.publications)
}
//region Fix Gradle warning about signing tasks using publishing task outputs without explicit dependencies
// https://github.com/gradle/gradle/issues/26091
tasks.withType<AbstractPublishToMaven>().configureEach {
val signingTasks = tasks.withType<Sign>()
mustRunAfter(signingTasks)
}

nexusPublishing {
repositories {
sonatype {
// Fallback to empty for local and CI builds with no access to the secrets
// They should not need to publish anyway
username.set(System.getenv("MAVEN_CENTRAL_TOKEN_USER") ?: "")
password.set(System.getenv("MAVEN_CENTRAL_TOKEN_PW") ?: "")
username = System.getenv("MAVEN_CENTRAL_TOKEN_USER") ?: ""
password = System.getenv("MAVEN_CENTRAL_TOKEN_PW") ?: ""
}
}
}
Expand Down

0 comments on commit d6bf555

Please sign in to comment.