mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
add GitInfo
This commit is contained in:
parent
1862a70e8a
commit
4e2e1adbeb
30
pom.xml
30
pom.xml
@ -100,7 +100,35 @@
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>get-the-git-infos</id>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
|
||||
<prefix>git</prefix>
|
||||
<verbose>false</verbose>
|
||||
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||
<generateGitPropertiesFilename>${project.build.outputDirectory}/assets/git.json</generateGitPropertiesFilename>
|
||||
<format>json</format>
|
||||
<gitDescribe>
|
||||
<skip>false</skip>
|
||||
<always>false</always>
|
||||
<dirty>-dirty</dirty>
|
||||
</gitDescribe>
|
||||
<excludeProperties>
|
||||
<excludeProperty>git.remote.*</excludeProperty>
|
||||
</excludeProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -35,6 +35,7 @@ import de.bixilon.minosoft.protocol.network.Connection;
|
||||
import de.bixilon.minosoft.protocol.protocol.LANServerListener;
|
||||
import de.bixilon.minosoft.terminal.CLI;
|
||||
import de.bixilon.minosoft.util.CountUpAndDownLatch;
|
||||
import de.bixilon.minosoft.util.GitInfo;
|
||||
import de.bixilon.minosoft.util.MinosoftCommandLineArguments;
|
||||
import de.bixilon.minosoft.util.Util;
|
||||
import de.bixilon.minosoft.util.logging.Log;
|
||||
@ -64,6 +65,7 @@ public final class Minosoft {
|
||||
Util.initUtilClasses();
|
||||
|
||||
Log.info("Starting...");
|
||||
GitInfo.INSTANCE.load();
|
||||
AsyncTaskWorker taskWorker = new AsyncTaskWorker("StartUp");
|
||||
|
||||
taskWorker.setFatalError((exception) -> {
|
||||
|
@ -359,10 +359,6 @@ class VersionMapping(var version: Version?) {
|
||||
}
|
||||
val blockStates = block.getAsJsonObject("states")
|
||||
for (identifier in blockStates.keySet()) {
|
||||
if (identifier == "dispenser") {
|
||||
Log.debug("")
|
||||
}
|
||||
|
||||
loadBlockModelState(mod, identifier!!, blockStates)
|
||||
}
|
||||
}
|
||||
@ -519,7 +515,7 @@ class VersionMapping(var version: Version?) {
|
||||
if (availableFeatures.size == Mappings.values().size) {
|
||||
return true
|
||||
}
|
||||
for (mapping in Mappings.values()) {
|
||||
for (mapping in Mappings.VALUES) {
|
||||
if (!availableFeatures.contains(mapping)) {
|
||||
return false
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ open class BlockModel(val parent: BlockModel? = null, json: JsonObject) {
|
||||
private val fullFaceDirections: MutableSet<Directions> = parent?.fullFaceDirections?.toMutableSet() ?: mutableSetOf()
|
||||
private var rotation: Vec3
|
||||
private var uvLock = false // ToDo
|
||||
private var rescale = false // ToDo
|
||||
|
||||
init {
|
||||
json["textures"]?.asJsonObject?.let {
|
||||
@ -51,6 +52,9 @@ open class BlockModel(val parent: BlockModel? = null, json: JsonObject) {
|
||||
json["uvlock"]?.let {
|
||||
uvLock = it.asBoolean
|
||||
}
|
||||
json["rescale"]?.let {
|
||||
rescale = it.asBoolean
|
||||
}
|
||||
rotation = glm.radians(Vec3(rotateX, rotateY, rotateZ))
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import de.bixilon.minosoft.data.world.ChunkLocation
|
||||
import de.bixilon.minosoft.data.world.InChunkSectionLocation
|
||||
import de.bixilon.minosoft.gui.rendering.font.FontBindings
|
||||
import de.bixilon.minosoft.modding.loading.ModLoader
|
||||
import de.bixilon.minosoft.util.GitInfo
|
||||
import org.lwjgl.opengl.GL11.*
|
||||
import oshi.SystemInfo
|
||||
|
||||
@ -57,6 +58,8 @@ class HUDDebugScreenElement(private val hudTextElement: HUDTextElement) : HUDTex
|
||||
"GPU: $gpuText",
|
||||
"Version: $gpuVersionText",
|
||||
"",
|
||||
"Commit: ${GitInfo.GIT_COMMIT_ID_DESCRIBE}: ${GitInfo.GIT_COMMIT_MESSAGE_SHORT}",
|
||||
"",
|
||||
"Mods: ${ModLoader.MOD_MAP.size} active, ${hudTextElement.connection.eventListenerSize} listeners",
|
||||
))
|
||||
}
|
||||
|
90
src/main/java/de/bixilon/minosoft/util/GitInfo.kt
Normal file
90
src/main/java/de/bixilon/minosoft/util/GitInfo.kt
Normal file
@ -0,0 +1,90 @@
|
||||
package de.bixilon.minosoft.util
|
||||
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
|
||||
object GitInfo {
|
||||
var GIT_BRANCH: String = ""
|
||||
private set
|
||||
var GIT_BUILD_HOST_BRANCH: String = ""
|
||||
private set
|
||||
var GIT_BUILD_TIME: Long = 0L
|
||||
private set
|
||||
var GIT_BUILD_USER_EMAIL: String = ""
|
||||
private set
|
||||
var GIT_BUILD_USER_NAME: String = ""
|
||||
private set
|
||||
var GIT_BUILD_VERSION: String = ""
|
||||
private set
|
||||
var GIT_CLOSEST_TAG_COMMIT_COUNT: String = ""
|
||||
private set
|
||||
var GIT_CLOSEST_TAG_NAME: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_ID: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_ID_ABBREV: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_ID_DESCRIBE: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_ID_DESCRIBE_SHORT: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_MESSAGE_FULL: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_MESSAGE_SHORT: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_TIME: Long = 0L
|
||||
private set
|
||||
var GIT_COMMIT_USER_EMAIL: String = ""
|
||||
private set
|
||||
var GIT_COMMIT_USER_NAME: String = ""
|
||||
private set
|
||||
var GIT_DIRTY: Boolean = false
|
||||
private set
|
||||
var GIT_LOCAL_BRANCH_AHEAD: Int = 0
|
||||
private set
|
||||
var GIT_LOCAL_BRANCH_BEHIND: Int = 0
|
||||
private set
|
||||
var GIT_TAGS: Int = 0
|
||||
private set
|
||||
var GIT_TOTAL_COMMIT_COUNT: Int = 0
|
||||
private set
|
||||
|
||||
fun load() {
|
||||
try {
|
||||
val dateFormat: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZZZZ")
|
||||
val json = Util.readJsonAssetResource("git.json")
|
||||
GIT_BRANCH = json["git.branch"].asString
|
||||
GIT_BUILD_HOST_BRANCH = json["git.build.host"].asString
|
||||
GIT_BUILD_TIME = dateFormat.parse(json["git.build.time"].asString).time
|
||||
GIT_BUILD_USER_EMAIL = json["git.build.user.email"].asString
|
||||
GIT_BUILD_USER_NAME = json["git.build.user.name"].asString
|
||||
GIT_BUILD_VERSION = json["git.build.version"].asString
|
||||
GIT_CLOSEST_TAG_COMMIT_COUNT = json["git.closest.tag.commit.count"].asString
|
||||
GIT_CLOSEST_TAG_NAME = json["git.closest.tag.name"].asString
|
||||
GIT_COMMIT_ID = json["git.commit.id"].asString
|
||||
GIT_COMMIT_ID_ABBREV = json["git.commit.id.abbrev"].asString
|
||||
GIT_COMMIT_ID_DESCRIBE = json["git.commit.id.describe"].asString
|
||||
GIT_COMMIT_ID_DESCRIBE_SHORT = json["git.commit.id.describe-short"].asString
|
||||
GIT_COMMIT_MESSAGE_FULL = json["git.commit.message.full"].asString
|
||||
GIT_COMMIT_MESSAGE_SHORT = json["git.commit.message.short"].asString
|
||||
GIT_COMMIT_TIME = dateFormat.parse(json["git.commit.time"].asString).time
|
||||
GIT_COMMIT_USER_EMAIL = json["git.commit.user.email"].asString
|
||||
GIT_COMMIT_USER_NAME = json["git.commit.user.name"].asString
|
||||
GIT_DIRTY = json["git.dirty"].asBoolean
|
||||
GIT_LOCAL_BRANCH_AHEAD = json["git.local.branch.ahead"].asInt
|
||||
GIT_LOCAL_BRANCH_BEHIND = json["git.local.branch.behind"].asInt
|
||||
GIT_TAGS = if (json["git.tags"].asString.isBlank()) {
|
||||
0
|
||||
} else {
|
||||
json["git.tags"].asInt
|
||||
}
|
||||
GIT_TOTAL_COMMIT_COUNT = json["git.total.commit.count"].asInt
|
||||
} catch (exception: Throwable) {
|
||||
Log.printException(exception, LogLevels.DEBUG)
|
||||
Log.warn("Can not load git information.")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user