-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle.kts
179 lines (157 loc) · 4.76 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import org.gradle.internal.os.OperatingSystem
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE
import java.time.LocalDate
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.serialization)
alias(libs.plugins.ktlint)
application
alias(libs.plugins.shadow)
alias(libs.plugins.runtime)
`maven-publish`
}
apply {
plugin<DownloadJavadocsPlugin>()
}
repositories {
mavenCentral()
maven {
url = uri("https://nexus.inductiveautomation.com/repository/inductiveautomation-releases/")
}
maven {
url = uri("https://nexus.inductiveautomation.com/repository/inductiveautomation-thirdparty/")
}
maven {
url = uri("https://jitpack.io")
content {
includeGroup("com.github.Dansoftowner")
}
}
}
dependencies {
// see gradle/libs.version.toml
api(libs.serialization.json)
api(libs.xerial.jdbc)
api(libs.hsql)
api(libs.zip4j)
api(libs.miglayout)
api(libs.jide.common)
api(libs.swingx)
api(libs.logback)
api(libs.svgSalamander)
api(libs.bundles.coroutines)
api(libs.bundles.flatlaf)
api(libs.bundles.ignition) {
// Exclude transitive IA dependencies - we only need core Ignition classes for cache deserialization
isTransitive = false
}
api(libs.excelkt)
api(libs.jfreechart)
api(libs.rsyntaxtextarea)
implementation(libs.osthemedetector)
runtimeOnly(libs.bundles.ia.transitive)
testImplementation(libs.bundles.kotest)
}
group = "io.github.paulgriffith"
application {
mainClass.set("io.github.paulgriffith.kindling.MainPanel")
}
tasks {
test {
useJUnitPlatform()
}
val cleanupJDeploy by registering(Delete::class) {
delete("jdeploy", "jdeploy-bundle")
}
clean {
finalizedBy(cleanupJDeploy)
}
shadowJar {
manifest {
attributes["Main-Class"] = "io.github.paulgriffith.kindling.MainPanel"
}
archiveBaseName.set("kindling-bundle")
archiveClassifier.set("")
archiveVersion.set("")
mergeServiceFiles()
}
register("printVersion") {
doLast { // add a task action
println(project.version)
}
}
}
kotlin {
jvmToolchain(libs.versions.java.map(String::toInt).get())
}
ktlint {
reporters {
reporter(CHECKSTYLE)
}
}
runtime {
options.set(listOf("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages"))
modules.set(
listOf(
"java.desktop",
"java.sql",
"java.logging",
"java.naming",
"java.xml",
"jdk.zipfs",
),
)
jpackage {
val currentOs = OperatingSystem.current()
val imgType = if (currentOs.isWindows) "ico" else "png"
appVersion = project.version.toString()
imageOptions = listOf("--icon", "src/main/resources/icons/ignition.$imgType")
val options: Map<String, String?> = buildMap {
put("resource-dir", "src/main/resources")
put("vendor", "Paul Griffith")
put("copyright", LocalDate.now().year.toString())
put("description", "A collection of useful tools for troubleshooting Ignition")
when {
currentOs.isWindows -> {
put("win-per-user-install", null)
put("win-dir-chooser", null)
put("win-menu", null)
put("win-shortcut", null)
// random (consistent) UUID makes upgrades smoother
put("win-upgrade-uuid", "8e7428c8-bbc6-460a-9995-db6d8b04a690")
}
currentOs.isLinux -> {
put("linux-shortcut", null)
}
}
}
// add-exports is used to bypass Java modular restrictions
jvmArgs = listOf("--add-exports", "java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED")
installerOptions = options.flatMap { (key, value) ->
listOfNotNull("--$key", value)
}
imageName = "kindling"
installerName = "kindling"
mainJar = "kindling-bundle.jar"
}
}
configure<PublishingExtension> {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/paul-griffith/kindling")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
register<MavenPublication>("gpr") {
from(components["kotlin"])
pom {
description.set("Kindling core API and first-party tools, packaged for ease of extension by third parties.")
}
}
}
}