Server/Server/build.gradle

113 lines
3.3 KiB
Groovy

plugins {
id 'java'
id 'idea'
id "org.sonarqube" version "3.2.0"
id 'jacoco'
}
repositories {
mavenCentral()
jcenter()
}
test {
useJUnitPlatform()
maxParallelForks = 1
}
// Fancy live test output (from https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time)
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
// TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
// info.events = debug.events
// info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
jacocoTestReport {
reports {
html.enabled true
xml.enabled true
xml.destination file("${buildDir}/reports/jacoco.xml")
}
}
plugins.withType(JacocoPlugin) {
tasks["test"].finalizedBy 'jacocoTestReport'
}
sonarqube {
properties {
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.host.url", "https://sonarqube.yandrik.dev"
property "sonar.coverage.jacoco.xmlReportPath", "${buildDir}/reports/jacoco.xml"
}
}
var mainClassName = "uulm.teamname.marvelous.server.Server"
jar {
manifest {
attributes "Main-Class": "$mainClassName"
}
from {
configurations.runtimeClasspath.collect {it.isDirectory() ? it : zipTree(it) }
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
dependencies {
implementation project(':Gamelib')
implementation "org.java-websocket:Java-WebSocket:1.5.1"
implementation "org.tinylog:tinylog-api:2.4.0-M1"
implementation "org.tinylog:tinylog-impl:2.4.0-M1"
implementation "org.tinylog:slf4j-tinylog:2.4.0-M1"
implementation "com.beust:jcommander:1.81"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.0-M1"
testImplementation "org.mockito:mockito-core:3.+"
testImplementation "org.mockito:mockito-inline:3.+"
testImplementation "org.assertj:assertj-core:3.19.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.0-M1"
}