/
build.gradle.kts
235 lines (212 loc) · 7.01 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm") version "1.6.10" apply false
id("org.springframework.boot") apply false
id("org.jetbrains.dokka") version "1.6.10" apply false
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("maven-publish")
}
allprojects {
apply {
plugin("maven-publish")
plugin("io.spring.dependency-management")
}
version = "0.5.2-SNAPSHOT"
group = "org.springframework.fu"
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:${findProperty("bootVersion")}")
mavenBom("org.testcontainers:testcontainers-bom:1.15.3")
}
}
publishing {
repositories {
val repoUsername: String? by project
val repoPassword: String? by project
maven {
if (repoUsername != null && repoPassword != null) {
credentials {
username = repoUsername
password = repoPassword
}
url = uri(
if (version.toString().endsWith("-SNAPSHOT")) "https://repo.spring.io/libs-snapshot-local/"
else "https://repo.spring.io/libs-milestone-local/"
)
} else {
url = uri("$buildDir/repo")
}
}
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<JavaCompile> {
sourceCompatibility = "8"
targetCompatibility = "8"
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=enable")
}
}
repositories {
mavenCentral()
maven("https://repo.spring.io/milestone")
maven("https://repo.spring.io/snapshot")
}
}
publishing {
publications {
create<MavenPublication>("kofu-coroutines-mongodb") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-coroutines-mongodb"
artifact(task<Zip>("kofuCoroutinesMongodbSample") {
from("samples/kofu-coroutines-mongodb") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-coroutines-mongodb")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-coroutines-r2dbc") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-coroutines-r2dbc"
artifact(task<Zip>("kofuCoroutinesR2dbcSample") {
from("samples/kofu-coroutines-r2dbc") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-coroutines-r2dbc")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-coroutines-validation") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-coroutines-validation"
artifact(task<Zip>("kofuCoroutinesValidationSampleZip") {
from("samples/kofu-coroutines-validation") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-coroutines-validation")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-reactive-minimal") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-minimal"
artifact(task<Zip>("kofuReactiveMinimalSampleZip") {
from("samples/kofu-reactive-minimal") {
exclude("build", "com.sample.applicationkt", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-reactive-minimal")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-reactive-mongodb") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-mongodb"
artifact(task<Zip>("kofuReactiveMongodbSampleZip") {
from("samples/kofu-reactive-mongodb") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-reactive-mongodb")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-reactive-r2dbc") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-r2dbc"
artifact(task<Zip>("kofuReactiveR2dbcSampleZip") {
from("samples/kofu-reactive-r2dbc") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-reactive-r2dbc")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-reactive-data-r2dbc") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-data-r2dbc"
artifact(task<Zip>("kofuReactiveDataR2dbcSampleZip") {
from("samples/kofu-reactive-data-r2dbc") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-reactive-data-r2dbc")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-reactive-redis") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-redis"
artifact(task<Zip>("kofuReactiveRedisSampleZip") {
from("samples/kofu-reactive-redis") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-reactive-redis")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-reactive-cassandra") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-cassandra"
artifact(task<Zip>("kofuReactiveCassandraSampleZip") {
from("samples/kofu-reactive-cassandra") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-reactive-cassandra")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-reactive-validation") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-validation"
artifact(task<Zip>("kofuReactiveValidationSampleZip") {
from("samples/kofu-reactive-validation") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-reactive-validation")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-servlet-minimal") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-servlet-minimal"
artifact(task<Zip>("kofuServletMinimalSampleZip") {
from("samples/kofu-servlet-minimal") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-servlet-minimal")
setExecutablePermissions()
})
}
create<MavenPublication>("kofu-servlet-validation") {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-servlet-validation"
artifact(task<Zip>("kofuServletValidationSampleZip") {
from("samples/kofu-servlet-validation") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
destinationDirectory.set(file("$buildDir/dist"))
into("kofu-servlet-validation")
setExecutablePermissions()
})
}
}
}
fun CopySpec.setExecutablePermissions() {
filesMatching("gradlew") { mode = 0b111101101 }
filesMatching("gradlew.bat") { mode = 0b110100100 }
}