diff --git a/build.gradle.kts b/build.gradle.kts index 92eda19..53a0eba 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,6 +18,10 @@ plugins { kotlin("jvm") version "1.9.22" + id("org.jetbrains.dokka") version "1.9.20" + `java-library` + `maven-publish` + signing } group = "de.philipp-bobek" @@ -29,12 +33,77 @@ repositories { dependencies { testImplementation("org.jetbrains.kotlin:kotlin-test") -} - -tasks.test { - useJUnitPlatform() + testRuntimeOnly("org.junit.platform:junit-platform-launcher") } kotlin { jvmToolchain(17) } + +java { + withJavadocJar() + withSourcesJar() +} + +publishing { + publications { + create("OssLicensesParser") { + from(components["java"]) + pom { + name = "OssLicensesParser" + description = "Parser for the text files generated by the OSS Licenses Gradle Plugin" + url = "https://github.com/Kr0oked/oss-licenses-parser" + licenses { + license { + name = "LGPL-3.0-or-later" + url = "https://www.gnu.org/licenses/lgpl+gpl-3.0.txt" + comments = "GNU Lesser General Public License v3.0 or later" + distribution = "repo" + } + } + developers { + developer { + id = "philipp.bobek" + name = "Philipp Bobek" + email = "philipp.bobek@mailbox.org" + url = "https://philipp-bobek.de" + } + } + scm { + connection = "scm:git:https://github.com/Kr0oked/oss-licenses-parser.git" + developerConnection = "scm:git:https://github.com/Kr0oked/oss-licenses-parser.git" + url = "https://github.com/Kr0oked/oss-licenses-parser" + } + } + } + } + repositories { + maven { + name = "build" + url = uri(layout.buildDirectory.dir("repo")) + } + } +} + +signing { + sign(publishing.publications["OssLicensesParser"]) +} + +tasks.jar { + manifest { + attributes( + mapOf( + "Implementation-Title" to project.name, + "Implementation-Version" to project.version + ) + ) + } +} + +tasks.named("javadocJar") { + from(tasks.named("dokkaJavadoc")) +} + +tasks.test { + useJUnitPlatform() +}