From 69ef00177bb552bf5c1934fbbd31104f0dc37ccf Mon Sep 17 00:00:00 2001 From: Vaidotas Valuckas Date: Wed, 1 Nov 2023 14:55:20 +0200 Subject: [PATCH] Configure publishing --- gradle.properties | 5 +- gradle/build-logic/build.gradle | 3 ++ gradle/build-logic/settings.gradle | 1 + ...ub.rieske.postgres-cdc.java-library.gradle | 22 ++++++++ ...eske.postgres-cdc.published-library.gradle | 52 +++++++++++++++++++ lib/build.gradle | 7 +-- settings.gradle | 3 ++ 7 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 gradle/build-logic/build.gradle create mode 100644 gradle/build-logic/settings.gradle create mode 100644 gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.java-library.gradle create mode 100644 gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.published-library.gradle diff --git a/gradle.properties b/gradle.properties index 4f996f1..e49568a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ -org.gradle.parallel=true -org.gradle.caching=true +org.gradle.configuration-cache=true +group=io.github.rieske.postgres-cdc +version=0.0.1 diff --git a/gradle/build-logic/build.gradle b/gradle/build-logic/build.gradle new file mode 100644 index 0000000..fbd5c69 --- /dev/null +++ b/gradle/build-logic/build.gradle @@ -0,0 +1,3 @@ +plugins { + id("groovy-gradle-plugin") +} diff --git a/gradle/build-logic/settings.gradle b/gradle/build-logic/settings.gradle new file mode 100644 index 0000000..7fbbd44 --- /dev/null +++ b/gradle/build-logic/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "build-logic" diff --git a/gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.java-library.gradle b/gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.java-library.gradle new file mode 100644 index 0000000..87377fe --- /dev/null +++ b/gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.java-library.gradle @@ -0,0 +1,22 @@ +plugins { + id("java-library") +} + +java { + sourceCompatibility = JavaVersion.VERSION_11 + withSourcesJar() + withJavadocJar() +} + +testing { + suites { + test { + useJUnitJupiter() + } + } +} + +tasks.withType(Javadoc).configureEach { + // TODO: figure the public API and document it! + //options.addStringOption("Xwerror", "-quiet") +} diff --git a/gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.published-library.gradle b/gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.published-library.gradle new file mode 100644 index 0000000..3bc3f92 --- /dev/null +++ b/gradle/build-logic/src/main/groovy/io.github.rieske.postgres-cdc.published-library.gradle @@ -0,0 +1,52 @@ +plugins { + id("io.github.rieske.postgres-cdc.java-library") + id("maven-publish") + id("signing") +} + +publishing { + publications { + maven(MavenPublication) { + from(components.java) + project.afterEvaluate { + pom { + name = "${group}:${project.name}" + description = "${project.description}" + url = "https://github.com/rieske/postgres-cdc" + licenses { + license { + name = "The Apache License, Version 2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + id = "rieske" + name = "Vaidotas Valuckas" + email = "vaidotas.valuckas@gmail.com" + } + } + scm { + connection = "scm:git:git@github.com/rieske/postgres-cdc.git" + developerConnection = "scm:git:ssh@github.com:rieske/postgres-cdc.git" + url = "https://github.com/rieske/postgres-cdc" + } + } + } + } + } + repositories { + maven { + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2") + credentials(PasswordCredentials) + } + } +} + +signing { + def signingKey = findProperty("signingKey") + def signingPassword = findProperty("signingPassword") + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications.maven) +} + diff --git a/lib/build.gradle b/lib/build.gradle index 1653990..bea104c 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,9 +1,5 @@ plugins { - id("java-library") -} - -java { - sourceCompatibility = JavaVersion.VERSION_11 + id("io.github.rieske.postgres-cdc.published-library") } dependencies { @@ -18,7 +14,6 @@ dependencies { testing { suites { test { - useJUnitJupiter() dependencies { implementation("org.testcontainers:postgresql:1.19.1") implementation("org.assertj:assertj-core:3.24.2") diff --git a/settings.gradle b/settings.gradle index e71814e..2edcc06 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,6 @@ +pluginManagement { + includeBuild("gradle/build-logic") +} dependencyResolutionManagement { repositories { mavenCentral()