-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
185 lines (164 loc) · 5.34 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
185 lines (164 loc) · 5.34 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
import java.util.*
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
`java-library`
application
kotlin("jvm") version "1.9.22"
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
group = "org.openbase"
description =
"PlanetSudo is a reactive multi-agent simulation game. This package contains the game engine of PlanetSudo."
val releaseVersion = !version.toString().endsWith("-SNAPSHOT")
kotlin {
jvmToolchain(21)
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = sourceCompatibility
withSourcesJar()
withJavadocJar()
}
repositories {
mavenLocal()
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
mavenCentral()
}
dependencies {
api(libs.org.openbase.jul.processing.json)
api(libs.org.openbase.jul.visual.swing)
api(libs.org.openbase.jul.schedule)
api(libs.org.openbase.jul.audio)
api(libs.org.openbase.jul.`interface`)
api(libs.org.jdesktop.beansbinding)
api(libs.tomcat.tomcat.util)
api(libs.commons.io.commons.io)
// https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation(kotlin("stdlib-jdk8"))
testImplementation(libs.org.jetbrains.kotlin.test.junit5)
testImplementation(libs.io.mockk)
testImplementation(libs.org.amshove.kluent)
}
nexusPublishing {
repositories {
sonatype {
username.set(findProperty("MAVEN_CENTRAL_USERNAME")?.let { it as String? })
password.set(findProperty("MAVEN_CENTRAL_TOKEN")?.let { it as String? })
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<Javadoc> {
options.encoding = "UTF-8"
}
tasks.withType<Test> {
useJUnitPlatform()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set(rootProject.name)
description.set(rootProject.description)
url.set("https://github.com/openbase/planetsudo")
inceptionYear.set("2009")
organization {
name.set("openbase.org")
url.set("https://openbase.org")
}
licenses {
license {
name.set("GPLv3")
url.set("https://www.gnu.org/licenses/gpl.html")
}
}
developers {
developer {
id.set("DivineThreepwood")
name.set("Marian Pohling")
email.set("divine@openbase.org")
url.set("https://github.com/DivineThreepwood")
organizationUrl.set("https://github.com/openbase")
organization.set("openbase.org")
roles.set(listOf("architect", "developer"))
timezone.set("+1")
}
}
scm {
connection.set("scm:git:https://github.com/openbase/planetsudo.engine.git")
developerConnection.set("scm:git:https://github.com/openbase/planetsudo.engine.git")
url.set("https://github.com/openbase/planetsudo.engine.git")
}
}
}
}
}
signing {
val privateKey = findProperty("OPENBASE_GPG_PRIVATE_KEY")
?.let { it as String? }
?.let { Base64.getDecoder().decode(it) }
?.let { String(it) }
?: run {
// Signing skipped because of missing private key.
return@signing
}
val passphrase = findProperty("OPENBASE_GPG_PRIVATE_KEY_PASSPHRASE")
?.let { it as String? }
?.let { Base64.getDecoder().decode(it) }
?.let { String(it) }
?: ""
useInMemoryPgpKeys(
privateKey,
passphrase,
)
sign(publishing.publications["mavenJava"])
}
tasks.javadoc {
include("**/AgentBasicInterface.kt", "**/MothershipInterface.kt")
}
tasks.build {
dependsOn("ktlintFormat")
}
tasks.register<Copy>("copyPreCommitHook") {
description = "Copy pre-commit git hook from utils to the .git/hooks folder."
group = "git hooks"
outputs.upToDateWhen { false }
from("$rootDir/.git-utils/pre-commit")
into("$rootDir/.git/hooks/")
}
ktlint {
disabledRules.set(setOf("no-wildcard-imports"))
filter {
exclude { entry -> entry.file.toString().contains("generated") }
}
reporters {
reporter(ReporterType.PLAIN)
reporter(ReporterType.HTML)
reporter(ReporterType.CHECKSTYLE)
}
}
application {
mainClass.set("org.openbase.planetsudo.main.Main")
}