diff --git a/connector/build.gradle.kts b/connector/build.gradle.kts index 2eaae15..93ac316 100644 --- a/connector/build.gradle.kts +++ b/connector/build.gradle.kts @@ -10,12 +10,14 @@ repositories { } dependencies { + implementation("dk.au.ece.vdmj:vdmj:4.5.0") testImplementation("org.jetbrains.kotlin:kotlin-test") } tasks.test { useJUnitPlatform() } + kotlin { - jvmToolchain(17) -} \ No newline at end of file + jvmToolchain(21) +} diff --git a/connector/gradle/wrapper/gradle-wrapper.jar b/connector/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 249e583..0000000 Binary files a/connector/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/connector/gradle/wrapper/gradle-wrapper.properties b/connector/gradle/wrapper/gradle-wrapper.properties index 83836a5..9f57aa1 100644 --- a/connector/gradle/wrapper/gradle-wrapper.properties +++ b/connector/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Mar 29 14:51:10 CET 2024 +#Fri Mar 29 17:41:10 CET 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/connector/src/main/kotlin/Main.kt b/connector/src/main/kotlin/Main.kt index 75050c3..a2da457 100644 --- a/connector/src/main/kotlin/Main.kt +++ b/connector/src/main/kotlin/Main.kt @@ -1,16 +1,6 @@ package io.anthonyberg -//TIP To Run code, press or -// click the icon in the gutter. fun main() { - val name = "Kotlin" - //TIP Press with your caret at the highlighted text - // to see how IntelliJ IDEA suggests fixing it. - println("Hello, " + name + "!") - - for (i in 1..5) { - //TIP Press to start debugging your code. We have set one breakpoint - // for you, but you can always add more by pressing . - println("i = $i") - } -} \ No newline at end of file + // Open VDMJ + val VDMJ = VDMJ() +} diff --git a/connector/src/main/kotlin/VDMJ.kt b/connector/src/main/kotlin/VDMJ.kt new file mode 100644 index 0000000..02d27e7 --- /dev/null +++ b/connector/src/main/kotlin/VDMJ.kt @@ -0,0 +1,33 @@ +package io.anthonyberg + +import com.fujitsu.vdmj.ExitStatus +import com.fujitsu.vdmj.Settings +import com.fujitsu.vdmj.config.Properties +import com.fujitsu.vdmj.plugins.Lifecycle +import com.fujitsu.vdmj.plugins.VDMJ +import kotlin.system.exitProcess + +/** + * Handler for the VDM Model + */ +class VDMJ { + init { + Settings.mainClass = VDMJ::class.java + Properties.init() + + val lifecycle: Lifecycle = createLifecycle() + + exitProcess(if (lifecycle.run() == ExitStatus.EXIT_OK) 0 else 1) + } + + /** + * Creates arguments for VDMJ + */ + private fun createLifecycle(): Lifecycle { + // Creates the arguments for VDMJ - i.e. where the file is located + val args: Array = arrayOf("resources/checklist.vdmsl") + + return Lifecycle(args) + } + +} diff --git a/connector/src/main/resources/checklist.vdmsl b/connector/src/main/resources/checklist.vdmsl new file mode 120000 index 0000000..9360f66 --- /dev/null +++ b/connector/src/main/resources/checklist.vdmsl @@ -0,0 +1 @@ +/home/smyalygames/Documents/dissertation/formal/checklist.vdmsl \ No newline at end of file