-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle.kts
142 lines (126 loc) · 5.42 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
/*
* Copyright (c) 2021 Andrew Bueide
*
* This file is part of Harry Plotter.
*
* Harry Plotter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Harry Plotter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Harry Plotter. If not, see <https://www.gnu.org/licenses/>.
*/
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
application
kotlin("jvm") version "1.5.20"
kotlin("plugin.serialization") version "1.5.20"
id("org.openjfx.javafxplugin") version "0.0.10"
id("org.beryx.runtime") version "1.12.5"
id("io.gitlab.arturbosch.detekt") version "1.17.0-RC2"
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
}
val jvmOptions = listOf("-Dprism.order=sw")
val currentOs: OperatingSystem = OperatingSystem.current()
val console = false
group = "com.abysl"
version = "1.2.0"
// version = File("src/main/resources/com/abysl/harryplotter/version.txt").readText()
repositories {
mavenCentral()
}
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.17.0-RC2")
implementation("commons-io:commons-io:2.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-javafx:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.2.1")
implementation("io.ktor:ktor-client-core:1.6.0")
implementation("io.ktor:ktor-client-java:1.6.0")
// implementation("io.ktor:ktor-client-okhttp:1.6.0")
// implementation("io.ktor:ktor-client-apache:$1.6.0")
implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("org.kordamp.ikonli:ikonli-core:12.2.0")
implementation("org.kordamp.ikonli:ikonli-javafx:12.2.0")
implementation("org.kordamp.ikonli:ikonli-fontawesome5-pack:12.2.0")
testImplementation("org.jetbrains.kotlin:kotlin-test")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "16"
}
}
tasks.test {
useJUnitPlatform()
}
application {
applicationName = "Harry Plotter"
mainClass.set("com.abysl.harryplotter.HarryPlotterKt")
applicationDefaultJvmArgs = jvmOptions
}
javafx {
version = "17-ea+11"
modules = listOf("javafx.base", "javafx.controls", "javafx.fxml", "javafx.web")
}
val resourcesPath = "build/resources/"
runtime {
options.set(listOf("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages"))
modules.addAll(
listOf(
"jdk.crypto.cryptoki", "java.scripting", "java.xml", "java.logging", "java.prefs", "java.net.http",
"jdk.unsupported"
)
)
launcher {
noConsole = !console
}
jpackage {
appVersion = project.version.toString()
imageName = project.application.applicationName
installerName = "harry-plotter-setup"
installerOptions = listOf(
"--resource-dir", resourcesPath,
"--vendor", "Abysl",
"--description", "You're a farmer, Harry!",
)
if (currentOs.isWindows) {
installerType = "exe"
installerOptions = installerOptions + listOf("--win-per-user-install", "--win-dir-chooser", "--win-menu")
imageOptions = listOf("--icon", "$resourcesPath/main/com/abysl/harryplotter/icons/snitch.ico")
if (console) {
imageOptions = imageOptions + listOf("--win-console")
}
} else if (currentOs.isLinux) {
installerType = "deb"
installerOptions = installerOptions + listOf(
"--linux-shortcut",
)
imageOptions = listOf("--icon", "$resourcesPath/main/com/abysl/harryplotter/icons/snitch.png")
} else if (currentOs.isMacOsX) {
installerType = "pkg"
imageOptions = listOf("--icon", "$resourcesPath/main/com/abysl/harryplotter/icons/snitch.icns")
}
}
}
detekt {
buildUponDefaultConfig = true // preconfigure defaults
allRules = false // activate all available (even unstable) rules.
config =
files("$projectDir/config/detekt/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
baseline = file("$projectDir/config/detekt/baseline.xml") // a way of suppressing issues before introducing detekt
reports {
html.enabled = true // observe findings in your browser with structure and code snippets
xml.enabled = true // checkstyle like format mainly for integrations like Jenkins
txt.enabled = true // similar to the console output, contains issue signature to manually edit baseline files
// standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with Github Code Scanning
sarif.enabled = true
}
}