11import org.gradle.internal.os.OperatingSystem
22import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+ import org.gradle.process.ExecOperations
34import java.util.Properties
45
5- val minJavaVersion = JavaVersion .VERSION_11
6+ val minJavaVersion = JavaVersion .VERSION_17
67plugins {
7- val minJavaVersion = JavaVersion .VERSION_11 // Declared twice because plugins block has its own scope
8+ val minJavaVersion = JavaVersion .VERSION_17 // Declared twice because plugins block has its own scope
89 require(JavaVersion .current() >= minJavaVersion) {
910 " Building requires at least JDK $minJavaVersion - please look into the README"
1011 }
1112
1213 application
13- kotlin(" jvm" ) version " 1.9.25 "
14+ kotlin(" jvm" ) version " 2.3.0 "
1415 id(" idea" )
1516 id(" org.openjfx.javafxplugin" ) version " 0.1.0"
16- id(" com.github.johnrengelman. shadow" ) version " 6.1.0 "
17+ id(" com.gradleup. shadow" ) version " 9.3.1 "
1718
18- id(" com.github.ben-manes.versions" ) version " 0.47 .0"
19- id(" se.patrikerdes.use-latest-versions" ) version " 0.2.18 "
19+ id(" com.github.ben-manes.versions" ) version " 0.53 .0"
20+ id(" se.patrikerdes.use-latest-versions" ) version " 0.2.19 "
2021}
2122
2223idea {
@@ -44,7 +45,7 @@ version = try {
4445println (" Current version: $version (Java version: ${JavaVersion .current()} )" )
4546
4647application {
47- mainClassName = " sc.gui.GuiAppKt" // needs shadow-update which needs gradle update to 7.0
48+ mainClass.set( " sc.gui.GuiAppKt" ) // needs shadow-update which needs gradle update to 7.0
4849}
4950
5051repositories {
@@ -92,14 +93,14 @@ tasks {
9293 }
9394 }
9495 withType<KotlinCompile > {
95- kotlinOptions {
96- jvmTarget = minJavaVersion.toString()
97- freeCompilerArgs = listOf (" -Xjvm-default=all" )
96+ compilerOptions {
97+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl. JvmTarget .fromTarget( minJavaVersion.toString()) )
98+ freeCompilerArgs.addAll (" -Xjvm-default=all" )
9899 }
99100 }
100101
101102 withType<Jar > {
102- manifest.attributes[" Main-Class" ] = application.mainClassName
103+ manifest.attributes[" Main-Class" ] = application.mainClass.get()
103104 }
104105
105106 javafx {
@@ -113,7 +114,7 @@ tasks {
113114 }
114115
115116 shadowJar {
116- destinationDirectory.set(buildDir )
117+ destinationDirectory.set(layout.buildDirectory.asFile.get() )
117118 archiveClassifier.set(
118119 " ${
119120 OperatingSystem .current().familyName.replace(
@@ -140,24 +141,28 @@ tasks {
140141
141142 run.configure {
142143 dependsOn(backend.task(" :server:makeRunnable" ))
143- workingDir(buildDir .resolve(" run" ))
144+ workingDir(layout.buildDirectory.asFile.get() .resolve(" run" ))
144145 doFirst {
145146 workingDir.mkdirs()
146147 }
147148 args = System .getProperty(" args" , " " ).split(" " )
148149 }
149150
150- val release by creating {
151+ val release by registering {
151152 dependsOn(clean, check)
152153 group = " distribution"
153154 description = " Create and push a tagged commit matching the backend version"
154155 doLast {
155156 val desc = project.properties[" m" ]?.toString()
156157 ? : throw InvalidUserDataException (" Das Argument -Pm=\" Beschreibung dieser Version\" wird benötigt" )
157- exec { commandLine(" git" , " add" , " CHANGELOG.md" ) }
158- exec { commandLine(" git" , " commit" , " -m" , " release: v$versionFromBackend " ) }
159- exec { commandLine(" git" , " tag" , versionFromBackend, " -m" , desc) }
160- exec { commandLine(" git" , " push" , " --follow-tags" , " --recurse-submodules=on-demand" ) }
158+ val processHelper: (Array <String >) -> Unit = { args ->
159+ val process = ProcessBuilder (* args).start()
160+ process.waitFor()
161+ }
162+ processHelper(arrayOf(" git" , " add" , " CHANGELOG.md" ))
163+ processHelper(arrayOf(" git" , " commit" , " -m" , " release: v$versionFromBackend " ))
164+ processHelper(arrayOf(" git" , " tag" , versionFromBackend, " -m" , desc))
165+ processHelper(arrayOf(" git" , " push" , " --follow-tags" , " --recurse-submodules=on-demand" ))
161166 }
162167 }
163168}
0 commit comments