forked from spring-projects-experimental/spring-fu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
157 lines (140 loc) · 4.47 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.0" apply false
id("org.springframework.boot") version "2.1.0.RELEASE" apply false
id("org.jetbrains.dokka") version "0.9.17" apply false
id("io.spring.dependency-management") version "1.0.6.RELEASE"
id("maven-publish")
}
allprojects {
apply {
plugin("maven-publish")
plugin("io.spring.dependency-management")
}
version = "0.0.3.BUILD-SNAPSHOT"
group = "org.springframework.fu"
dependencyManagement {
val bootVersion: String by project
val coroutinesVersion: String by project
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:$bootVersion")
}
dependencies {
dependency("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
dependency("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutinesVersion")
}
}
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(".BUILD-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<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=enable")
}
}
repositories {
mavenCentral()
}
}
publishing {
publications {
create("jafu-reactive-minimal", MavenPublication::class.java) {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-jafu-reactive-minimal"
val jafuReactiveMinimalSample by task<Zip> {
from("samples/jafu-reactive-minimal") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
into("jafu-reactive-minimal")
setExecutablePermissions()
}
artifact(jafuReactiveMinimalSample)
}
create("kofu-coroutines-minimal", MavenPublication::class.java) {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-coroutines-minimal"
val kofuCoroutinesMinimalSample by task<Zip> {
from("samples/kofu-coroutines-minimal") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
into("kofu-coroutines-minimal")
setExecutablePermissions()
}
artifact(kofuCoroutinesMinimalSample)
}
create("kofu-coroutines-mongodb", MavenPublication::class.java) {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-coroutines-mongodb"
val kofuCoroutinesMongodbSample by task<Zip> {
from("samples/kofu-coroutines-mongodb") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
into("kofu-coroutines-mongodb")
setExecutablePermissions()
}
artifact(kofuCoroutinesMongodbSample)
}
create("kofu-reactive-graal", MavenPublication::class.java) {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-graal"
val kofuReactiveGraalSample by task<Zip> {
from("samples/kofu-reactive-graal") {
exclude("build", ".gradle", ".idea", "out", "*.iml", "com.sample.applicationkt")
}
into("kofu-reactive-graal")
setExecutablePermissions()
}
artifact(kofuReactiveGraalSample)
}
create("kofu-reactive-minimal", MavenPublication::class.java) {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-minimal"
val kofuReactiveMinimalSample by task<Zip> {
from("samples/kofu-reactive-minimal") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
into("kofu-reactive-minimal")
setExecutablePermissions()
}
artifact(kofuReactiveMinimalSample)
}
create("kofu-reactive-mongodb", MavenPublication::class.java) {
groupId = "org.springframework.fu"
artifactId = "spring-fu-samples-kofu-reactive-mongodb"
val kofuReactiveMongodbSample by task<Zip> {
from("samples/kofu-reactive-mongodb") {
exclude("build", ".gradle", ".idea", "out", "*.iml")
}
into("kofu-reactive-mongodb")
setExecutablePermissions()
}
artifact(kofuReactiveMongodbSample)
}
}
}
fun CopySpec.setExecutablePermissions() {
filesMatching("gradlew") { mode = 0b111101101 }
filesMatching("gradlew.bat") { mode = 0b110100100 }
}
inline fun <reified T : Task> task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)