Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
154 lines (136 loc) · 4.87 KB
/
Copy pathbuild.gradle
File metadata and controls
154 lines (136 loc) · 4.87 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
buildscript {
ext.kotlin_version = '2.2.0'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'org.springframework.boot' version '3.3.5' apply false
id 'io.spring.dependency-management' version '1.1.6' apply false
id 'org.jetbrains.kotlin.jvm' version '1.9.25' apply false
id 'org.jetbrains.kotlin.plugin.spring' version '1.9.25' apply false
id 'org.jetbrains.kotlin.plugin.jpa' version '1.9.25' apply false
id 'org.jetbrains.kotlin.kapt' version '1.9.25' apply false
id 'com.google.cloud.tools.jib' version '3.4.3' apply false
id 'jacoco'
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
ext {
springDocVersion = '2.6.0'
springDocWebFluxVersion = '2.2.0'
lombokVersion = '1.18.36'
mapstructVersion = '1.6.2'
lombokMapstructBindingVersion = '0.2.0'
resilience4jVersion = '2.2.0'
}
subprojects {
group = 'com.onmeet'
version = '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
}
apply plugin: 'jacoco'
if (it.name.endsWith("-service") && it.name != "file-service") {
apply plugin: 'com.google.cloud.tools.jib'
jib {
from {
image = 'eclipse-temurin:17-jre-jammy'
platforms {
platform {
architecture = 'arm64'
os = 'linux'
}
platform {
architecture = 'amd64'
os = 'linux'
}
}
}
to {
// GitHub Actions에서 DOCKER_REGISTRY_PREFIX 환경변수로 전달, 기본값은 'onmeet'
def dockerRegistry = System.getenv('DOCKER_REGISTRY_PREFIX') ?: 'onmeet'
image = "${dockerRegistry}/${project.name}"
// GitHub Actions에서 jib.to.tags 시스템 속성으로 태그 전달 가능
// 예: -Djib.to.tags=latest,v0.1.0
def tagsProperty = System.getProperty('jib.to.tags')
if (tagsProperty) {
tags = tagsProperty.split(',').collect { it.trim() }
} else {
tags = ['latest', project.version]
}
}
container {
creationTime = 'USE_CURRENT_TIMESTAMP'
jvmFlags = ['-Xms512m', '-Xmx512m']
}
}
}
afterEvaluate {
tasks.withType(Test) {
finalizedBy jacocoTestReport
}
tasks.named('jacocoTestReport') {
dependsOn tasks.named('test')
reports {
xml.required = true
csv.required = false
html.required = true
}
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/dto/**",
"**/entity/**",
"**/exception/**",
"**/config/**",
"**/*Config*",
"**/*Properties*"
])
})
)
}
}
}
// 루트 프로젝트용: 하위 프로젝트들의 test 및 jacoco 결과를 모아서 통합 리포트 생성
tasks.register('jacocoRootReport', JacocoReport) {
description = 'Generates an aggregate report from all subprojects'
// coverage 리포팅을 적용할 서비스 모듈만 필터링
// 설정에 따라 필요한 모듈을 추가하거나 불필요한 모듈을 제외할 수 있습니다.
def coverageProjects = subprojects.findAll {
it.name.endsWith("-service") || it.name == "onmeet-common" || it.name == "common-security"
}
dependsOn coverageProjects.test // 각 하위 프로젝트의 테스트 실행 의존성 추가
additionalSourceDirs.from = files(coverageProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(coverageProjects.sourceSets.main.allSource.srcDirs)
// 모아진 클래스 파일들 중 불필요한 파일들 제외 (DTO, Entity, Exception, Config 등)
def excludes = [
"**/dto/**",
"**/entity/**",
"**/exception/**",
"**/config/**",
"**/*Config*",
"**/*Properties*",
"**/security/**"
]
classDirectories.from = files(coverageProjects.sourceSets.main.output.classesDirs).asFileTree.matching {
exclude excludes
}
executionData.from = files(coverageProjects.jacocoTestReport.executionData)
reports {
html.required = true
xml.required = true
csv.required = true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
kotlin {
jvmToolchain(8)
}