From 34ec8e86c6414a6b071ccd65fc0dad0d56d0f368 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Wed, 17 Nov 2021 03:09:48 +0100 Subject: build: merge java and junit conventions All Java code should have tests, anyways. --- .../groovy/tools.refinery.java-conventions.gradle | 30 ++++++++++++++++++++ .../groovy/tools.refinery.junit-conventions.gradle | 33 ---------------------- 2 files changed, 30 insertions(+), 33 deletions(-) delete mode 100644 buildSrc/src/main/groovy/tools.refinery.junit-conventions.gradle (limited to 'buildSrc/src/main') diff --git a/buildSrc/src/main/groovy/tools.refinery.java-conventions.gradle b/buildSrc/src/main/groovy/tools.refinery.java-conventions.gradle index 6bea6e46..2712d391 100644 --- a/buildSrc/src/main/groovy/tools.refinery.java-conventions.gradle +++ b/buildSrc/src/main/groovy/tools.refinery.java-conventions.gradle @@ -1,5 +1,6 @@ plugins { id 'eclipse' + id 'jacoco' } repositories { @@ -9,9 +10,38 @@ repositories { } } +dependencies { + testImplementation libs.hamcrest + testImplementation libs.junit.api + testRuntimeOnly libs.junit.engine + testImplementation libs.junit.params + testImplementation libs.mockito.core + testImplementation libs.mockito.junit +} + sourceCompatibility = '17' targetCompatibility = '17' +def jacocoTestReport = tasks.named('jacocoTestReport') +jacocoTestReport.configure { + dependsOn test + reports { + xml.required = true + } +} + +tasks.named('test') { + useJUnitPlatform { + excludeTags 'slow' + } + finalizedBy jacocoTestReport +} + +tasks.register('slowTest', Test) { + useJUnitPlatform() + finalizedBy jacocoTestReport +} + tasks.named('jar') { manifest { attributes 'Bundle-SymbolicName': project.name diff --git a/buildSrc/src/main/groovy/tools.refinery.junit-conventions.gradle b/buildSrc/src/main/groovy/tools.refinery.junit-conventions.gradle deleted file mode 100644 index d62207b7..00000000 --- a/buildSrc/src/main/groovy/tools.refinery.junit-conventions.gradle +++ /dev/null @@ -1,33 +0,0 @@ -plugins { - id 'jacoco' - id 'tools.refinery.java-conventions' -} - -dependencies { - testImplementation libs.hamcrest - testImplementation libs.junit.api - testRuntimeOnly libs.junit.engine - testImplementation libs.junit.params - testImplementation libs.mockito.core - testImplementation libs.mockito.junit -} - -def jacocoTestReport = tasks.named('jacocoTestReport') -jacocoTestReport.configure { - dependsOn test - reports { - xml.required = true - } -} - -tasks.named('test') { - useJUnitPlatform { - excludeTags 'slow' - } - finalizedBy jacocoTestReport -} - -tasks.register('slowTest', Test) { - useJUnitPlatform() - finalizedBy jacocoTestReport -} -- cgit v1.2.3-70-g09d2