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