Plex-FAWE/build.gradle.kts

69 lines
2.0 KiB
Plaintext

import org.ajoberstar.grgit.Grgit
import java.time.format.DateTimeFormatter
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
logger.lifecycle("""
*******************************************
You are building FastAsyncWorldEdit!
If you encounter trouble:
1) Read COMPILING.md if you haven't yet
2) Try running 'build' in a separate Gradle run
3) Use gradlew and not gradle
4) If you still need help, ask on Discord! https://discord.gg/intellectualsites
Output files will be in [subproject]/build/libs
*******************************************
""")
var rootVersion by extra("2.0.0")
var snapshot by extra("SNAPSHOT")
var revision: String by extra("")
var buildNumber by extra("")
var date: String by extra("")
ext {
val git: Grgit = Grgit.open {
dir = File("$rootDir/.git")
}
date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
revision = "-${git.head().abbreviatedId}"
buildNumber = if (project.hasProperty("buildnumber")) {
project.properties["buildnumber"] as String
} else {
null.toString() //1.18 TODO: drop classifier if not used, otherwise the version is 'null'
}
}
version = String.format("%s-%s+%s", rootVersion, snapshot, buildNumber)
if (!project.hasProperty("gitCommitHash")) {
apply(plugin = "org.ajoberstar.grgit")
ext["gitCommitHash"] = try {
extensions.getByName<Grgit>("grgit").head()?.abbreviatedId
} catch (e: Exception) {
logger.warn("Error getting commit hash", e)
"no.git.id"
}
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile::class) {
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
}
tasks.withType(Test::class) {
testLogging {
events(FAILED)
exceptionFormat = FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
}
}
applyCommonConfiguration()