This repository has been archived on 2023-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
McGamerZone/commons/src/main/java/zone/themcgamer/common/BuildData.java
2021-02-19 15:11:08 -05:00

52 lines
1.9 KiB
Java

package zone.themcgamer.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* @author Braydon
* @implNote This class holds data for the current build
*/
@AllArgsConstructor @Getter @ToString
public class BuildData {
@Getter private static BuildData build;
static {
InputStream inputStream = BuildData.class.getClassLoader().getResourceAsStream("git.properties");
if (inputStream != null) {
try {
Properties properties = new Properties();
properties.load(inputStream);
build = new BuildData(
properties.getProperty("git.branch"),
properties.getProperty("git.build.host"),
properties.getProperty("git.build.user.email"),
properties.getProperty("git.build.user.name"),
properties.getProperty("git.build.version"),
properties.getProperty("git.commit.id"),
properties.getProperty("git.commit.id.abbrev"),
properties.getProperty("git.commit.message.full"),
properties.getProperty("git.commit.message.short"),
properties.getProperty("git.commit.time"),
properties.getProperty("insane_module")
);
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
inputStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
private final String branch, host, email, username, version, commitId, commitIdAbbreviation,
commitMessageFull, commitMessageShort, time, module;
}