From ec86fe96f289d3dd0f117b5e17fe3476b873bc78 Mon Sep 17 00:00:00 2001 From: ymkim97 Date: Thu, 26 Dec 2024 00:21:37 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20JaCoCo=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 108 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 84 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 189de66..e5b91c2 100644 --- a/build.gradle +++ b/build.gradle @@ -5,45 +5,112 @@ plugins { id 'org.ec4j.editorconfig' version "0.1.0" id "org.sonarqube" version "6.0.1.5171" id 'checkstyle' + id 'jacoco' } +group = 'com.TnT' +version = '0.0.1-SNAPSHOT' +jar.enabled = false + +java { + sourceCompatibility = '21' +} + +compileJava.options.encoding = 'UTF-8' +compileTestJava.options.encoding = 'UTF-8' + +configurations { + all { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + } + + compileOnly { + extendsFrom annotationProcessor + } +} + +repositories { + mavenCentral() +} + + sonar { properties { property "sonar.projectKey", "YAPP-Github_25th-App-Team-2-BE" property "sonar.organization", "yapp-github" property "sonar.host.url", "https://sonarcloud.io" + property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/test/jacocoTestReport.xml" } } checkstyle { + toolVersion = "10.4" maxWarnings = 0 configFile = file("${rootDir}/config/naver-checkstyle-rules.xml") configProperties = ["suppressionFile": "${rootDir}/config/naver-checkstyle-suppressions.xml"] - toolVersion = "8.42" } check.dependsOn editorconfigCheck -group = 'com.TnT' -version = '0.0.1-SNAPSHOT' -jar.enabled = false +jacoco { + toolVersion = "0.8.12" +} -java { - sourceCompatibility = '21' +test { + useJUnitPlatform() + finalizedBy 'jacocoTestReport' } -configurations { - all { - exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' +jacocoTestReport { + dependsOn test + + reports { + xml.required = true + html.required = true } - compileOnly { - extendsFrom annotationProcessor + afterEvaluate { + classDirectories.setFrom( + files(classDirectories.files.collect { + fileTree(dir: it, excludes: [ + "**/*Application*.class", + "**/*Config*.class", + ]) + }) + ) } + + finalizedBy 'jacocoTestCoverageVerification' } -repositories { - mavenCentral() +jacocoTestCoverageVerification { + violationRules { + rule { + enabled = true + element = 'CLASS' + + limit { + counter = 'LINE' + value = 'COVEREDRATIO' + minimum = 0.80 + } + + limit { + counter = 'METHOD' + value = 'COVEREDRATIO' + minimum = 0.80 + } + + excludes = [ + '*.*Application', + '*.*Config' + ] + } + } +} + +editorconfig { + excludes = ['build'] } dependencies { @@ -61,7 +128,7 @@ dependencies { implementation 'org.json:json:20231013' implementation 'org.bouncycastle:bcprov-jdk18on:1.79' - // 레디스 + // Redis implementation 'org.springframework.boot:spring-boot-starter-data-redis' // Log4j2 @@ -70,19 +137,12 @@ dependencies { implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.2' implementation 'com.lmax:disruptor:4.0.0' + // Lombok annotationProcessor 'org.projectlombok:lombok' - compileOnly 'org.projectlombok:lombok' + + // MySQL runtimeOnly 'com.mysql:mysql-connector-j' testImplementation 'org.springframework.boot:spring-boot-starter-test' - testRuntimeOnly 'org.junit.platform:junit-platform-launcher' -} - -tasks.named('test') { - useJUnitPlatform() -} - -editorconfig { - excludes = ['build'] }