|
| 1 | +plugins { |
| 2 | + id("com.gradleup.shadow") version "8.3.6" |
| 3 | + id("com.github.breadmoirai.github-release") version "2.5.2" |
| 4 | + id("com.palantir.git-version") version "3.2.0" |
| 5 | + id("java") |
| 6 | + id("java-library") |
| 7 | + id("signing") |
| 8 | +} |
| 9 | + |
| 10 | +repositories { |
| 11 | + mavenCentral() |
| 12 | +} |
| 13 | + |
| 14 | +dependencies { |
| 15 | + api(libs.org.cryptomator.integrations.api) |
| 16 | + api(libs.org.slf4j.slf4j.api) |
| 17 | + api(libs.org.purejava.keepassxc.proxy.access) |
| 18 | + testImplementation(libs.org.slf4j.slf4j.simple) |
| 19 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.api) |
| 20 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.engine) |
| 21 | + testImplementation(libs.org.junit.jupiter.junit.jupiter) |
| 22 | + testRuntimeOnly(libs.org.junit.platform.junit.platform.launcher) |
| 23 | +} |
| 24 | + |
| 25 | +group = "org.purejava" |
| 26 | +version = gitVersion() // version set by the plugin, based on the Git tag |
| 27 | + |
| 28 | +val releaseGradlePluginToken: String = System.getenv("RELEASE_GRADLE_PLUGIN_TOKEN") ?: "" |
| 29 | + |
| 30 | +java { |
| 31 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 32 | + withSourcesJar() |
| 33 | + withJavadocJar() |
| 34 | +} |
| 35 | + |
| 36 | +tasks.test { |
| 37 | + useJUnitPlatform() |
| 38 | + filter { |
| 39 | + includeTestsMatching("KeePassXCAccessTest") |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +/* |
| 44 | +publishing { |
| 45 | + publications { |
| 46 | + create<MavenPublication>("mavenJava") { |
| 47 | + from(components["java"]) |
| 48 | + pom { |
| 49 | + name.set("keepassxc-cryptomator") |
| 50 | + description.set("Plug-in for Cryptomator to store vault passwords in KeePassXC") |
| 51 | + url.set("https://github.com/purejava/keepassxc-cryptomator") |
| 52 | + licenses { |
| 53 | + license { |
| 54 | + name.set("MIT License") |
| 55 | + url.set("https://opensource.org/licenses/MIT") |
| 56 | + } |
| 57 | + } |
| 58 | + developers { |
| 59 | + developer { |
| 60 | + id.set("purejava") |
| 61 | + name.set("Ralph Plawetzki") |
| 62 | + email.set("ralph@purejava.org") |
| 63 | + } |
| 64 | + } |
| 65 | + scm { |
| 66 | + connection.set("scm:git:git://github.com/purejava/keepassxc-cryptomator.git") |
| 67 | + developerConnection.set("scm:git:ssh://github.com/purejava/keepassxc-cryptomator.git") |
| 68 | + url.set("https://github.com/purejava/keepassxc-cryptomator/tree/main") |
| 69 | + } |
| 70 | + issueManagement { |
| 71 | + system.set("GitHub Issues") |
| 72 | + url.set("https://github.com/purejava/keepassxc-cryptomator/issues") |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | +} |
| 78 | +*/ |
| 79 | + |
| 80 | +tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") { |
| 81 | + archiveClassifier.set("") |
| 82 | +} |
| 83 | + |
| 84 | +tasks.named("githubRelease") { |
| 85 | + dependsOn("sourcesJar") |
| 86 | + dependsOn("javadocJar") |
| 87 | + dependsOn("signArchives") |
| 88 | +} |
| 89 | + |
| 90 | +artifacts { |
| 91 | + add("archives", tasks.named("shadowJar")) |
| 92 | + add("archives", tasks.named("sourcesJar")) |
| 93 | +} |
| 94 | + |
| 95 | +signing { |
| 96 | + useGpgCmd() |
| 97 | + // Sign both the sources JAR and the shadow JAR |
| 98 | + sign(configurations.getByName("archives")) |
| 99 | +} |
| 100 | + |
| 101 | +tasks.withType<JavaCompile> { |
| 102 | + options.encoding = "UTF-8" |
| 103 | +} |
| 104 | + |
| 105 | +tasks.withType<Javadoc> { |
| 106 | + options.encoding = "UTF-8" |
| 107 | + if (JavaVersion.current().isJava9Compatible) { |
| 108 | + (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) |
| 109 | + } |
| 110 | +} |
| 111 | + |
| 112 | +githubRelease { |
| 113 | + setToken(releaseGradlePluginToken) |
| 114 | + tagName = project.version.toString() |
| 115 | + releaseName = project.version.toString() |
| 116 | + setTargetCommitish("main") |
| 117 | + setDraft(true) |
| 118 | + body = """ |
| 119 | + [](https://github.com/purejava/keepassxc-cryptomator/releases/latest/download/keepassxc-cryptomator-${project.version}.jar) |
| 120 | +
|
| 121 | + - xxx |
| 122 | + """.trimIndent() |
| 123 | + releaseAssets = fileTree("${layout.buildDirectory.get()}/libs") { |
| 124 | + include( |
| 125 | + "keepassxc-cryptomator-${version}.jar", |
| 126 | + "keepassxc-cryptomator-${version}.jar.asc", |
| 127 | + "keepassxc-cryptomator-${version}-sources.jar", |
| 128 | + "keepassxc-cryptomator-${version}-sources.jar.asc" |
| 129 | + ) |
| 130 | + }.files |
| 131 | +} |
0 commit comments