This repository has been archived by the owner on Jul 16, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
147 lines (131 loc) · 4.21 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
plugins {
checkstyle
jacoco
signing
`java-library`
`java-library-distribution`
`maven-publish`
id("com.github.spotbugs") version "5.0.9"
id("com.diffplug.spotless") version "6.8.0"
id("com.github.kt3k.coveralls") version "2.12.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("com.palantir.git-version") version "0.13.0"
}
// we handle cases without .git directory
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
val details = versionDetails()
val baseVersion = details.lastTag.substring(1)
if (details.isCleanTag) { // release version
version = baseVersion
} else { // snapshot version
version = baseVersion + "-" + details.commitDistance + "-" + details.gitHash + "-SNAPSHOT"
}
group = "io.github.eb4j"
java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.dictzip:dictzip:0.13.0")
implementation("com.github.takawitter:trie4j:0.9.8")
implementation("com.github.ben-manes.caffeine:caffeine:2.9.3")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}
spotbugs {
// excludeFilter.set(project.file("config/spotbugs/exclude.xml"))
tasks.spotbugsMain {
reports.create("html") {
required.set(true)
}
}
tasks.spotbugsTest {
reports.create("html") {
required.set(true)
}
}
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
}
jacoco {
toolVersion="0.8.6"
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
xml.required.set(true) // coveralls plugin depends on xml format report
html.required.set(true)
}
}
coveralls {
jacocoReportPath = "build/reports/jacoco/test/jacocoTestReport.xml"
}
tasks.coveralls {
dependsOn(tasks.jacocoTestReport)
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
}
tasks.withType<JavaCompile> {
options.compilerArgs.add("-Xlint:deprecation")
options.compilerArgs.add("-Xlint:unchecked")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("stardict4j")
description.set("Stardict access library for java")
url.set("https://github.com/eb4j/stardict4j")
licenses {
license {
name.set("The GNU General Public License, Version 3")
url.set("https://www.gnu.org/licenses/licenses/gpl-3.html")
distribution.set("repo")
}
}
developers {
developer {
id.set("miurahr")
name.set("Hiroshi Miura")
email.set("miurahr@linux.com")
}
}
scm {
connection.set("scm:git:git://github.com/eb4j/stardict4j.git")
developerConnection.set("scm:git:git://github.com/eb4j/stardict4j.git")
url.set("https://github.com/eb4j/stardict4j")
}
}
}
}
}
signing {
if (project.hasProperty("signingKey")) {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
} else {
useGpgCmd()
}
sign(publishing.publications["mavenJava"])
}
tasks.withType<Sign> {
val hasKey = project.hasProperty("signingKey") || project.hasProperty("signing.gnupg.keyName")
onlyIf { hasKey && details.isCleanTag }
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("SONATYPE_USER"))
password.set(System.getenv("SONATYPE_PASS"))
}
}
}