Make gradle take build number from env vars and add git build info (#5890)

* Make gradle take build number from env vars

* Add git information to manifest and version command/log

* trim

* Fix tests by adding NotNull annotations

* rebase

* Apply suggestions from kashike

Co-authored-by: Riley Park <rileysebastianpark@gmail.com>

* Not always show branch

* Why can't everything be NotNull by default?

* Rebase

Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
This commit is contained in:
Prof-Bloodstone
2021-06-23 19:19:44 +02:00
parent c00618d009
commit 5126271b6c
3 changed files with 186 additions and 1 deletions

View File

@@ -71,10 +71,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ manifest {
+ val git = Git(rootProject.layout.projectDirectory.path)
+ val gitHash = git("rev-parse", "HEAD").getText().substring(0, 7)
+ val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
+ attributes(
+ "Main-Class" to "org.bukkit.craftbukkit.Main",
+ "Implementation-Title" to "CraftBukkit",
+ "Implementation-Version" to "git-Paper-\"$gitHash\"",
+ "Implementation-Version" to "git-Paper-$implementationVersion",
+ "Implementation-Vendor" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(Date()), // Paper
+ "Specification-Title" to "Bukkit",
+ "Specification-Version" to project.version,