2019-08-26 04:45:03 +00:00
|
|
|
import org.ajoberstar.grgit.Grgit
|
|
|
|
import java.time.format.DateTimeFormatter
|
|
|
|
|
|
|
|
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
|
2019-12-09 20:34:26 +00:00
|
|
|
4) If you still need help, ask on Discord! https://discord.gg/ngZCzbU
|
2019-08-26 04:45:03 +00:00
|
|
|
|
|
|
|
Output files will be in [subproject]/build/libs
|
|
|
|
*******************************************
|
|
|
|
""")
|
|
|
|
//TODO FIX THIS WHEN I FEEL LIKE IT
|
2019-12-11 16:49:17 +00:00
|
|
|
var rootVersion = "1.15"
|
2019-08-26 04:45:03 +00:00
|
|
|
var revision: String = ""
|
|
|
|
var buildNumber = ""
|
|
|
|
var date: String = ""
|
|
|
|
ext {
|
|
|
|
val git: Grgit = Grgit.open {
|
2020-02-05 21:27:50 +00:00
|
|
|
dir = File("$rootDir/.git");
|
2019-08-26 04:45:03 +00:00
|
|
|
}
|
|
|
|
ext["date"] = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"));
|
|
|
|
ext["revision"] = "-${git.head().abbreviatedId}";
|
|
|
|
var parents: MutableList<String>? = git.head().parentIds;
|
|
|
|
if (project.hasProperty("buildnumber")) {
|
|
|
|
buildNumber = project.properties["buildnumber"] as String;
|
|
|
|
} else {
|
|
|
|
var index = -2109; // Offset to match CI
|
|
|
|
while (parents != null && parents.isNotEmpty()) {
|
2020-02-05 21:27:50 +00:00
|
|
|
parents = git.resolve.toCommit(parents[0]).parentIds
|
2019-08-26 04:45:03 +00:00
|
|
|
index++;
|
|
|
|
}
|
|
|
|
buildNumber = index.toString();
|
|
|
|
}
|
|
|
|
}
|
2019-11-07 10:28:17 +00:00
|
|
|
|
|
|
|
allprojects {
|
|
|
|
gradle.projectsEvaluated {
|
|
|
|
tasks.withType(JavaCompile::class) {
|
|
|
|
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-26 04:45:03 +00:00
|
|
|
version = String.format("%s-%s", rootVersion, buildNumber)
|
|
|
|
|
|
|
|
if (!project.hasProperty("gitCommitHash")) {
|
|
|
|
apply(plugin = "org.ajoberstar.grgit")
|
|
|
|
ext["gitCommitHash"] = try {
|
|
|
|
(ext["grgit"] as Grgit?)?.head()?.abbreviatedId
|
|
|
|
} catch (e: Exception) {
|
|
|
|
logger.warn("Error getting commit hash", e)
|
|
|
|
|
|
|
|
"no_git_id"
|
|
|
|
}
|
|
|
|
}
|