-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
88 lines (74 loc) · 2.06 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
import org.apache.commons.io.output.ByteArrayOutputStream
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.5.10"
id("com.github.johnrengelman.shadow") version "7.0.0"
id("com.github.gmazzo.buildconfig") version "3.0.0"
}
group = "fr.westerosrp"
version = "1.0.0"
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://oss.sonatype.org/content/repositories/central")
maven("https://maven.enginehub.org/repo/")
}
val minecraft_version: String by project
dependencies {
compileOnly("org.spigotmc", "spigot-api", "$minecraft_version-R0.1-SNAPSHOT")
compileOnly("net.luckperms", "api", "5.3")
compileOnly("org.ktorm", "ktorm-core", "3.2.0")
compileOnly("com.sk89q.worldguard", "worldguard-bukkit", "7.0.5")
implementation("fr.mrmicky", "fastboard", "1.2.0")
}
buildConfig {
className("BuildConfig")
packageName("$group.$name")
val commit = getGitHash()
val branch = getGitBranch()
buildConfigField("String", "GIT_COMMIT", "\"$commit\"")
buildConfigField("String", "GIT_BRANCH", "\"$branch\"")
}
fun getGitHash(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
return stdout.toString("UTF-8").trim()
}
fun getGitBranch(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
standardOutput = stdout
}
return stdout.toString("UTF-8").trim()
}
tasks {
processResources {
filter(FixCrLfFilter::class)
filter(ReplaceTokens::class, "tokens" to mapOf("version" to project.version))
filteringCharset = "UTF-8"
}
jar {
enabled = false
}
build {
dependsOn(shadowJar)
}
shadowJar {
relocate("fr.mrmicky.fastboard", "fr.westerosrp.fastboard")
}
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "16"
}
}
}