mirror of
https://github.com/smyalygames/checklist-tester.git
synced 2025-11-30 01:39:38 +01:00
build(connector): add Compose and split desktop app and server
This commit is contained in:
23
connector/server/build.gradle.kts
Normal file
23
connector/server/build.gradle.kts
Normal file
@@ -0,0 +1,23 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinJvm)
|
||||
alias(libs.plugins.ktor)
|
||||
application
|
||||
}
|
||||
|
||||
group = "io.anthonyberg.connector"
|
||||
version = "1.0.0"
|
||||
application {
|
||||
mainClass.set("io.anthonyberg.connector.ApplicationKt")
|
||||
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=${extra["development"] ?: "false"}")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.shared)
|
||||
implementation(libs.logback)
|
||||
implementation(libs.ktor.server.core)
|
||||
implementation(libs.ktor.server.netty)
|
||||
testImplementation(libs.ktor.server.tests)
|
||||
testImplementation(libs.kotlin.test.junit)
|
||||
|
||||
implementation("dk.au.ece.vdmj:vdmj:4.5.0")
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.anthonyberg.connector
|
||||
|
||||
import Greeting
|
||||
import SERVER_PORT
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.engine.*
|
||||
import io.ktor.server.netty.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
|
||||
fun main() {
|
||||
embeddedServer(Netty, port = SERVER_PORT, host = "0.0.0.0", module = Application::module)
|
||||
.start(wait = true)
|
||||
}
|
||||
|
||||
fun Application.module() {
|
||||
routing {
|
||||
get("/") {
|
||||
call.respondText("Ktor: ${Greeting().greet()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.anthonyberg.connector
|
||||
|
||||
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<String> = arrayOf("resources/checklist.vdmsl")
|
||||
|
||||
return Lifecycle(args)
|
||||
}
|
||||
|
||||
}
|
||||
12
connector/server/src/main/resources/logback.xml
Normal file
12
connector/server/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root level="trace">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
<logger name="org.eclipse.jetty" level="INFO"/>
|
||||
<logger name="io.netty" level="INFO"/>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user