diff --git a/build.gradle.kts b/build.gradle.kts index 55c53e1..93b48af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,16 +44,6 @@ import java.nio.file.LinkOption * along with this program. If not, see . */ -// Buildscript -buildscript { - // Repositories - repositories { - mavenLocal() - mavenCentral() - gradlePluginPortal() - } -} - // Plugins plugins { id("java-library") @@ -113,8 +103,8 @@ allprojects { // Java java { // Java version - sourceCompatibility = JavaVersion.valueOf("VERSION_${property("languageJava") as String}") - targetCompatibility = JavaVersion.valueOf("VERSION_${property("languageJava") as String}") + sourceCompatibility = JavaVersion.toVersion(property("languageJava") as String) + targetCompatibility = JavaVersion.toVersion(property("languageJava") as String) if (!(hasProperty("java.skipToolchainSpecification") && property("java.skipToolchainSpecification") as String == "true")) toolchain { @@ -130,7 +120,7 @@ allprojects { verbose = true // Set target metadata - jvmTarget = JvmTarget.valueOf("JVM_${property("languageJava") as String}") + jvmTarget = JvmTarget.fromTarget(property("languageJava") as String) } // Unit testing @@ -218,17 +208,17 @@ allprojects { // -> Copy task tasks.register("copyGitProperties") { dependsOn(tasks.generateGitProperties) + inputs.file("${project.projectDir}/build/resources/main/git.properties") doLast { if (rootProject == project) return@doLast - val target: File = file("${project.projectDir}/src/main/resources/sosengine-${project.name.replace(":", "-")}-git.properties") - val source: File = file("${project.projectDir}/build/resources/main/git.properties") - - if (Files.exists(target.toPath(), LinkOption.NOFOLLOW_LINKS)) - Files.delete(target.toPath()) - Files.move(source.toPath(), target.toPath()) + file(inputs.files.first()) + .copyTo( + file("${project.projectDir}/src/main/resources/sosengine-${project.name.replace(":", "-")}-git.properties"), + overwrite = true + ) } } tasks.processResources { @@ -238,16 +228,17 @@ allprojects { // Gradle properties // -> Copy task tasks.register("copyGradleProperties") { + inputs.file("${project(":").projectDir.path}/gradle.properties") + doLast { if (rootProject == project) return@doLast - val target: File = file("${project.projectDir}/src/main/resources/sosengine-${project.name.replace(":", "-")}-gradle.properties") - val source: File = file("${project(":").projectDir.path}/gradle.properties") - - if (Files.exists(target.toPath(), LinkOption.NOFOLLOW_LINKS)) - Files.delete(target.toPath()) - Files.copy(source.toPath(), target.toPath()) + file(inputs.files.first()) + .copyTo( + file("${project.projectDir}/src/main/resources/sosengine-${project.name.replace(":", "-")}-gradle.properties"), + overwrite = true + ) } } tasks.processResources { diff --git a/settings.gradle.kts b/settings.gradle.kts index 901fc8c..3d4dc50 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,13 +17,19 @@ * along with this program. If not, see . */ +// Plugin management +pluginManagement { + repositories { + mavenLocal() + mavenCentral() + gradlePluginPortal() + } +} + // Project settings rootProject.name = "sos!engine" // Subprojects -// -> Root -include("") - // -> Base include("base") diff --git a/testapp/build.gradle.kts b/testapp/build.gradle.kts index c069440..ddbc122 100644 --- a/testapp/build.gradle.kts +++ b/testapp/build.gradle.kts @@ -32,7 +32,7 @@ dependencies { // Configure JAR tasks.withType { manifest { - attributes.put("Main-Class", "de.staropensource.engine.testapp.Main") + attributes["Main-Class"] = "de.staropensource.engine.testapp.Main" } } @@ -41,24 +41,37 @@ application { mainClass = "de.staropensource.engine.testapp.Main" // JVM arguments - val jvmArgs: MutableList = mutableListOf() - // -> JVM - jvmArgs.add("-XX:+UnlockDiagnosticVMOptions") + applicationDefaultJvmArgs = buildList { + // Unlock more VM options + add("-XX:+UnlockDiagnosticVMOptions") + add("-XX:+UnlockExperimentalVMOptions") - if (hasProperty("jvm.logGC") && property("jvm.logGC") as String == "true") - jvmArgs.add("-Xlog:gc") - if (hasProperty("jvm.logJITandAOT") && property("jvm.logJITandAOT") as String == "true") { - jvmArgs.add("-XX:+PrintCompilation") - jvmArgs.add("-XX:+PrintInlining") - } - if (hasProperty("jvm.garbageCollector")) - when (property("jvm.garbageCollector")) { - "epsilon" -> jvmArgs.add("-XX:+UseEpsilonGC") - "serial" -> jvmArgs.add("-XX:+UseSerialGC") - "g1" -> jvmArgs.add("-XX:+UseG1GC") + // VM settings + // -> Log garbage collection + if ( + hasProperty("jvm.logGC") + && property("jvm.logGC") as String == "true" + ) + add("-Xlog:gc") + + // -> Log JIT & AOT + if ( + hasProperty("jvm.logJITandAOT") + && property("jvm.logJITandAOT") as String == "true" + ) { + add("-XX:+PrintCompilation") + add("-XX:+PrintInlining") } - // -> Jansi - jvmArgs.add("-Djansi.mode=force") - applicationDefaultJvmArgs = jvmArgs + // -> Select garbage collector + if (hasProperty("jvm.garbageCollector")) + when (property("jvm.garbageCollector")) { + "epsilon" -> add("-XX:+UseEpsilonGC") + "serial" -> add("-XX:+UseSerialGC") + "g1" -> add("-XX:+UseG1GC") + } + + // Jansi + add("-Djansi.mode=force") + } }