-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
130 lines (105 loc) · 3.34 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
plugins {
kotlin("jvm") version "2.1.0"
kotlin("plugin.serialization") version "2.1.0"
id("com.gradleup.shadow")
id("one.devos.yiski.build")
java
alias(libs.plugins.ktor)
id("com.github.ben-manes.versions") version "0.51.0"
id("nl.littlerobots.version-catalog-update") version "0.8.5"
}
group = "one.devos"
version = "${project.property("yiski.version")}${System.getProperty("GITHUB_SHA") ?: "-DEVELOPMENT"}"
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
api(shade(project(":yiski-dependencies"))!!)
shade(project(":yiski-common"))
shade(project(":yiski-module-metadata"))
shade(project(":yiski-module-loader"))
(1..6).forEach { module ->
implementation(project(":yiski$module"))
}
}
kotlin {
jvmToolchain(21)
}
tasks {
jar {
manifest.attributes("Main-Class" to "one.devos.yiski.runner.YiskiRunner")
}
fatJar {
archiveFileName.set("Yiski-$version.jar")
}
test {
useJUnitPlatform()
}
named("clean") {
doLast {
rootProject.file("modules").deleteRecursively()
}
}
}
allprojects {
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
apply(plugin = "idea")
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://gitlab.com/api/v4/projects/26794598/packages/maven") // Aviation GitLab
maven("https://maven.lavalink.dev/snapshots")
maven("https://maven.deftu.dev/releases")
maven("https://mvn.devos.one/snapshots")
}
dependencies {
if (project.name != "yiski-dependencies") {
if (project.name != "yiski-common" && !project.name.startsWith("yiski-module")) {
implementation(project(":yiski-common"))
}
if (!project.name.startsWith("yiski-module")) {
implementation(project(":yiski-module-metadata"))
implementation(project(":yiski-module-loader"))
}
}
}
tasks {
// Write the version to the yiski.metadata.toml
processResources {
inputs.property("version", project.version)
filesMatching("yiski.metadata.toml") {
expand(mutableMapOf("version" to project.version))
}
}
}
afterEvaluate {
tasks {
if (plugins.hasPlugin("one.devos.yiski.build")) {
fatJar {
logger.lifecycle("> Moving fat JAR to modules directory")
destinationDirectory.set(rootProject.file("modules"))
}
} else {
jar {
logger.lifecycle("> Moving normal JAR to modules directory")
destinationDirectory.set(rootProject.file("modules"))
}
}
}
}
}
subprojects {
dependencies {
if (project.name != "yiski-dependencies") {
implementation(project(":yiski-dependencies"))
}
}
}
application { // apparently needed for ktor? ok.
mainClass.set("one.devos.yiski.runner.YiskiRunner")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}