-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
84 lines (73 loc) · 2.15 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
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 = "me.marylieh.simplewarp"
version = "1.0.0"
repositories {
maven(url = "https://papermc.io/repo/repository/maven-public/")
}
val minecraft_version: String by project
dependencies {
// PaperMC Dependency
compileOnly("com.destroystokyo.paper", "paper-api", "$minecraft_version-R0.1-SNAPSHOT")
// Add your dependencies here
implementation("org.bstats", "bstats-bukkit", "3.0.2")
}
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()
}
configure<SourceSetContainer> {
named("main") {
java.srcDir("src/main/kotlin")
}
}
tasks {
processResources {
filter(FixCrLfFilter::class)
filter(ReplaceTokens::class, "tokens" to mapOf("version" to project.version))
filteringCharset = "UTF-8"
}
jar {
// Disabled, because we use the shadowJar task for building our jar
enabled = false
}
shadowJar {
relocate("org.bstats", "me.marylieh.simplewarp")
}
build {
dependsOn(shadowJar)
}
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
}