-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
156 lines (128 loc) · 3.81 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
149
150
151
152
153
154
155
156
/*
* Copyright © 2023 Maurits Silvis
* SPDX-License-Identifier: GPL-3.0-or-later
*/
plugins {
application
`maven-publish`
signing
alias(libs.plugins.io.github.gradle.nexus.publish.plugin)
}
group = "nl.mauritssilvis.darts.java"
version = libs.versions.java.darts.get()
repositories {
mavenCentral()
}
dependencies {
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
annotationProcessor(libs.picocli.codegen)
implementation(libs.java.darts.api)
implementation(libs.java.darts.core)
implementation(libs.picocli)
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.params)
testRuntimeOnly(libs.junit.jupiter.engine)
testRuntimeOnly(libs.junit.platform.launcher)
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.jdk.get()))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
withSourcesJar()
withJavadocJar()
}
application {
applicationName = "darts"
mainModule.set("nl.mauritssilvis.darts.java.cli")
mainClass.set("nl.mauritssilvis.darts.java.cli.DartsApp")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("Java darts CLI")
description.set("A Java-based command-line interface for darts, a computational toolbox aimed at the game of darts")
url.set("https://github.com/mauritssilvis/darts")
licenses {
license {
name.set("GNU General Public License v3.0 or later")
url.set("https://spdx.org/licenses/GPL-3.0-or-later.html")
}
}
developers {
developer {
id.set("mauritssilvis")
name.set("Maurits Silvis")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:ssh://[email protected]:mauritssilvis/darts.git")
developerConnection.set("scm:git:ssh://[email protected]:mauritssilvis/darts.git")
url.set("https://github.com/mauritssilvis/darts")
}
}
}
}
repositories {
maven {
name = "buildFolder"
url = uri(layout.buildDirectory.dir("repo"))
}
}
}
signing {
useGpgCmd() // Use the local gpg command
sign(publishing.publications["mavenJava"])
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
tasks {
compileJava {
// Set the location for files generated by picocli
options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
options.javaModuleVersion.set("${project.version}")
}
test {
useJUnitPlatform()
}
jar {
manifest {
attributes(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
"Main-Class" to "nl.mauritssilvis.darts.java.cli.DartsApp"
)
}
}
javadoc {
options.memberLevel = JavadocMemberLevel.PACKAGE
}
installDist {
doLast {
copy {
from(destinationDir)
into(".")
}
}
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<Javadoc> {
options.encoding = "UTF-8"
}
tasks.register<Delete>("cleanDist") {
file("bin").deleteRecursively()
file("lib").deleteRecursively()
}