From a1000fe99c267386833c1338ec364f648e9b2626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergej=20Ko=C5=A1=C4=8Dejev?= Date: Wed, 26 Jun 2024 09:22:26 +0200 Subject: [PATCH] MpsExecuteTaskTest: use MpsGenerate for generation Using the deprecated `generate` extension causes problems because it cannot be properly configured to resolve MPS only once and it causes problems with the `fakeBuildNumber` task. Using `MpsGenerate` task avoids all those problems. --- .../test/codeexecution/MpsExecuteTaskTest.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/kotlin/test/codeexecution/MpsExecuteTaskTest.kt b/src/test/kotlin/test/codeexecution/MpsExecuteTaskTest.kt index df2b0090..af0e136e 100644 --- a/src/test/kotlin/test/codeexecution/MpsExecuteTaskTest.kt +++ b/src/test/kotlin/test/codeexecution/MpsExecuteTaskTest.kt @@ -37,10 +37,10 @@ class MpsExecuteTaskTest { private fun buildScriptBoilerplate(mpsVersion: String) = """ import de.itemis.mps.gradle.tasks.MpsExecute + import de.itemis.mps.gradle.tasks.MpsGenerate plugins { id("de.itemis.mps.gradle.common") - id("generate-models") } repositories { @@ -59,24 +59,24 @@ class MpsExecuteTaskTest { into(layout.buildDirectory.dir("mps")) } - generate { - projectLocation = file("${mpsTestProjectPath.canonicalPath}") - mpsConfig = mps - } - - val generate by tasks.existing { - dependsOn(resolveMps) + val resolvedMpsHome = resolveMps.map { it.destinationDir } + + val generate by tasks.registering(MpsGenerate::class) { + mpsHome.set(layout.dir(resolvedMpsHome)) + projectLocation.set(file("${mpsTestProjectPath.canonicalPath}")) + doFirst { - println(layout.buildDirectory.dir("mps").get().asFile.listFiles()?.toList()) + println(resolvedMpsHome.get().listFiles()?.toList()) } } val execute by tasks.registering(MpsExecute::class) { dependsOn(generate) - mpsHome.set(layout.buildDirectory.dir("mps")) + mpsHome.set(layout.dir(resolvedMpsHome)) projectLocation.set(file("${mpsTestProjectPath.canonicalPath}")) + doFirst { - println(resolveMps.map { it.destinationDir }.get()) + println(resolvedMpsHome.get()) } } """.trimIndent() + "\n"