Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
will-molloy committed Jul 2, 2023
1 parent 6a5b185 commit 3768981
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
31 changes: 15 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ subprojects {
targetCompatibility = JavaVersion.VERSION_19
}

// Spotless (code formatting/linting)
apply(plugin = "com.diffplug.spotless")
configure<SpotlessExtension> {
java {
Expand All @@ -39,7 +38,6 @@ subprojects {
}
}

// Checkstyle (static analysis - code quality/style)
apply(plugin = "checkstyle")
configure<CheckstyleExtension> {
toolVersion = "10.12.0"
Expand All @@ -49,7 +47,6 @@ subprojects {
isIgnoreFailures = false
}

// SpotBugs (static analysis - find possible bugs, performance issues etc.)
apply(plugin = "com.github.spotbugs")
configure<SpotBugsExtension> {
effort.set(Effort.MAX)
Expand All @@ -58,25 +55,20 @@ subprojects {
excludeFilter.set(rootProject.file("./spotbugs-exclude.xml"))
}
tasks.withType<SpotBugsTask> {
reports.create("xml").required.set(true)
reports.create("html").required.set(true)
}

tasks.withType<Test> {
// run tests in parallel, assumes they're threadsafe
maxParallelForks = Runtime.getRuntime().availableProcessors()
// use JUnit 5 engine
useJUnitPlatform()
testLogging {
events = setOf(TestLogEvent.FAILED, TestLogEvent.SKIPPED)
// log the full failure messages
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
// log the overall results (based on https://stackoverflow.com/a/36130467/6122976)
afterSuite(KotlinClosure2({ desc: TestDescriptor, result: TestResult ->
if (desc.parent == null) { // will match the outermost suite
if (desc.parent == null) {
println(
"Results: ${result.resultType} " +
"(${result.testCount} test${if (result.testCount > 1) "s" else ""}, " +
Expand All @@ -90,16 +82,24 @@ subprojects {
finalizedBy(tasks.withType<JacocoReport>())
}

// JaCoCo (code coverage reporting)
apply(plugin = "jacoco")
tasks.withType<JacocoReport> {
reports {
xml.required.set(true)
html.required.set(true)
csv.required.set(false)
}
}

val previewFeatures = listOf("--enable-preview")
tasks.withType<JavaCompile> {
options.compilerArgs = previewFeatures
}
tasks.withType<Test> {
jvmArgs = previewFeatures
}
tasks.withType<JavaExec> {
jvmArgs = previewFeatures
}

dependencies {
val log4jVersion = "2.20.0"
val guavaVersion = "32.0.1-jre"
Expand All @@ -116,12 +116,11 @@ subprojects {
testImplementation("org.mockito:mockito-core:$mockitoVersion")
testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion")

// dependency cleanup
configurations.all {
exclude("org.assertj") // using truth instead
exclude("junit") // using junit5
exclude("org.assertj")
exclude("junit")
resolutionStrategy {
force("com.google.guava:guava:$guavaVersion") // so the android version isn't pulled in
force("com.google.guava:guava:$guavaVersion") // exclude android version
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion hello-world/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ plugins {
id("org.unbroken-dome.test-sets") version "4.0.0"
}

testSets { create("integrationTest") }
testSets {
create("integrationTest")
}

0 comments on commit 3768981

Please sign in to comment.