build: Add lint unchecked to compiler options
Also add some more configuration for unit test (which we don't really
use much currently).
@@ -13,10 +13,47 @@ subprojects {
if (bndis('companion.code')) {
apply from: cnf.file('gradle/companion.gradle')
}
+ tasks.withType(JavaCompile).configureEach {
+ options.compilerArgs.add('-Xlint:unchecked')
+ }
tasks.named('test') {
+ useJUnitPlatform()
testLogging {
exceptionFormat 'full'
}
+ if (!logger.isInfoEnabled()) {
+ def stdOut = [:]
+ def stdErr = [:]
+ onOutput { descriptor, event ->
+ if (event.destination == TestOutputEvent.Destination.StdErr) {
+ stdErr.get(descriptor, []).add(event)
+ } else {
+ stdOut.get(descriptor, []).add(event)
+ }
+ }
+ afterTest { descriptor, result ->
+ def stdErrEvents = stdErr.remove(descriptor)
+ def stdOutEvents = stdOut.remove(descriptor)
+ if (result.resultType == TestResult.ResultType.FAILURE) {
+ if (stdErrEvents && !stdErrEvents.empty) {
+ logger.lifecycle('\n{} > {} STANDARD_ERROR', descriptor.className, descriptor.name)
+ stdErrEvents.each { event ->
+ logger.lifecycle(' {}', event.message.trim())
+ }
+ }
+ if (stdOutEvents && !stdOutEvents.empty) {
+ logger.lifecycle('\n{} > {} STANDARD_OUT', descriptor.className, descriptor.name)
+ stdOutEvents.each { event ->
+ logger.lifecycle(' {}', event.message.trim())
+ }
+ }
+ }
+ }
+ }
+ if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
+ jvmArgs '-XX:+ShowCodeDetailsInExceptionMessages'
+ }
+ systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', gradle.startParameter.logLevel.name()
if (System.properties['maven.repo.local']) {
systemProperty 'maven.repo.local', IO.getFile(gradle.startParameter.currentDir, System.properties['maven.repo.local'])
}
