-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
140 lines (118 loc) · 3.31 KB
/
build.gradle
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
plugins {
id 'java'
id 'jacoco'
id 'checkstyle'
}
checkstyle {
maxWarnings = 0 // 규칙이 어긋나는 코드가 하나라도 있을 경우 빌드 fail
configFile = file("${rootDir}/config/checkstyle.xml") // 설정 파일 경로 지정
}
jacocoTestReport {
reports {
xml.required = true
csv.required = true
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
excludes: [])
}))
}
finalizedBy 'jacocoTestCoverageVerification'
}
jacoco {
// JaCoCo 버전
toolVersion = '0.8.5'
// 테스트결과 리포트를 저장할 경로 변경
// default는 "$/jacoco"
reportsDir = file("$buildDir/customJacocoReportDir")
}
group 'camp.nextstep.edu'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.woowacourse-projects:mission-utils:1.0.0'
implementation 'com.github.E1psycongr00:code-checker:1.0.0'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
test {
useJUnitPlatform()
/* jacoco {
enabled = true
destinationFile = file("$buildDir/jacoco/jacoco.exec")
includes = []
excludes = []
excludeClassLoaders = []
includeNoLocationClasses = false
sessionId = "<auto-generated value>"
dumpOnExit = true
classDumpDir = null
output = JacocoTaskExtension.Output.FILE
address = "localhost"
port = 6300
jmx = false
}*/
}
task checkstyle(type: Test) {
group 'verification'
description 'Runs the unit tests with coverage'
dependsOn(':test',
':checkstyleMain')
tasks['checkstyleMain'].mustRunAfter(tasks['test'])
}
/*
jacocoTestCoverageVerification {
violationRules {
// 여러 룰을 생성할 수 있습니다.
rule {
// 룰을 간단히 켜고 끌 수 있습니다.
enabled = true
// 룰을 체크할 단위는 클래스 단위
element = 'CLASS'
// 빈 줄을 제외한 코드의 라인수를 최대 12라인으로 제한합니다.
// class A { } 1줄
// public void method(){} 1줄
// 내부 빈줄을 제외한 각각 1줄
*/
/**
* public class Name{ // 1줄
*
* public void test(){ // 1줄
*} // 1줄
*
* 총 3줄임
*}*//*
limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 50
}
}
rule {
enabled = true
element = 'METHOD'
limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 12
}
}
}
}
task testCoverage(type: Test) {
group 'verification'
description 'Runs the unit tests with coverage'
dependsOn(':test',
':jacocoTestReport',
':jacocoTestCoverageVerification')
tasks['jacocoTestReport'].mustRunAfter(tasks['test'])
tasks['jacocoTestCoverageVerification'].mustRunAfter(tasks['jacocoTestReport'])
}*/