-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.gradle.kts
114 lines (95 loc) · 3.24 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.io.ByteArrayOutputStream
import org.gradle.api.JavaVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "2.0.20"
id("org.cadixdev.licenser") version "0.6.1"
id("com.github.johnrengelman.shadow") version "8.1.1"
}
group = "io.zachbr"
version = "1.6.5-SNAPSHOT"
val targetJVM = JavaVersion.VERSION_11.toString()
repositories {
maven("https://m2.dv8tion.net/releases")
maven("https://repo.spongepowered.org/maven")
mavenCentral()
}
dependencies {
implementation("org.kitteh.irc:client-lib:9.0.0")
implementation("club.minnced:discord-webhooks:0.8.4")
implementation("net.dv8tion:JDA:5.2.1") {
exclude(module = "opus-java")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.json:json:20230227")
implementation("org.spongepowered:configurate-hocon:4.1.2")
implementation("com.atlassian.commonmark:commonmark:0.15.2")
implementation("com.atlassian.commonmark:commonmark-ext-gfm-strikethrough:0.15.2")
implementation("org.slf4j:slf4j-api:2.0.13")
implementation("ch.qos.logback:logback-core:1.5.6")
implementation("ch.qos.logback:logback-classic:1.5.6")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0")
}
tasks {
build {
dependsOn(shadowJar)
}
withType<ShadowJar> {
manifest {
attributes["Main-Class"] = "io.zachbr.dis4irc.Dis4IRCKt"
attributes["Multi-Release"] = "true"
}
from(file("LICENSE.md"))
archiveClassifier.set("")
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
// make compileKotlin task be quiet
withType<JavaCompile> {
targetCompatibility = targetJVM
}
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = targetJVM
}
}
processResources {
inputs.property("suffix", project.findProperty("suffix") ?: "") // track suffix value as input
expand(
"projectName" to rootProject.name,
"projectVersion" to version,
"projectSuffix" to getSuffix(),
"projectSourceRepo" to "https://github.com/zachbr/Dis4IRC"
)
}
test {
testLogging.showStandardStreams = true
useJUnitPlatform()
}
}
// updateLicenses | checkLicenses
license {
header(project.file("HEADER.txt"))
ext {
set("name", "Dis4IRC")
}
}
fun getSuffix(): String {
// If suffix was specified at build-time, use that.
// ./gradlew build -P suffix="suffixValue15"
project.findProperty("suffix")?.toString()?.let { return it }
// Fall back to git hash if suffix not set
return ByteArrayOutputStream().let { stdout ->
runCatching {
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
errorOutput = ByteArrayOutputStream()
isIgnoreExitValue = true
}
stdout.toString().trim().takeIf { it.isNotEmpty() }
}.getOrNull() ?: "0" // fall back to 0 if git falls through
}
}