Skip to content

Commit

Permalink
Add conventions config
Browse files Browse the repository at this point in the history
  • Loading branch information
deusaquilus committed Sep 11, 2024
1 parent 594aa5c commit b33734b
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 55 deletions.
110 changes: 55 additions & 55 deletions build-logic/src/main/kotlin/conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,58 @@ version = "1.9.22-0.3.0"
check("$version".isNotBlank() && version != "unspecified")
{ "invalid version $version" }

//tasks.withType<Test> {
// testLogging {
// lifecycle {
// events = mutableSetOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
// exceptionFormat = TestExceptionFormat.FULL
//
// showExceptions = true
// showCauses = true
// showStackTraces = false
// showStandardStreams = false
// }
// info.events = lifecycle.events
// info.exceptionFormat = lifecycle.exceptionFormat
// }
//
// val failedTests = mutableListOf<TestDescriptor>()
// val skippedTests = mutableListOf<TestDescriptor>()
//
// addTestListener(object : TestListener {
// override fun beforeSuite(suite: TestDescriptor) {}
//
// override fun beforeTest(testDescriptor: TestDescriptor) {}
//
// override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {
// when (result.resultType) {
// TestResult.ResultType.FAILURE -> failedTests.add(testDescriptor)
// TestResult.ResultType.SKIPPED -> skippedTests.add(testDescriptor)
// else -> Unit
// }
// }
//
// override fun afterSuite(suite: TestDescriptor, result: TestResult) {
// if (suite.parent == null) {
// logger.lifecycle("################ Summary::Start ################")
// logger.lifecycle("Test result: ${result.resultType}")
// logger.lifecycle(
// "Test summary: ${result.testCount} tests, " +
// "${result.successfulTestCount} succeeded, " +
// "${result.failedTestCount} failed, " +
// "${result.skippedTestCount} skipped")
// failedTests.takeIf { it.isNotEmpty() }?.prefixedSummary("\tFailed Tests")
// skippedTests.takeIf { it.isNotEmpty() }?.prefixedSummary("\tSkipped Tests:")
// logger.lifecycle("################ Summary::End ##################")
// }
// }
//
// private infix fun List<TestDescriptor>.prefixedSummary(subject: String) {
// logger.lifecycle(subject)
// forEach { test -> logger.lifecycle("\t\t${test.displayName()}") }
// }
//
// private fun TestDescriptor.displayName() = parent?.let { "${it.name} - $name" } ?: "$name"
//
// })
//}
tasks.withType<Test> {
testLogging {
lifecycle {
events = mutableSetOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
exceptionFormat = TestExceptionFormat.FULL

showExceptions = true
showCauses = true
showStackTraces = false
showStandardStreams = false
}
info.events = lifecycle.events
info.exceptionFormat = lifecycle.exceptionFormat
}

val failedTests = mutableListOf<TestDescriptor>()
val skippedTests = mutableListOf<TestDescriptor>()

addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) {}

override fun beforeTest(testDescriptor: TestDescriptor) {}

override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {
when (result.resultType) {
TestResult.ResultType.FAILURE -> failedTests.add(testDescriptor)
TestResult.ResultType.SKIPPED -> skippedTests.add(testDescriptor)
else -> Unit
}
}

override fun afterSuite(suite: TestDescriptor, result: TestResult) {
if (suite.parent == null) {
logger.lifecycle("################ Summary::Start ################")
logger.lifecycle("Test result: ${result.resultType}")
logger.lifecycle(
"Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped")
failedTests.takeIf { it.isNotEmpty() }?.prefixedSummary("\tFailed Tests")
skippedTests.takeIf { it.isNotEmpty() }?.prefixedSummary("\tSkipped Tests:")
logger.lifecycle("################ Summary::End ##################")
}
}

private infix fun List<TestDescriptor>.prefixedSummary(subject: String) {
logger.lifecycle(subject)
forEach { test -> logger.lifecycle("\t\t${test.displayName()}") }
}

private fun TestDescriptor.displayName() = parent?.let { "${it.name} - $name" } ?: "$name"

})
}
1 change: 1 addition & 0 deletions terpal-sql-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.konan.target.HostManager

plugins {
id("conventions")
kotlin("multiplatform")
id("com.android.library")
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0-RC3"
Expand Down

0 comments on commit b33734b

Please sign in to comment.