plugins { id 'application' id 'kotlin' id 'com.github.johnrengelman.shadow' version "$version_shadow" } mainClassName = 'io.ktor.server.netty.EngineMain' shadowJar { manifest { attributes 'Main-Class': mainClassName } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(":app-ktor-server") implementation project(":lib-database") implementation project(":lib-database-mpp") implementation "com.github.UstadMobile.door:door-runtime:$version_door" implementation project(":lib-test-common") implementation "com.squareup.okhttp3:mockwebserver:$version_mockwebserver" implementation "org.nanohttpd:nanohttpd:$version_nanohttpd" implementation "org.json:json:$version_json" implementation "commons-cli:commons-cli:$version_apache_commons_cli" implementation "io.ktor:ktor-server-netty:$version_ktor" implementation "ch.qos.logback:logback-classic:$version_logback" implementation "io.ktor:ktor-gson:$version_ktor" implementation "com.google.code.gson:gson:$version_gson" implementation "com.github.h-thurow:simple-jndi:$version_simple_jndi" implementation "org.apache.commons:commons-pool2:$version_apache_commons_pool2" implementation "org.apache.commons:commons-dbcp2:$version_apache_commons_dbcp2" implementation "org.xerial:sqlite-jdbc:$version_sqlite_jdbc" testImplementation "junit:junit:$version_junit" } ext.buildConfigProperties = new Properties() ext.buildConfigProperties.load(new FileInputStream(rootProject.file("buildconfig.default.properties"))) if(rootProject.file("buildconfig.local.properties").exists()) { ext.buildConfigProperties.load(new FileInputStream(rootProject.file("buildconfig.local.properties"))) } sourceCompatibility = "1.8" targetCompatibility = "1.8" task appRun(type: JavaExec) { classpath = files("$buildDir/libs/lib-http-testserver-all.jar") main = 'io.ktor.server.netty.EngineMain' args "-port=${rootProject.ext.buildConfigProperties["test.um_http_testserver_controlport"]}", "-host=${rootProject.ext.buildConfigProperties["test.um_http_testserver"]}" } task appRunDebug(type: JavaExec) { classpath = files("$buildDir/libs/lib-http-testserver-all.jar") main = 'io.ktor.server.netty.EngineMain' args "-port=${rootProject.ext.buildConfigProperties["test.um_http_testserver_controlport"]}", "-host=${rootProject.ext.buildConfigProperties["test.um_http_testserver"]}" jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005' } /* * Unfortunately there is a bug on JavaExecFork and Gradle 5.6+ * This was not resolving and is not currently used. It may be useful shortly for use with the * test server. */ //task appRunFork(type: com.github.psxpaul.task.JavaExecFork) { // //outputs.upToDateWhen { false } // classpath = sourceSets.test.runtimeClasspath // main = 'io.ktor.server.netty.EngineMain' // args = [ "-port=${rootProject.ext.buildConfigProperties["test.um_http_testserver_controlport"]}", "-host=${rootProject.ext.buildConfigProperties["test.um_http_testserver"]}" ] // waitForPort = 8400 // workingDir = "$projectDir/" // standardOutput = "$projectDir/build/tmp/daemon.log" // errorOutput = "$projectDir/build/tmp/daemon-error.log" //} task startServer(type: Exec) { workingDir = "$projectDir/" commandLine "./start.sh" args = [ "${rootProject.ext.buildConfigProperties["test.um_http_testserver_controlport"]}", "${rootProject.ext.buildConfigProperties["test.um_http_testserver"]}" ] } task stopServer(type: Exec) { workingDir = "$projectDir" commandLine "./stop.sh" } appRun.dependsOn(shadowJar) appRunDebug.dependsOn(shadowJar) startServer.dependsOn(shadowJar)