Files
YouAndMe/build.gradle
2021-09-08 22:30:49 +09:00

151 lines
3.6 KiB
Groovy

import com.github.spotbugs.snom.SpotBugsTask
plugins {
id 'jacoco'
id 'org.springframework.boot' version '2.5.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.asciidoctor.convert' version '1.5.8'
id 'org.ec4j.editorconfig' version '0.0.3'
id 'com.github.spotbugs' version '4.7.0'
id 'checkstyle'
id 'java'
}
group = 'com.yam'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
ext {
set('snippetsDir', file("build/generated-snippets"))
}
asciidoctor {
inputs.dir snippetsDir
dependsOn test
}
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0'
runtimeOnly 'com.h2database:h2'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.security:spring-security-crypto:5.5.2'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'io.github.javaunit:autoparams:0.2.12'
testImplementation 'com.tngtech.archunit:archunit-junit5:0.20.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
}
test {
outputs.dir snippetsDir
useJUnitPlatform()
finalizedBy('jacocoTestReport')
}
editorconfig {
excludes = ["build"]
}
jacoco {
toolVersion = '0.8.7'
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
csv.enabled false
}
finalizedBy 'jacocoTestCoverageVerification'
}
jacocoTestCoverageVerification {
violationRules {
rule {
enabled = true
element = 'CLASS'
excludes = [
"*.YouAndMeApplication",
"*.*Request",
"*.*Response",
"*.*Repository",
"*.*Reader",
"*.Role",
"*.configuration.*", // path/configuration/...
"*.SmtpMail*",
"*.RoleTypeHandler",
]
limit {
counter = 'BRANCH' // 모든 분기가 실행되는가?
value = 'COVEREDRATIO'
minimum = 0.80
}
limit {
counter = 'INSTRUCTION' // 바이트코드 라인 커버리지
value = 'COVEREDRATIO'
minimum = 0.50
}
}
}
}
check.dependsOn editorconfigCheck
checkstyle {
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
configProperties = ["suppressionFile": "${project.rootDir}/config/checkstyle/checkstyle/checkstyle-suppressions.xml"]
toolVersion = "8.40"
ignoreFailures = false
maxErrors = 0
maxWarnings = 0
}
spotbugs {
ignoreFailures = false
reportLevel = "high"
spotbugsTest.enabled = false
}
tasks.withType(SpotBugsTask) {
reports {
text.enabled = true
xml.enabled = false
html.enabled = false
}
}
tasks.register("printSpotbugsMain") {
doLast {
File mainResult = file("${buildDir}/reports/spotbugs/main.txt")
if (mainResult.exists()) {
mainResult.readLines().forEach {
println(it)
}
}
}
}
tasks.getByPath("spotbugsMain").finalizedBy("printSpotbugsMain")