Skip to content

Commit

Permalink
MpsExecuteTaskTest: use MpsGenerate for generation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sergej-koscejev committed Jun 26, 2024
1 parent f74c02c commit a1000fe
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/test/kotlin/test/codeexecution/MpsExecuteTaskTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"
Expand Down

0 comments on commit a1000fe

Please sign in to comment.