diff --git a/build.gradle b/build.gradle index 7af50df5..30ef9f1b 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ plugins { id 'io.spring.dependency-management' version '1.1.3' id 'com.epages.restdocs-api-spec' version "${restdocsApiSpecVersion}" id 'org.hidetake.swagger.generator' version '2.18.2' + id 'jacoco' } group = 'coffee-meet' @@ -21,6 +22,68 @@ java { sourceCompatibility = '17' } +jacoco { + toolVersion = "0.8.8" +} + +jacocoTestReport { + reports { + xml.required = false + csv.required = false + } + + def Qdomains = [] + for (qPattern in '**/QA'..'**/QZ') { + Qdomains.add(qPattern + '*') + } + + afterEvaluate { + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, excludes: [ + '**/common/config/**', + '**/common/presentation/advice/**', + '**/common/presentation/interceptor/**', + '**/common/presentation/resolver/**', + '**/common/domain/**', + '**/common/annotation/**', + '**/exception/**', + '**/dto/**', + '**/oauth/config/**' + ] + Qdomains) + })) + } + + finalizedBy 'jacocoTestCoverageVerification' +} + +jacocoTestCoverageVerification { + violationRules { + rule { + enabled = true + element = 'CLASS' + + limit { + counter = 'LINE' + value = 'COVEREDRATIO' + //minimum = 0.7 + } + + excludes = [ + '*.common.config.*', + '*.common.presentation.advice.*', + '*.common.presentation.interceptor.*', + '*.common.presentation.resolver.*', + '*.common.domain.*', + '*.common.annotation.*', + '*.exception.*', + '*.oauth.config.*', + '*.dto.*', + '*.*Application' + ] + } + } +} + configurations { compileOnly { extendsFrom annotationProcessor @@ -91,6 +154,7 @@ dependencies { tasks.named('test') { useJUnitPlatform() + finalizedBy jacocoTestReport } swaggerSources { diff --git a/lombok.config b/lombok.config new file mode 100644 index 00000000..7a21e880 --- /dev/null +++ b/lombok.config @@ -0,0 +1 @@ +lombok.addLombokGeneratedAnnotation = true