blob: b4583f19d7f36c351104ab36777813474560db35 (
plain)
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
|
import com.github.gmazzo.buildconfig.BuildConfigExtension
import java.io.ByteArrayOutputStream
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("com.guardsquare:proguard-gradle:7.6.1")
}
}
plugins {
kotlin("jvm") version "2.0.20" apply false
id("com.github.gmazzo.buildconfig") version "5.5.0" apply false
id("ledger-globals")
}
allprojects {
apply(plugin = "ledger-globals")
}
fun cmd(vararg args: String): String {
val baos = ByteArrayOutputStream()
exec {
standardOutput = baos
commandLine(*args)
}
return baos.toByteArray().decodeToString().trim()
}
val gitVersion = cmd("git", "rev-parse", "--short", "HEAD")
val fullVersion = project.property("mod_version").toString()
val versionName: String = "$fullVersion-$gitVersion"
allprojects {
version = versionName
afterEvaluate {
configureIf<BuildConfigExtension> {
buildConfigField<String>("VERSION", versionName)
buildConfigField<String>("FULL_VERSION", fullVersion)
buildConfigField<String>("GIT_COMMIT", gitVersion)
}
}
}
|