|
| 1 | +plugins { |
| 2 | + id("java-library") |
| 3 | + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" |
| 4 | + id("maven-publish") |
| 5 | + id("signing") |
| 6 | +} |
| 7 | + |
| 8 | +repositories { |
| 9 | + mavenCentral() |
| 10 | +} |
| 11 | + |
| 12 | +dependencies { |
| 13 | + api(libs.com.github.hypfvieh.dbus.java.core) |
| 14 | + api(libs.com.github.hypfvieh.dbus.java.transport.native.unixsocket) |
| 15 | + api(libs.org.slf4j.slf4j.api) |
| 16 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.api) |
| 17 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.engine) |
| 18 | + testImplementation(libs.org.junit.jupiter.junit.jupiter) |
| 19 | + testImplementation(libs.org.slf4j.slf4j.simple) |
| 20 | + testRuntimeOnly(libs.org.junit.platform.junit.platform.launcher) |
| 21 | +} |
| 22 | + |
| 23 | +group = "org.purejava" |
| 24 | +version = "1.6.1-SNAPSHOT" |
| 25 | +description = "A Java library for storing secrets on linux in a KDE wallet over D-Bus, implements kwallet." |
| 26 | +java.sourceCompatibility = JavaVersion.VERSION_19 |
| 27 | + |
| 28 | +val sonatypeUsername: String = System.getenv("SONATYPE_USERNAME") ?: "" |
| 29 | +val sonatypePassword: String = System.getenv("SONATYPE_PASSWORD") ?: "" |
| 30 | + |
| 31 | +java { |
| 32 | + withSourcesJar() |
| 33 | + withJavadocJar() |
| 34 | +} |
| 35 | + |
| 36 | +tasks.test { |
| 37 | + useJUnitPlatform() |
| 38 | + filter { |
| 39 | + includeTestsMatching("KDEWalletTest") |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +publishing { |
| 44 | + publications { |
| 45 | + create<MavenPublication>("mavenJava") { |
| 46 | + from(components["java"]) |
| 47 | + |
| 48 | + pom { |
| 49 | + name.set("keepassxc-proxy-access") |
| 50 | + description.set("A Java library for storing secrets on linux in a KDE wallet over D-Bus, implements kwallet.") |
| 51 | + url.set("https://github.com/purejava/kdewallet") |
| 52 | + |
| 53 | + licenses { |
| 54 | + license { |
| 55 | + name.set("MIT License") |
| 56 | + url.set("https://opensource.org/licenses/MIT") |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + developers { |
| 61 | + developer { |
| 62 | + id.set("purejava") |
| 63 | + name.set("Ralph Plawetzki") |
| 64 | + email.set("ralph@purejava.org") |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + scm { |
| 69 | + connection.set("scm:git:git://github.com/purejava/kdewallet.git") |
| 70 | + developerConnection.set("scm:git:ssh://github.com/purejava/kdewallet.git") |
| 71 | + url.set("https://github.com/purejava/kdewallet/tree/main") |
| 72 | + } |
| 73 | + |
| 74 | + issueManagement { |
| 75 | + system.set("GitHub Issues") |
| 76 | + url.set("https://github.com/purejava/kdewallet/issues") |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +nexusPublishing { |
| 84 | + repositories { |
| 85 | + sonatype { |
| 86 | + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) |
| 87 | + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) |
| 88 | + username.set(sonatypeUsername) |
| 89 | + password.set(sonatypePassword) |
| 90 | + } |
| 91 | + } |
| 92 | +} |
| 93 | + |
| 94 | +if (!version.toString().endsWith("-SNAPSHOT")) { |
| 95 | + signing { |
| 96 | + useGpgCmd() |
| 97 | + sign(configurations.runtimeElements.get()) |
| 98 | + sign(publishing.publications["mavenJava"]) |
| 99 | + } |
| 100 | +} |
| 101 | + |
| 102 | +tasks.javadoc { |
| 103 | + if (JavaVersion.current().isJava9Compatible) { |
| 104 | + (options as? StandardJavadocDocletOptions)?.addBooleanOption("html5", true) |
| 105 | + } |
| 106 | +} |
| 107 | + |
| 108 | +tasks.withType<Javadoc> { |
| 109 | + isFailOnError = false |
| 110 | +} |
| 111 | + |
| 112 | + |
| 113 | +tasks.withType<JavaCompile> { |
| 114 | + options.encoding = "UTF-8" |
| 115 | +} |
| 116 | + |
| 117 | +tasks.withType<Javadoc> { |
| 118 | + (options as? StandardJavadocDocletOptions)?.encoding = "UTF-8" |
| 119 | +} |
0 commit comments