-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
174 lines (146 loc) · 5.78 KB
/
Copy pathbuild.gradle
File metadata and controls
174 lines (146 loc) · 5.78 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'org.springframework.boot' version '3.5.16'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'io.github.skaca8'
version = '3.3.0'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
// Spring Boot
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
// Validation
implementation 'org.springframework.boot:spring-boot-starter-validation'
// AspectJ — @ChannelAction 애스펙트 컴파일용. 소비 측에 강제하지 않으려고 compileOnly로 둔다.
// 런타임에 없으면 @ConditionalOnClass가 애스펙트 등록을 건너뛰고 애노테이션은 무동작이 된다.
compileOnly 'org.aspectj:aspectjweaver'
// Lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// Jackson
implementation 'com.fasterxml.jackson.core:jackson-databind'
// Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// 애스펙트를 실제로 프록시까지 태워서 검증하기 위해 테스트에서만 AOP 런타임을 넣는다.
testImplementation 'org.springframework.boot:spring-boot-starter-aop'
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// Lombok for tests
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}
tasks.named('test') {
useJUnitPlatform()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
withJavadocJar()
withSourcesJar()
}
// Lombok이 생성하는 default constructor에는 javadoc을 붙일 수 없어 missing 경고가 노이즈로 남는다.
// missing 외 doclint 검사(잘못된 @link, bad reference 등)는 유지한다.
tasks.named('javadoc') {
options.addBooleanOption('Xdoclint:all,-missing', true)
}
// 라이브러리로 배포하기 위한 설정
jar {
enabled = true
archiveClassifier = ''
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
// Spring Boot의 fat jar 생성 비활성화 (라이브러리용)
bootJar {
enabled = false
}
publishing {
publications {
create('maven', MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'Spring Mido Client'
description = 'A Spring Boot starter for multi-channel REST client management'
url = 'https://github.com/skaca8/mido-client'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'hyunjun'
name = 'Hyunjun'
email = 'skaca8@naver.com'
}
}
scm {
connection = 'scm:git:git://github.com/skaca8/mido-client.git'
developerConnection = 'scm:git:ssh://github.com/skaca8/mido-client.git'
url = 'https://github.com/skaca8/mido-client/tree/main'
}
}
}
}
}
// 서명 키가 있을 때만 서명 등록 — 키 없는 환경(예: JitPack)에서는 서명 없이 publish
def signingKey = ((findProperty('signingKey') ?: System.getenv('SIGNING_KEY')) as String)?.replace('\\n', '\n') ?: ''
def signingPassword = ((findProperty('signingPassword') ?: System.getenv('SIGNING_PASSWORD')) as String) ?: ''
if (signingKey.trim()) {
signing {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
}
// README의 버전 문자열은 mido-client 좌표에 앵커링해서만 치환한다.
// 앵커 없는 패턴(예: 백틱 안 semver 전부, 맨 <version>)은 Spring Boot·Gradle 버전이나
// 다른 의존성 스니펫까지 조용히 덮어쓴다.
def readmeVersionPatterns = [
~/((?:com|io)\.github\.skaca8:mido-client:)\d+\.\d+\.\d+/,
~/(<artifactId>mido-client<\/artifactId>\s*<version>)\d+\.\d+\.\d+/
]
// 파일당 치환 지점 수: Gradle 좌표 2개(JitPack·Central) + Maven <version> 2개.
def readmeVersionOccurrences = 4
tasks.register('updateReadmeVersion') {
doLast {
['README.md', 'README.ko.md'].each { filename ->
def f = file(filename)
def text = f.text
def replaced = 0
readmeVersionPatterns.each { pattern ->
text = text.replaceAll(pattern) { match ->
replaced++
match[1] + version
}
}
// 치환 수가 다르면 README 구조가 바뀐 것이다. 잘못된 문서를 조용히 커밋하는 대신 릴리즈를 멈춘다.
if (replaced != readmeVersionOccurrences) {
throw new GradleException("$filename: replaced $replaced version string(s), expected " +
"$readmeVersionOccurrences. Adjust readmeVersionPatterns / readmeVersionOccurrences " +
"in build.gradle if the README dependency blocks changed.")
}
f.text = text
}
println "README versions updated to $version"
}
}