|
| 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 | +val gitHubPackagesUser: String = System.getenv("PACKAGES_USER") ?: "" |
| 11 | +val gitHubPackagesToken: String = System.getenv("PACKAGES_ACCESS_TOKEN") ?: "" |
| 12 | +val releaseGradlePluginToken: String = System.getenv("RELEASE_GRADLE_PLUGIN_TOKEN") ?: "" |
| 13 | + |
| 14 | +repositories { |
| 15 | + mavenLocal() |
| 16 | + maven { |
| 17 | + name = "GitHubPackages" |
| 18 | + url = uri("https://maven.pkg.github.com/bitwarden/sdk") |
| 19 | + credentials { |
| 20 | + username = gitHubPackagesUser |
| 21 | + password = gitHubPackagesToken |
| 22 | + } |
| 23 | + } |
| 24 | + maven { |
| 25 | + url = uri("https://repo.maven.apache.org/maven2/") |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +dependencies { |
| 30 | + api(libs.org.cryptomator.integrations.api) |
| 31 | + api(libs.com.bitwarden.sdk.secrets) |
| 32 | + api(libs.org.slf4j.slf4j.api) |
| 33 | + testImplementation(libs.org.slf4j.slf4j.simple) |
| 34 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.api) |
| 35 | + testImplementation(libs.org.junit.jupiter.junit.jupiter.engine) |
| 36 | + testImplementation(libs.org.junit.jupiter.junit.jupiter) |
| 37 | + testRuntimeOnly(libs.org.junit.platform.junit.platform.launcher) |
| 38 | +} |
| 39 | + |
| 40 | +group = "org.purejava" |
| 41 | +val gitVersion: groovy.lang.Closure<String> by extra |
| 42 | +version = gitVersion() // version set by the plugin, based on the Git tag |
| 43 | + |
| 44 | +java { |
| 45 | + sourceCompatibility = JavaVersion.VERSION_20 |
| 46 | + withSourcesJar() |
| 47 | + withJavadocJar() |
| 48 | +} |
| 49 | + |
| 50 | +tasks.test { |
| 51 | + useJUnitPlatform() |
| 52 | + filter { |
| 53 | + includeTestsMatching("BitwardenAccessTest") |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +// Optional publishing section commented out |
| 58 | +/* |
| 59 | +publishing { |
| 60 | + publications { |
| 61 | + create<MavenPublication>("mavenJava") { |
| 62 | + from(components["java"]) |
| 63 | + pom { |
| 64 | + name.set("cryptomator-bitwarden") |
| 65 | + description.set("Plug-in for Cryptomator to store vault passwords in Bitwarden") |
| 66 | + url.set("https://github.com/purejava/cryptomator-bitwarden") |
| 67 | + licenses { |
| 68 | + license { |
| 69 | + name.set("MIT License") |
| 70 | + url.set("https://opensource.org/licenses/MIT") |
| 71 | + } |
| 72 | + } |
| 73 | + developers { |
| 74 | + developer { |
| 75 | + id.set("purejava") |
| 76 | + name.set("Ralph Plawetzki") |
| 77 | + |
| 78 | + } |
| 79 | + } |
| 80 | + scm { |
| 81 | + connection.set("scm:git:git://github.com/purejava/cryptomator-bitwarden.git") |
| 82 | + developerConnection.set("scm:git:ssh://github.com/purejava/cryptomator-bitwarden.git") |
| 83 | + url.set("https://github.com/purejava/cryptomator-bitwarden/tree/develop") |
| 84 | + } |
| 85 | + issueManagement { |
| 86 | + system.set("GitHub Issues") |
| 87 | + url.set("https://github.com/purejava/cryptomator-bitwarden/issues") |
| 88 | + } |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | +} |
| 93 | +*/ |
| 94 | + |
| 95 | +tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") { |
| 96 | + archiveClassifier.set("") |
| 97 | +} |
| 98 | + |
| 99 | +tasks.named("githubRelease") { |
| 100 | + dependsOn("sourcesJar") |
| 101 | + dependsOn("javadocJar") |
| 102 | + dependsOn("signArchives") |
| 103 | +} |
| 104 | + |
| 105 | +artifacts { |
| 106 | + archives(tasks.named("shadowJar")) |
| 107 | + archives(tasks.named("sourcesJar")) |
| 108 | +} |
| 109 | + |
| 110 | +signing { |
| 111 | + useGpgCmd() |
| 112 | + sign(configurations.archives.get()) |
| 113 | +} |
| 114 | + |
| 115 | +githubRelease { |
| 116 | + token(releaseGradlePluginToken) |
| 117 | + tagName = project.version.toString() |
| 118 | + releaseName = project.version.toString() |
| 119 | + targetCommitish = "develop" |
| 120 | + draft = true |
| 121 | + body = """ |
| 122 | + [](https://github.com/purejava/cryptomator-bitwarden/releases/latest/download/cryptomator-bitwarden-${project.version}.jar) |
| 123 | +
|
| 124 | + - xxx |
| 125 | + """.trimIndent() |
| 126 | + generateReleaseNotes = true |
| 127 | + releaseAssets.from( |
| 128 | + fileTree("${layout.buildDirectory.get()}/libs") { |
| 129 | + include( |
| 130 | + "cryptomator-bitwarden-${version}.jar", |
| 131 | + "cryptomator-bitwarden-${version}.jar.asc", |
| 132 | + "cryptomator-bitwarden-${version}-sources.jar", |
| 133 | + "cryptomator-bitwarden-${version}-sources.jar.asc" |
| 134 | + ) |
| 135 | + } |
| 136 | + ) |
| 137 | +} |
| 138 | + |
| 139 | +tasks.withType<JavaCompile> { |
| 140 | + options.encoding = "UTF-8" |
| 141 | +} |
| 142 | + |
| 143 | +tasks.withType<Javadoc> { |
| 144 | + if (JavaVersion.current().isJava9Compatible) { |
| 145 | + (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) |
| 146 | + } |
| 147 | + (options as StandardJavadocDocletOptions).encoding = "UTF-8" |
| 148 | +} |
0 commit comments