-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
101 lines (83 loc) · 2.95 KB
/
build.gradle
File metadata and controls
101 lines (83 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// 루트 build.gradle
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id 'jacoco'
}
group = 'com.example.elephant'
version = '1.0-SNAPSHOT'
description = 'Elephant Project - custom Web Application Server and MVC Framework'
// 모든 모듈이 공통으로 사용하는 의존성
subprojects {
apply plugin: 'java-library'
apply plugin: 'jacoco'
group = rootProject.group
version = rootProject.version
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.google.guava:guava:32.0.1-jre'
implementation 'org.slf4j:slf4j-api:1.7.36'
// SLF4J의 구현체로 Logback을 사용, 테스트 스코프에 추가
testImplementation 'ch.qos.logback:logback-classic:1.2.11'
testImplementation 'org.assertj:assertj-core:3.26.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testImplementation 'org.mockito:mockito-core:5.15.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
}
test {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}
jacocoTestReport {
dependsOn test
reports {
html.required= true
xml.required = true
csv.required = false
// 각 모듈의 빌드 디렉토리 하위에 리포트가 생성되도록 경로를 지정
html.outputLocation = layout.buildDirectory.dir('reports/jacoco/test/html')
xml.outputLocation = layout.buildDirectory.file('reports/jacoco/test/jacocoTestReport.xml')
}
// 커버리지 검증은 리포트 생성 후에 수행
finalizedBy 'jacocoTestCoverageVerification'
}
jacocoTestCoverageVerification {
violationRules {
rule {
enabled = false
element = 'CLASS'
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.5
}
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc).configureEach {
options.encoding = 'UTF-8'
}
}
sonarqube {
properties {
property "sonar.projectKey", project.findProperty("sonarProjectKey") ?: System.getenv("SONAR_PROJECT_KEY")
property "sonar.host.url", project.findProperty("sonarHostUrl") ?: System.getenv("SONAR_HOST_URL")
property "sonar.login", project.findProperty("sonarLogin") ?: System.getenv("SONAR_TOKEN")
// 모든 하위 모듈에서 생성된 JaCoCo XML 리포트 경로를 동적으로 수집
property "sonar.coverage.jacoco.xmlReportPaths", files(subprojects.collect { "${it.buildDir}/reports/jacoco/test/jacocoTestReport.xml" }).asPath
}
}
jacoco {
// JaCoCo 버전
toolVersion = '0.8.8'
}