diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..9b48b84 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,2 @@ +val jqwik2Version by rootProject.extra { "2.0.0-alpha-1-SNAPSHOT" } + diff --git a/core/build.gradle.kts b/core/build.gradle.kts index e845dbd..416cc08 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,9 +1,19 @@ plugins { id("buildlogic.java-api-conventions") + `maven-publish` + signing } description = "Jqwik2 core module" +val jqwik2Version: String = "${rootProject.extra.get("jqwik2Version")}" +val isSnapshotRelease = isSnapshotRelease(jqwik2Version) +val artifactName = "jqwik2-core" + +fun isSnapshotRelease(versionString: String): Boolean { + return versionString.endsWith("SNAPSHOT") +} + dependencies { api(libs.apiguardian) //implementation(project(":utilities")) @@ -11,3 +21,68 @@ dependencies { testImplementation(libs.junit.jupiter) testImplementation(libs.assertj.core) } + +tasks.jar { + archiveBaseName.set("jqwik2-core") + archiveVersion.set("${rootProject.extra.get("jqwik2Version")}") + manifest { + attributes("Automatic-Module-Name" to "net.jqwik2.core") + } +} + +publishing { + repositories { + maven { + // hint: credentials are in ~/.gradle/gradle.properties + val repoUsername: String = project.findProperty("tokenUsername") as? String ?: "" + val repoPassword: String = project.findProperty("tokenPassword") as? String ?: "" + + credentials { + username = repoUsername + password = repoPassword + } + + val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + url = uri(if (isSnapshotRelease) { snapshotsRepoUrl } else { releasesRepoUrl }) + } + } + publications { + create("jqwik2Core") { + groupId = "net.jqwik" + artifactId = artifactName + from(components["java"]) + pom { + version = jqwik2Version + groupId = "net.jqwik" + name = artifactId + description = "$description" + url = "https://github.org/jqwik-team/jqwik2" + licenses { + license { + name = "Eclipse Public License - v 2.0" + url = "http://www.eclipse.org/legal/epl-v20.html" + } + } + developers { + developer { + id = "jlink" + name = "Johannes Link" + email = "business@johanneslink.net" + } + } + scm { + connection = "scm:git:git://github.com/jqwik-team/jqwik2.git" + developerConnection = "scm:git:git://github.com/jqwik-team/jqwik2.git" + url = "https://github.com/jqwik-team/jqwik2" + } + } + } + } +} + +signing { + if (!isSnapshotRelease) { + sign(publishing.publications["jqwik2Core"]) + } +} diff --git a/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts b/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts index 4a0563b..10acaeb 100644 --- a/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts +++ b/gradle/plugins/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts @@ -23,7 +23,6 @@ java { languageVersion = JavaLanguageVersion.of(javaVersion) vendor = JvmVendorSpec.matching(javaVendor) } - } tasks.withType { diff --git a/gradle/plugins/src/main/kotlin/buildlogic.java-library-conventions.gradle.kts b/gradle/plugins/src/main/kotlin/buildlogic.java-library-conventions.gradle.kts index d47bdb5..7cdffb4 100644 --- a/gradle/plugins/src/main/kotlin/buildlogic.java-library-conventions.gradle.kts +++ b/gradle/plugins/src/main/kotlin/buildlogic.java-library-conventions.gradle.kts @@ -2,3 +2,8 @@ plugins { id("buildlogic.java-common-conventions") `java-library` } + +java { + withJavadocJar() + withSourcesJar() +} \ No newline at end of file