1- import org.gradle.configurationcache.extensions.capitalized
2-
31plugins {
42 alias(libs.plugins.kotlin.jvm)
53 alias(libs.plugins.multiJvmTesting)
@@ -47,24 +45,25 @@ File(rootProject.rootDir.path + "/src/main/yaml").listFiles()
4745 .apply { check(isNotEmpty()) }
4846 .filter { it.extension == " yml" }
4947 .sortedBy { it.nameWithoutExtension }
50- .forEach {
51- val task by tasks.register<JavaExec >(" run${it.nameWithoutExtension.capitalized()} " ) {
48+ .forEach { simulationFile ->
49+ val simulationName = simulationFile.nameWithoutExtension
50+ val task by tasks.register<JavaExec >(" run${simulationName.replaceFirstChar { it.uppercase() } } " ) {
5251 javaLauncher.set(
5352 javaToolchains.launcherFor {
5453 languageVersion.set(JavaLanguageVersion .of(multiJvm.latestJava))
5554 }
5655 )
5756 group = alchemistGroup
58- description = " Launches simulation ${it.nameWithoutExtension} "
57+ description = " Launches simulation $simulationName "
5958 mainClass.set(" it.unibo.alchemist.Alchemist" )
6059 classpath = sourceSets[" main" ].runtimeClasspath
61- val exportsDir = File (" ${projectDir.path} /build/exports/${it.nameWithoutExtension } " )
60+ val exportsDir = File (" ${projectDir.path} /build/exports/${simulationName } " )
6261 doFirst {
6362 if (! exportsDir.exists()) {
6463 exportsDir.mkdirs()
6564 }
6665 }
67- args(" run" , it.absolutePath )
66+ args(" run" , simulationFile )
6867 if (System .getenv(" CI" ) == " true" || batch == " true" ) {
6968 args(
7069 " --override" ,
@@ -77,7 +76,7 @@ File(rootProject.rootDir.path + "/src/main/yaml").listFiles()
7776 } else {
7877 args(
7978 " --override" ,
80- " { monitors: { type: SwingGUI, parameters: { graphics: \" effects/${it.nameWithoutExtension } .json\" } } }"
79+ " { monitors: { type: SwingGUI, parameters: { graphics: \" effects/${simulationName } .json\" } } }"
8180 )
8281 }
8382 outputs.dir(exportsDir)
0 commit comments