-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
174 lines (142 loc) · 4.87 KB
/
build.gradle.kts
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
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
val projectGroup = "live.lingting.spring"
val projectVersion = "2024.01.24-Bata-5"
// 用于子模块获取包管理信息
val catalogLibs = libs
// 用于声明依赖的项目
val dependencyProjects = subprojects.filter { it.name.endsWith("dependencies") }
// java 项目
val javaProjects = subprojects.filter { it.name.startsWith("lingting-") && !dependencyProjects.contains(it) }
// 使用的java版本
val javaVersion = JavaVersion.VERSION_21
// 字符集
val encoding = "UTF-8"
val ideaLanguageLevel = IdeaLanguageLevel(javaVersion);
plugins {
id("idea")
id("java")
id("com.vanniktech.maven.publish") version "0.29.0"
id("signing")
}
idea {
project {
languageLevel = ideaLanguageLevel
targetBytecodeVersion = javaVersion
}
}
buildscript {
dependencies {
classpath(platform(libs.frameworkDependencies))
classpath("io.spring.javaformat:spring-javaformat-gradle-plugin")
}
}
allprojects {
group = projectGroup
version = projectVersion
val isJava = javaProjects.contains(project)
val isDependency = dependencyProjects.contains(project)
apply {
plugin("idea")
plugin("com.vanniktech.maven.publish")
plugin("signing")
}
if (isJava) {
apply {
plugin("java")
plugin("java-library")
}
}
if (isDependency) {
apply {
plugin("java-platform")
}
}
idea {
module {
languageLevel = ideaLanguageLevel
targetBytecodeVersion = javaVersion
excludeDirs.add(File(rootDir, "src"))
}
}
mavenPublishing {
val projectRepository = "lingting-projects/lingting-spring"
val projectUrl = "https://github.com/$projectRepository"
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()
pom {
name = project.name
description = if (project.description.isNullOrBlank()) {
project.name
} else {
project.description
}
url = projectUrl
licenses {
license {
name = "MIT License"
url = "https://www.opensource.org/licenses/mit-license.php"
distribution = "repo"
}
}
developers {
developer {
id = "lingting"
name = id
email = "sunlisten.gzm@gmail.com"
url = "https://github.com/lingting"
}
}
scm {
connection = "scm:git:git@github.com:$projectRepository.git"
developerConnection = "scm:git:git@github.com:$projectRepository.git"
url = projectUrl
tag = "HEAD"
}
}
}
}
configure(javaProjects) {
apply {
plugin("io.spring.javaformat")
plugin("checkstyle")
}
dependencies {
add("checkstyle", platform(catalogLibs.frameworkDependencies))
add("checkstyle", "io.spring.javaformat:spring-javaformat-checkstyle")
add("implementation", platform(catalogLibs.frameworkDependencies))
add("annotationProcessor", platform(catalogLibs.frameworkDependencies))
add("testAnnotationProcessor", platform(catalogLibs.frameworkDependencies))
add("annotationProcessor", "org.springframework.boot:spring-boot-configuration-processor")
add("implementation", "org.slf4j:slf4j-api")
add("implementation", "org.mapstruct:mapstruct")
add("compileOnly", "org.projectlombok:lombok")
add("testCompileOnly", "org.projectlombok:lombok")
add("annotationProcessor", "org.mapstruct:mapstruct-processor")
add("annotationProcessor", "org.projectlombok:lombok")
add("annotationProcessor", "org.projectlombok:lombok-mapstruct-binding")
add("testAnnotationProcessor", "org.mapstruct:mapstruct-processor")
add("testAnnotationProcessor", "org.projectlombok:lombok")
add("testAnnotationProcessor", "org.projectlombok:lombok-mapstruct-binding")
add("testImplementation", "org.awaitility:awaitility")
add("testImplementation", "org.springframework.boot:spring-boot-starter-test")
}
configure<JavaPluginExtension> {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
showStandardStreams = true
}
}
tasks.withType<JavaCompile> {
options.encoding = encoding
options.compilerArgs.add("-parameters")
}
tasks.withType<Javadoc> {
isFailOnError = false
options.encoding(encoding)
}
}