forked from StarOpenSource/Engine
Add git information to EngineInformation
This commit is contained in:
parent
51f0405895
commit
116bc4b0b9
20 changed files with 988 additions and 26 deletions
1
base/.gitignore
vendored
Normal file
1
base/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
src/main/resources/git.properties
|
|
@ -20,6 +20,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'io.freefair.lombok' version "${pluginLombok}"
|
id 'io.freefair.lombok' version "${pluginLombok}"
|
||||||
|
id "com.gorylenko.gradle-git-properties" version "${pluginGitProperties}"
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +52,29 @@ dependencies {
|
||||||
testImplementation 'org.jooq:joor:' + project.dependencyJoor
|
testImplementation 'org.jooq:joor:' + project.dependencyJoor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gitProperties {
|
||||||
|
dotGitDirectory = file("${rootProject.rootDir}/.git")
|
||||||
|
failOnNoGitDirectory = false
|
||||||
|
extProperty = 'gitProps'
|
||||||
|
|
||||||
|
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
|
||||||
|
dateFormatTimeZone = "UTC"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("writeGitProperties") {
|
||||||
|
doLast {
|
||||||
|
File target = file("${project.projectDir}/src/main/resources/git.properties")
|
||||||
|
File source = file("${project.projectDir}/build/resources/main/git.properties")
|
||||||
|
|
||||||
|
target.delete()
|
||||||
|
source.renameTo(target)
|
||||||
|
}
|
||||||
|
|
||||||
|
outputs.upToDateWhen { false }
|
||||||
|
}
|
||||||
|
generateGitProperties.outputs.upToDateWhen { false }
|
||||||
|
processResources.dependsOn 'writeGitProperties'
|
||||||
|
|
||||||
javadoc.options {
|
javadoc.options {
|
||||||
setMemberLevel(JavadocMemberLevel.PUBLIC)
|
setMemberLevel(JavadocMemberLevel.PUBLIC)
|
||||||
setOverview("src/main/javadoc/overview.html")
|
setOverview("src/main/javadoc/overview.html")
|
||||||
|
|
|
@ -21,6 +21,7 @@ package de.staropensource.sosengine.base;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
||||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||||
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
import de.staropensource.sosengine.base.events.EngineCrashEvent;
|
import de.staropensource.sosengine.base.events.EngineCrashEvent;
|
||||||
import de.staropensource.sosengine.base.events.EngineShutdownEvent;
|
import de.staropensource.sosengine.base.events.EngineShutdownEvent;
|
||||||
|
@ -30,8 +31,9 @@ import de.staropensource.sosengine.base.logging.CrashHandler;
|
||||||
import de.staropensource.sosengine.base.logging.Logger;
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
import de.staropensource.sosengine.base.types.CodePart;
|
||||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||||
import de.staropensource.sosengine.base.utility.*;
|
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
|
||||||
|
import de.staropensource.sosengine.base.utility.ShortcodeConverter;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
|
@ -123,7 +125,7 @@ public final class Engine implements SubsystemMainClass {
|
||||||
logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info("Initialized sos!engine v%engine_version% in " + initTime + "ms");
|
logger.info("Initialized sos!engine v%engine_version% (commit %engine_git_commit_id_long%-%engine_git_branch%, dirty %engine_git_dirty%) in " + initTime + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,15 +19,22 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.data.info;
|
package de.staropensource.sosengine.base.data.info;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.Engine;
|
||||||
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
import de.staropensource.sosengine.base.types.CodePart;
|
||||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
|
||||||
import de.staropensource.sosengine.base.types.VersionType;
|
import de.staropensource.sosengine.base.types.VersionType;
|
||||||
import de.staropensource.sosengine.base.utility.PropertyParser;
|
import de.staropensource.sosengine.base.utility.PropertyParser;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,6 +112,124 @@ public final class EngineInformation {
|
||||||
private String versioningFork;
|
private String versioningFork;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the {@code dirty} value (i.e. if the source tree has been modified).
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the {@code dirty} value (i.e. if the source tree has been modified).
|
||||||
|
*
|
||||||
|
* @return git dirty value
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private Boolean gitDirty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the branch the engine was built on.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the branch the engine was built on.
|
||||||
|
*
|
||||||
|
* @return git branch
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private String gitBranch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the commit count.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the commit count.
|
||||||
|
*
|
||||||
|
* @return git commit count
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private int gitCommitCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the commit identifier (short form).
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the commit identifier (short form).
|
||||||
|
*
|
||||||
|
* @return git long commit id
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private String gitCommitIdentifierShort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the commit identifier (long form).
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the commit identifier (long form).
|
||||||
|
*
|
||||||
|
* @return git long commit id
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private String gitCommitIdentifierLong;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the commit header.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the commit header.
|
||||||
|
*
|
||||||
|
* @return git commit header
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private String gitCommitHeader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the commit time.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the commit time.
|
||||||
|
*
|
||||||
|
* @return git commit time
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private ZonedDateTime gitCommitTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the commiter's name.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the commiter's name.
|
||||||
|
*
|
||||||
|
* @return git committer name
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private String gitCommitterName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the commiter's email.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*
|
||||||
|
* -- GETTER --
|
||||||
|
* Provides the commiter's email.
|
||||||
|
*
|
||||||
|
* @return git committer email
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
private String gitCommitterEmail;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the version of the dependency {@code Lombok}.
|
* Provides the version of the dependency {@code Lombok}.
|
||||||
*
|
*
|
||||||
|
@ -215,19 +340,25 @@ public final class EngineInformation {
|
||||||
* @since 1-alpha0
|
* @since 1-alpha0
|
||||||
*/
|
*/
|
||||||
public EngineInformation() {
|
public EngineInformation() {
|
||||||
LoggerInstance logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
|
||||||
|
|
||||||
// Only allow one instance
|
// Only allow one instance
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = this;
|
instance = this;
|
||||||
else {
|
else {
|
||||||
logger.crash("Tried reinitializing " + getClass().getName() + " twice");
|
Logger.crash(new LogIssuer(getClass(), CodePart.ENGINE), "Tried reinitializing " + getClass().getName() + " twice");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates all variables.
|
||||||
|
*
|
||||||
|
* @since 1-alpha1
|
||||||
|
*/
|
||||||
|
public void load() {
|
||||||
|
LoggerInstance logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
||||||
|
|
||||||
// Load properties from bundled gradle.properties
|
// Load properties from bundled gradle.properties
|
||||||
Properties properties = new Properties();
|
Properties gradleProperties = new Properties();
|
||||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("gradle.properties");
|
InputStream gradleStream = this.getClass().getClassLoader().getResourceAsStream("gradle.properties");
|
||||||
|
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
logger.crash("Unable to load build information: The bundled gradle.properties file could not be found. Do symlinks work on the system that built this JAR?");
|
logger.crash("Unable to load build information: The bundled gradle.properties file could not be found. Do symlinks work on the system that built this JAR?");
|
||||||
|
@ -235,30 +366,76 @@ public final class EngineInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
properties.load(inputStream);
|
gradleProperties.load(gradleStream);
|
||||||
inputStream.close();
|
gradleStream.close();
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
logger.crash("Unable to load build information: InputStream failed", exception);
|
logger.crash("Unable to load build information: InputStream failed", exception);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new PropertyParser
|
// Load properties from bundled git.properties
|
||||||
PropertyParser parser = new PropertyParser(properties);
|
// or fill in blank information if file missing
|
||||||
|
Properties gitProperties = new Properties();
|
||||||
|
InputStream gitStream = this.getClass().getClassLoader().getResourceAsStream("git.properties");
|
||||||
|
if (gitStream == null) {
|
||||||
|
logger.error("Unable to load build information: The bundled git.properties file could not be found. Did you download a tarball?");
|
||||||
|
|
||||||
|
// Fake information
|
||||||
|
gitProperties.setProperty("git.total.commit.count", "0");
|
||||||
|
gitProperties.setProperty("git.dirty", "true");
|
||||||
|
gitProperties.setProperty("git.branch", "/unknown/");
|
||||||
|
gitProperties.setProperty("git.commit.id", "########################################");
|
||||||
|
gitProperties.setProperty("git.commit.id.abbrev", "#######");
|
||||||
|
gitProperties.setProperty("git.commit.message.short", "git.properties file is missing :/");
|
||||||
|
gitProperties.setProperty("git.commit.time", "1970-01-01T00:00:00+0000");
|
||||||
|
gitProperties.setProperty("git.commit.user.name", "git.properties file is missing :/");
|
||||||
|
gitProperties.setProperty("git.commit.user.email", "git.properties-is-missing@example.com");
|
||||||
|
} else {
|
||||||
|
// Load real information from git.properties file
|
||||||
|
try {
|
||||||
|
gitProperties.load(gitStream);
|
||||||
|
gitStream.close();
|
||||||
|
} catch (IOException exception) {
|
||||||
|
logger.crash("Unable to load build information: InputStream 'gitStream' failed", exception);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new PropertyParsers
|
||||||
|
PropertyParser gradleParser = new PropertyParser(gradleProperties);
|
||||||
|
PropertyParser gitParser = new PropertyParser(gitProperties);
|
||||||
|
|
||||||
// Apply properties to fields
|
// Apply properties to fields
|
||||||
versioningVersion = parser.getInteger("versioningVersion", true);
|
versioningVersion = gradleParser.getInteger("versioningVersion", true);
|
||||||
versioningType = VersionType.valueOf(parser.getString("versioningType").toUpperCase());
|
versioningType = VersionType.valueOf(gradleParser.getString("versioningType").toUpperCase());
|
||||||
versioningTyperelease = parser.getInteger("versioningTyperelease", true);
|
versioningTyperelease = gradleParser.getInteger("versioningTyperelease", true);
|
||||||
versioningFork = parser.getString("versioningFork");
|
versioningFork = gradleParser.getString("versioningFork");
|
||||||
|
|
||||||
dependencyLombok = parser.getString("dependencyLombok");
|
dependencyLombok = gradleParser.getString("dependencyLombok");
|
||||||
dependencyJetbrainsAnnotations = parser.getString("dependencyJetbrainsAnnotations");
|
dependencyJetbrainsAnnotations = gradleParser.getString("dependencyJetbrainsAnnotations");
|
||||||
dependencyJansi = parser.getString("dependencyJansi");
|
dependencyJansi = gradleParser.getString("dependencyJansi");
|
||||||
dependencyReflections = parser.getString("dependencyReflections");
|
dependencyReflections = gradleParser.getString("dependencyReflections");
|
||||||
dependencySlf4j = parser.getString("dependencySlf4j");
|
dependencySlf4j = gradleParser.getString("dependencySlf4j");
|
||||||
dependencyLwjgl = parser.getString("dependencyLwjgl");
|
dependencyLwjgl = gradleParser.getString("dependencyLwjgl");
|
||||||
|
|
||||||
pluginShadow = parser.getString("pluginShadow");
|
gitDirty = gitParser.getBoolean("git.dirty");
|
||||||
pluginLombok = parser.getString("pluginLombok");
|
gitBranch = gitParser.getString("git.branch");
|
||||||
|
gitCommitCount = gitParser.getInteger("git.total.commit.count", true);
|
||||||
|
gitCommitIdentifierShort = gitParser.getString("git.commit.id.abbrev");
|
||||||
|
gitCommitIdentifierLong = gitParser.getString("git.commit.id");
|
||||||
|
gitCommitHeader = gitParser.getString("git.commit.message.short");
|
||||||
|
try {
|
||||||
|
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ").parse(gitParser.getString("git.commit.time"));
|
||||||
|
GregorianCalendar calendar = new GregorianCalendar();
|
||||||
|
calendar.setTime(date);
|
||||||
|
gitCommitTime = calendar.toZonedDateTime();
|
||||||
|
} catch (ParseException e) {
|
||||||
|
logger.crash("Unable to load build information: Can't parse \"" + gitParser.getString("git.commit.time") + "\" using format \"yyyy-MM-dd'T'HH:mmZ\"");
|
||||||
|
}
|
||||||
|
gitCommitterName = gitParser.getString("git.commit.user.name");
|
||||||
|
gitCommitterEmail = gitParser.getString("git.commit.user.email");
|
||||||
|
|
||||||
|
pluginShadow = gradleParser.getString("pluginShadow");
|
||||||
|
pluginLombok = gradleParser.getString("pluginLombok");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_branch} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitBranch implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitBranch() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_branch";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", EngineInformation.getInstance().getGitBranch());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_header} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitHeader implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitHeader() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_header";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", EngineInformation.getInstance().getGitCommitHeader());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_id_long} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitIdLong implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitIdLong() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_id_long";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", EngineInformation.getInstance().getGitCommitIdentifierLong());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_id_short} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitIdShort implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitIdShort() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_id_short";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", EngineInformation.getInstance().getGitCommitIdentifierShort());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_time_day} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitTimeDay implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitTimeDay() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_time_day";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitCommitTime().getDayOfMonth()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_time_hour} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitTimeHour implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitTimeHour() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_time_hour";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitCommitTime().getHour()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_time_minute} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitTimeMinute implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitTimeMinute() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_time_minute";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitCommitTime().getMinute()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_time_month} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitTimeMonth implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitTimeMonth() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_time_month";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitCommitTime().getMonth()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_time_second} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitTimeSecond implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitTimeSecond() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_time_second";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitCommitTime().getSecond()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commit_time_year} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitTimeYear implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitTimeYear() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commit_time_year";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitCommitTime().getYear()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_commits} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommits implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommits() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_commits";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitCommitCount()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_committer_email} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitterEmail implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitterEmail() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_committer_email";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", EngineInformation.getInstance().getGitCommitterEmail());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_committer_name} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitCommitterName implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitCommitterName() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_committer_name";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", EngineInformation.getInstance().getGitCommitterName());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.staropensource.sosengine.base.data.placeholders;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
|
import de.staropensource.sosengine.base.data.info.EngineInformation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@code engine_git_dirty} placeholder.
|
||||||
|
*
|
||||||
|
* @see Placeholder
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unused" })
|
||||||
|
public final class EngineGitDirty implements Placeholder {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1-alpha0
|
||||||
|
*/
|
||||||
|
public EngineGitDirty() {}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
|
return "engine_git_dirty";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String replace(@NotNull String text) {
|
||||||
|
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getInstance().getGitDirty()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,6 +94,21 @@ public final class PlaceholderEngine {
|
||||||
placeholders.add(new EngineDependencyLwjgl());
|
placeholders.add(new EngineDependencyLwjgl());
|
||||||
placeholders.add(new EngineDependencyReflections());
|
placeholders.add(new EngineDependencyReflections());
|
||||||
placeholders.add(new EngineDependencySlf4j());
|
placeholders.add(new EngineDependencySlf4j());
|
||||||
|
// engine_git_*
|
||||||
|
placeholders.add(new EngineGitBranch());
|
||||||
|
placeholders.add(new EngineGitCommitHeader());
|
||||||
|
placeholders.add(new EngineGitCommitIdLong());
|
||||||
|
placeholders.add(new EngineGitCommitIdShort());
|
||||||
|
placeholders.add(new EngineGitCommits());
|
||||||
|
placeholders.add(new EngineGitCommitterEmail());
|
||||||
|
placeholders.add(new EngineGitCommitterName());
|
||||||
|
placeholders.add(new EngineGitCommitTimeDay());
|
||||||
|
placeholders.add(new EngineGitCommitTimeHour());
|
||||||
|
placeholders.add(new EngineGitCommitTimeMinute());
|
||||||
|
placeholders.add(new EngineGitCommitTimeMonth());
|
||||||
|
placeholders.add(new EngineGitCommitTimeSecond());
|
||||||
|
placeholders.add(new EngineGitCommitTimeYear());
|
||||||
|
placeholders.add(new EngineGitDirty());
|
||||||
// engine_plugin_*
|
// engine_plugin_*
|
||||||
placeholders.add(new EnginePluginLombok());
|
placeholders.add(new EnginePluginLombok());
|
||||||
placeholders.add(new EnginePluginShadow());
|
placeholders.add(new EnginePluginShadow());
|
||||||
|
|
|
@ -41,6 +41,7 @@ dependencyJoor=0.9.14
|
||||||
# Plugins
|
# Plugins
|
||||||
pluginShadow=8.1.1
|
pluginShadow=8.1.1
|
||||||
pluginLombok=8.6
|
pluginLombok=8.6
|
||||||
|
pluginGitProperties=2.4.2
|
||||||
|
|
||||||
# etc
|
# etc
|
||||||
group = de.staropensource.sosengine
|
group = de.staropensource.sosengine
|
||||||
|
|
Loading…
Reference in a new issue