|
| 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.org.slf4j.slf4j.api) |
| 14 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.api) |
| 15 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.engine) |
| 16 | + testImplementation(libs.org.junit.jupiter.junit.jupiter) |
| 17 | + testImplementation(libs.org.slf4j.slf4j.simple) |
| 18 | +} |
| 19 | + |
| 20 | +group = "org.purejava" |
| 21 | +version = "1.4.3-SNAPSHOT" |
| 22 | +description = "Java bindings for libappindicator-gtk3 in 100% pure Java" |
| 23 | + |
| 24 | +java { |
| 25 | + sourceCompatibility = JavaVersion.VERSION_22 |
| 26 | + withSourcesJar() |
| 27 | + withJavadocJar() |
| 28 | +} |
| 29 | + |
| 30 | +val sonatypeUsername: String = System.getenv("SONATYPE_USERNAME") ?: "" |
| 31 | +val sonatypePassword: String = System.getenv("SONATYPE_PASSWORD") ?: "" |
| 32 | + |
| 33 | +tasks.test { |
| 34 | + useJUnitPlatform() |
| 35 | + filter { |
| 36 | + includeTestsMatching("AppIndicatorTest") |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +publishing { |
| 41 | + publications { |
| 42 | + create<MavenPublication>("mavenJava") { |
| 43 | + from(components["java"]) |
| 44 | + pom { |
| 45 | + name.set("libappindicator-gtk3-java-full") |
| 46 | + description.set("Java bindings for libappindicator-gtk3 in 100% pure Java") |
| 47 | + url.set("https://github.com/purejava/appindicator-gtk3-java") |
| 48 | + licenses { |
| 49 | + license { |
| 50 | + name.set("MIT License") |
| 51 | + url.set("https://opensource.org/licenses/MIT") |
| 52 | + } |
| 53 | + } |
| 54 | + developers { |
| 55 | + developer { |
| 56 | + id.set("purejava") |
| 57 | + name.set("Ralph Plawetzki") |
| 58 | + |
| 59 | + } |
| 60 | + } |
| 61 | + scm { |
| 62 | + connection.set("scm:git:git://github.com/purejava/appindicator-gtk3-java.git") |
| 63 | + developerConnection.set("scm:git:ssh://github.com/purejava/appindicator-gtk3-java.git") |
| 64 | + url.set("https://github.com/purejava/appindicator-gtk3-java/tree/develop") |
| 65 | + } |
| 66 | + issueManagement { |
| 67 | + system.set("GitHub Issues") |
| 68 | + url.set("https://github.com/purejava/appindicator-gtk3-java/issues") |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | +nexusPublishing { |
| 76 | + repositories { |
| 77 | + sonatype { |
| 78 | + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) |
| 79 | + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) |
| 80 | + username.set(sonatypeUsername) |
| 81 | + password.set(sonatypePassword) |
| 82 | + } |
| 83 | + } |
| 84 | +} |
| 85 | + |
| 86 | +if (!version.toString().endsWith("-SNAPSHOT")) { |
| 87 | + signing { |
| 88 | + useGpgCmd() |
| 89 | + sign(configurations.runtimeElements.get()) |
| 90 | + sign(publishing.publications["mavenJava"]) |
| 91 | + } |
| 92 | +} |
| 93 | + |
| 94 | +tasks.withType<Javadoc> { |
| 95 | + failOnError = false |
| 96 | + (options as StandardJavadocDocletOptions).encoding = "UTF-8" |
| 97 | + if (JavaVersion.current().isJava9Compatible) { |
| 98 | + (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) |
| 99 | + } |
| 100 | +} |
| 101 | + |
| 102 | +tasks.withType<JavaCompile> { |
| 103 | + options.encoding = "UTF-8" |
| 104 | +} |
0 commit comments