diff --git a/build.gradle.kts b/build.gradle.kts index dec15d279..9c6c644f9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2024 kopiLeft Services SARL, Tunis TN + * Copyright (c) 2013-2026 kopiLeft Services SARL, Tunis TN * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,15 +15,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -import org.kopi.galite.gradle._java -import org.kopi.galite.gradle._publishing +import com.vanniktech.maven.publish.JavaLibrary +import com.vanniktech.maven.publish.JavadocJar import org.kopi.galite.gradle.configureMavenCentralPom -import org.kopi.galite.gradle.signPublication plugins { - id("org.jetbrains.kotlin.jvm") version "1.9.0" apply false - id("maven-publish") - id("io.github.gradle-nexus.publish-plugin") version "1.1.0" + id("org.jetbrains.kotlin.jvm") version "1.9.20" apply false + id("com.vanniktech.maven.publish") version "0.34.0" } val releasableProjects = listOf( @@ -67,35 +65,15 @@ subprojects { allprojects { if (this.name in releasableProjects) { apply(plugin = "java-library") - apply(plugin = "maven-publish") - apply(plugin = "signing") - _java { - withJavadocJar() - withSourcesJar() - } + apply(plugin = "com.vanniktech.maven.publish") - _publishing { - publications { - create("Galite") { - artifactId = project.name - from(project.components["java"]) - pom { - configureMavenCentralPom(project) - } - signPublication(project) - } + mavenPublishing { + publishToMavenCentral(automaticRelease = true) + signAllPublications() + configure(JavaLibrary(sourcesJar = true, javadocJar = JavadocJar.Javadoc())) + pom { + configureMavenCentralPom(project) } } } } - -nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) - snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) - username.set(System.getenv("SONATYPE_USERNAME")) - password.set(System.getenv("SONATYPE_PASSWORD")) - } - } -} diff --git a/buildSrc/src/main/kotlin/org/kopi/galite/gradle/Publishing.kt b/buildSrc/src/main/kotlin/org/kopi/galite/gradle/Publishing.kt index 4059f11a2..01a2b0588 100644 --- a/buildSrc/src/main/kotlin/org/kopi/galite/gradle/Publishing.kt +++ b/buildSrc/src/main/kotlin/org/kopi/galite/gradle/Publishing.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2022 kopiLeft Services SARL, Tunis TN + * Copyright (c) 2013-2026 kopiLeft Services SARL, Tunis TN * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -58,19 +58,3 @@ fun MavenPom.configureMavenCentralPom(project: Project) { developerConnection.set("scm:git:git@github.com:kopiLeft/Galite.git") } } - -fun MavenPublication.signPublication(project: Project) { - project.extensions.configure("signing") { - useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), - System.getenv("GPG_PRIVATE_PASSWORD")) - sign(this@signPublication) - } -} - -fun Project._publishing(configure: PublishingExtension.() -> Unit) { - extensions.configure("publishing", configure) -} - -fun Project._java(configure: JavaPluginExtension.() -> Unit) { - extensions.configure("java", configure) -} diff --git a/galite-plugins/build.gradle.kts b/galite-plugins/build.gradle.kts index fb71152fe..1e90a08a3 100644 --- a/galite-plugins/build.gradle.kts +++ b/galite-plugins/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2025 kopiLeft Services SARL, Tunis TN + * Copyright (c) 2013-2026 kopiLeft Services SARL, Tunis TN * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,17 +15,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +import com.vanniktech.maven.publish.GradlePlugin +import com.vanniktech.maven.publish.JavadocJar import org.kopi.galite.gradle.configureMavenCentralPom plugins { - id("maven-publish") - id("signing") + id("com.vanniktech.maven.publish") } subprojects { - apply(plugin = "java-library") - apply(plugin = "maven-publish") - apply(plugin = "signing") + apply(plugin = "java-gradle-plugin") + apply(plugin = "com.vanniktech.maven.publish") dependencies { if (project.name != "galite-common-plugin") { @@ -33,38 +33,15 @@ subprojects { } } - java { - withJavadocJar() - withSourcesJar() - } + mavenPublishing { + publishToMavenCentral(automaticRelease = true) - project.plugins.withId("java-gradle-plugin") { - publishing { - publications { - create("pluginMaven") { - artifactId = project.name - pom { - configureMavenCentralPom(project) - } - signing { - useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PRIVATE_PASSWORD")) - sign(publishing.publications["pluginMaven"]) - } - } - } - } - afterEvaluate { - publishing { - publications.named("PluginMarkerMaven") { - pom { - configureMavenCentralPom(project) - } - } - signing { - useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PRIVATE_PASSWORD")) - sign(publishing.publications["PluginMarkerMaven"]) - } - } + signAllPublications() + + configure(GradlePlugin(javadocJar = JavadocJar.Javadoc(), sourcesJar = true)) + + pom { + configureMavenCentralPom(project) } } } diff --git a/galite-plugins/galite-dbschema-generator/build.gradle.kts b/galite-plugins/galite-dbschema-generator/build.gradle.kts index 4c28c8191..2fdcb8736 100644 --- a/galite-plugins/galite-dbschema-generator/build.gradle.kts +++ b/galite-plugins/galite-dbschema-generator/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2025 kopiLeft Services SARL, Tunis TN + * Copyright (c) 2013-2026 kopiLeft Services SARL, Tunis TN * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,7 @@ plugins { dependencies { api("org.reflections", "reflections", "0.10.2") - implementation("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.9.0") + implementation("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.9.20") // Exposed dependency implementation("org.jetbrains.exposed", "exposed-core", Versions.EXPOSED) implementation("org.jetbrains.exposed", "exposed-jodatime", Versions.EXPOSED) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db9a6b825..a59520664 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists