forked from Xiao-MoMi/Sparrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
43 lines (34 loc) · 1011 Bytes
/
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
import java.io.ByteArrayOutputStream
plugins {
id("java")
}
val commitID : String = versionBanner()
ext["commitID"] = commitID
subprojects {
apply(plugin = "java")
apply(plugin = "java-library")
repositories {
mavenCentral()
}
tasks.processResources {
filteringCharset = "UTF-8"
filesMatching(arrayListOf("library-version.properties")) {
expand(rootProject.properties)
}
filesMatching(arrayListOf("plugin.yml", "*.yml", "*/*.yml")) {
expand(
Pair("git_version", commitID),
Pair("project_version", rootProject.properties["project_version"]),
Pair("config_version", rootProject.properties["config_version"])
)
}
}
}
fun versionBanner(): String {
val os = ByteArrayOutputStream()
project.exec {
commandLine = "git rev-parse --short=8 HEAD".split(" ")
standardOutput = os
}
return String(os.toByteArray()).trim()
}