-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle.kts
74 lines (59 loc) · 1.72 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
@file:Suppress("SpellCheckingInspection")
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun gitCommitHash(): String {
val builder = ProcessBuilder("git", "rev-parse", "--short", "HEAD")
val process = builder.start()
val reader = process.inputReader()
val hash = reader.readText().trim()
return if (hash.isNotEmpty()) ".$hash" else ""
}
plugins {
java
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.johnrengelman.shadow)
}
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
group = "me.zhenxin"
version = "4.0.0-dev" + gitCommitHash()
apply {
plugin("java")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.github.johnrengelman.shadow")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.build {
dependsOn(tasks.shadowJar)
}
tasks.shadowJar {
exclude("kotlin/**")
exclude("org/jetbrains/**")
exclude("org/intellij/**")
relocate("kotlin", "me.zhenxin.zmusic.library.kotlin")
relocate("me.lucko", "me.zhenxin.zmusic.library")
relocate("org.objectweb", "me.zhenxin.zmusic.library")
relocate("org.bstats", "me.zhenxin.zmusic.library.bstats")
archiveClassifier.set("")
minimize()
manifest {
attributes["Main-Class"] = "me.zhenxin.zmusic.Application"
}
}
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
}
tasks.jar { enabled = false }