mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-29 04:28:21 +01:00
Add commit info from JitPack into Minestom's jar (#1272)
* Compile git info into Git.java * Move blossom task into tasks block * Fix javadoc task * Improve readability * Remove version field * Hopefully preventing inline by javac * Make Git class final * Remove prefixes for getters * Make getters static
This commit is contained in:
parent
9890d71347
commit
6870c37b94
@ -2,6 +2,7 @@ plugins {
|
||||
`java-library`
|
||||
id("minestom.publishing-conventions")
|
||||
id("minestom.native-conventions")
|
||||
alias(libs.plugins.blossom)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@ -39,6 +40,21 @@ tasks {
|
||||
withType<Zip> {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
blossom {
|
||||
val git = "src/main/java/net/minestom/server/Git.java"
|
||||
|
||||
val gitCommit = System.getenv("GIT_COMMIT")
|
||||
val gitBranch = System.getenv("GIT_BRANCH")
|
||||
val group = System.getenv("GROUP")
|
||||
val artifact = System.getenv("ARTIFACT")
|
||||
|
||||
replaceToken("\"&COMMIT\"", if (gitCommit == null) "null" else "\"${gitCommit}\"", git)
|
||||
replaceToken("\"&BRANCH\"", if (gitBranch == null) "null" else "\"${gitBranch}\"", git)
|
||||
replaceToken("\"&GROUP\"", if (group == null) "null" else "\"${group}\"", git)
|
||||
replaceToken("\"&ARTIFACT\"", if (artifact == null) "null" else "\"${artifact}\"", git)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -80,3 +96,4 @@ dependencies {
|
||||
api("io.github.jglrxavpok.hephaistos:common:${libs.versions.hephaistos.get()}")
|
||||
api("io.github.jglrxavpok.hephaistos:gson:${libs.versions.hephaistos.get()}")
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,9 @@ jmh = "1.35"
|
||||
# JCStress
|
||||
jcstress = "0.8"
|
||||
|
||||
# Gradle plugins
|
||||
blossom = "1.3.0"
|
||||
|
||||
[libraries]
|
||||
|
||||
# Important Dependencies
|
||||
@ -104,3 +107,7 @@ flare = ["flare", "flare-fastutil"]
|
||||
adventure = ["adventure-api", "adventure-serializer-gson", "adventure-serializer-legacy", "adventure-serializer-plain", "adventure-text-logger-slf4j"]
|
||||
logging = ["tinylog-api", "tinylog-impl", "tinylog-slf4j"]
|
||||
terminal = ["jline", "jline-jansi"]
|
||||
|
||||
[plugins]
|
||||
|
||||
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
|
||||
|
16
src/main/java/net/minestom/server/Git.java
Normal file
16
src/main/java/net/minestom/server/Git.java
Normal file
@ -0,0 +1,16 @@
|
||||
package net.minestom.server;
|
||||
|
||||
public final class Git {
|
||||
private static final String COMMIT = "&COMMIT";
|
||||
private static final String BRANCH = "&BRANCH";
|
||||
|
||||
private static final String GROUP = "&GROUP";
|
||||
private static final String ARTIFACT = "&ARTIFACT";
|
||||
|
||||
|
||||
public static String commit() { return COMMIT; }
|
||||
public static String branch() { return BRANCH; }
|
||||
|
||||
public static String group() { return GROUP; }
|
||||
public static String artifact() { return ARTIFACT; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user