-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
106 lines (93 loc) · 2.38 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import util.*
plugins {
java
kotlin("jvm") version Versions.kotlin
id("kotlinx-serialization") version Versions.kotlin
}
group = "de.timokrates"
version = "1.0"
allprojects {
repositories {
mavenCentral()
google()
jcenter()
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/soywiz/soywiz")
maven("https://jitpack.io")
}
tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
}
}
subprojects {
version = rootProject.version
apply {
plugin("org.jetbrains.kotlin.jvm")
plugin("kotlinx-serialization")
}
kotlin {
jvmTarget = "1.8"
}
tasks {
"jar"(Jar::class) {
archiveFileName.set(
"${rootProject.name}${[email protected](
":",
"-"
)}-${[email protected]}.jar"
)
}
}
}
tasks {
"build" {
dependsOnSubProjectsTask()
finalizedBy("copyDependenciesJars")
finalizedBy("copySubProjectJars")
finalizedBy("copyStaticFiles")
finalizedBy("copyLibs")
finalizedBy("copyDist")
}
"clean" {
dependsOnSubProjectsTask()
}
"jar"(Jar::class) {
dependsOnSubProjectsTask()
archiveFileName.set("${rootProject.name}-${rootProject.version}.jar")
}
}
val copyDependenciesJars = task("copyDependenciesJars", Copy::class) {
includeEmptyDirs = true
subprojects.forEach {
from(
configurations.archives.map {
it.asFileTree
}
)
}
into("$buildDir/libs")
}
val copySubProjectJars = task("copySubProjectJars", Copy::class) {
includeEmptyDirs = true
subprojects.forEach { from("${it.buildDir.absolutePath}/libs") }
into("$buildDir/libs")
}
val copyStaticFiles = task("copyStaticFiles", Copy::class) {
from("static")
into("$buildDir/dist")
}
val copyLibs = task("copyLibs", Copy::class) {
dependsOn("copyDependenciesJars")
dependsOn("copySubProjectJars")
from("$buildDir/libs")
into("$buildDir/dist/lib")
}
val copyDist = task("copyDist", Copy::class) {
dependsOn("copyLibs")
from("$buildDir/dist")
into("dist")
}
defaultProject()