-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
112 lines (101 loc) · 4.38 KB
/
Copy pathbuild.gradle
File metadata and controls
112 lines (101 loc) · 4.38 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
102
103
104
105
106
107
108
109
110
111
112
plugins {
id 'java'
id 'jacoco'
id 'checkstyle'
id 'org.springframework.boot' version '4.1.0'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'com.pinlog'
version = '0.0.1-SNAPSHOT'
description = 'pinlog-back'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
// Naver 캠퍼스 핵데이 Java 코딩 컨벤션 (http://naver.github.io/hackday-conventions-java/)
// Checkstyle이 CI 강제 게이트. .editorconfig는 IDE 자동 포맷용.
checkstyle {
toolVersion = '10.21.4'
configFile = file("$rootDir/config/checkstyle/naver-checkstyle-rules.xml")
configProperties = [
'suppressionFile': "$rootDir/config/checkstyle/naver-checkstyle-suppressions.xml"
]
maxWarnings = 0
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// Spring 7·Security 7이 JSpecify로 nullability를 선언한다. 우리 코드에서 직접 import 하므로
// 전이 의존에 기대지 않고 명시한다. 버전은 Boot BOM이 관리한다.
implementation 'org.jspecify:jspecify'
implementation 'org.springframework.boot:spring-boot-starter-security'
// Boot 4에서 spring-boot-starter-oauth2-client → -security-oauth2-client 로 이름이 바뀌었다.
// 등록된 ClientRegistration이 없으면 자동 설정이 비활성이라, 자격증명 없이도 기동된다.
implementation 'org.springframework.boot:spring-boot-starter-security-oauth2-client'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.3'
implementation 'org.springframework.boot:spring-boot-starter-flyway'
implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'org.flywaydb:flyway-database-postgresql'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa-test'
testImplementation 'org.springframework.boot:spring-boot-starter-data-redis-test'
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
testImplementation 'org.springframework.boot:spring-boot-starter-security-test'
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation 'org.testcontainers:testcontainers-junit-jupiter'
testImplementation 'org.testcontainers:testcontainers-postgresql'
testCompileOnly 'org.projectlombok:lombok'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testAnnotationProcessor 'org.projectlombok:lombok'
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy tasks.named('jacocoTestReport')
}
tasks.named('jacocoTestReport') {
dependsOn tasks.named('test')
reports {
xml.required = true
html.required = true
}
}
// main()만 있어 테스트가 밟을 수 없는 진입점은 집계에서 뺀다. 리포트와 검증에 같은 목록을
// 적용해야 "리포트에 보이는 수치"와 "게이트가 판정하는 수치"가 어긋나지 않는다.
def coverageExcludes = ['**/PinlogBackApplication.class']
tasks.withType(JacocoReportBase).configureEach {
classDirectories.setFrom(files(sourceSets.main.output.classesDirs.collect {
fileTree(it) { exclude coverageExcludes }
}))
}
// 커버리지 하한선(S15P11A705-103). BUNDLE = 전체 합계 기준이며, 개별 클래스가 낮아도
// 합계가 기준을 넘으면 통과한다. 근거와 감수하는 점은 BD-27에 있다.
tasks.named('jacocoTestCoverageVerification') {
dependsOn tasks.named('test')
violationRules {
rule {
element = 'BUNDLE'
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.80
}
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.80
}
}
}
}
tasks.named('check') {
dependsOn tasks.named('jacocoTestReport'), tasks.named('jacocoTestCoverageVerification')
}