Inceptum/build.gradle.kts

39 lines
1.5 KiB
Plaintext
Raw Normal View History

import org.gradle.internal.os.OperatingSystem
import org.ajoberstar.grgit.Grgit
plugins {
id("org.ajoberstar.grgit") version "5.0.0" apply false
}
var currentVer = "0.0.0+nogit"
if (File(".git").exists()) {
val grgit: Grgit = Grgit.open(mapOf("dir" to rootProject.projectDir.toString()))
currentVer = "0.0.0+notag"
val tagList = grgit.tag.list()
tagList.sortWith { left, right -> right.commit.dateTime.compareTo(left.commit.dateTime) }
if (tagList.isNotEmpty()) {
currentVer = tagList[0].name
}
}
println("Building Inceptum $currentVer")
allprojects {
version = currentVer + if (project.hasProperty("release")) "" else "-" + (if (project.hasProperty("timestamp")) project.property("timestamp") else "${System.currentTimeMillis() / 1000L}")
group = "io.gitlab.jfronny.inceptum"
}
val lwjglVersion by extra("3.3.1")
val imguiVersion by extra("1.86.4")
val logbackVersion by extra("1.3.0-alpha15")
val jfCommonsVersion by extra("2022.7.4+11-13-3")
val jgitVersion by extra("6.2.0.202206071550-r")
val flavorProp: String by extra(if (project.hasProperty("flavor")) "${project.property("flavor")}" else "custom")
val flavor: String by extra(if (flavorProp != "custom") flavorProp else when (OperatingSystem.current()) {
OperatingSystem.WINDOWS -> "windows"
OperatingSystem.LINUX -> "linux"
OperatingSystem.MAC_OS -> "macos"
else -> throw IllegalStateException()
})
val isPublic by extra(project.hasProperty("public"))
val isRelease by extra(project.hasProperty("release"))