Implement support for git commit versioning
This commit also removes the Makefile introduced in 80236e6130
as make doesn't seem to like $().
This commit is contained in:
parent
d3d81f947b
commit
77f7c34298
4 changed files with 30 additions and 11 deletions
10
Makefile
10
Makefile
|
@ -1,10 +0,0 @@
|
|||
.PHONY: dist help build clean
|
||||
dist: help
|
||||
help:
|
||||
@echo "make help -> Displays all available tasks"
|
||||
@echo " build -> Compiles the source code into a usable jar file"
|
||||
@echo " clean -> Cleans the repository"
|
||||
build:
|
||||
./gradlew shadowJar
|
||||
clean:
|
||||
rm -rf .gradle build
|
21
build.sh
Executable file
21
build.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
echo ":: Renaming GitHead.java to GitHead.javabak"
|
||||
mv src/main/java/de/pickshadow/plugin/GitHead.java src/main/java/de/pickshadow/plugin/GitHead.javabak
|
||||
echo ":: Writing new GitHead.java"
|
||||
cat << EOF >> src/main/java/de/pickshadow/plugin/GitHead.java
|
||||
package de.pickshadow.plugin;
|
||||
|
||||
public class GitHead {
|
||||
public static String commitSha = "$(git rev-parse HEAD)";
|
||||
public static String commitShaShort = "$(git rev-parse --short HEAD)";
|
||||
public static String commitMessage = "$(PAGER= git log --format=%B -n 1 $(git rev-parse HEAD)|head -1|sed "s/\\\/\\\\/g"|sed "s/\"/\\\\\"/g")";
|
||||
}
|
||||
EOF
|
||||
echo ":: Compiling plugin"
|
||||
./gradlew shadowJar
|
||||
EXITCODE="${?}"
|
||||
echo ":: Renaming GitHead.javabak to GitHead.java"
|
||||
mv src/main/java/de/pickshadow/plugin/GitHead.javabak src/main/java/de/pickshadow/plugin/GitHead.java
|
||||
echo ":: Exiting with code ${EXITCODE}"
|
||||
exit "${EXITCODE}"
|
7
src/main/java/de/pickshadow/plugin/GitHead.java
Normal file
7
src/main/java/de/pickshadow/plugin/GitHead.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package de.pickshadow.plugin;
|
||||
|
||||
public class GitHead {
|
||||
public static String commitSha = "<unknown>";
|
||||
public static String commitShaShort = "<unknown>";
|
||||
public static String commitMessage = "<unknown>";
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
package de.pickshadow.plugin.classes;
|
||||
|
||||
import de.pickshadow.plugin.BuildConfiguration;
|
||||
import de.pickshadow.plugin.GitHead;
|
||||
import de.pickshadow.plugin.ObjHolder;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -42,7 +43,7 @@ public class Translation {
|
|||
public static String EVENT_LEAVE = "<HIGHLIGHT>%player% <reset>hat den Server verlassen.";
|
||||
|
||||
// Command: /pssp
|
||||
public static String PLUGINCOMMAND_INFO = "<#d60532><bold>PickShadow Server Plugin v" + BuildConfiguration.pluginRelease + "-" + BuildConfiguration.getTypeAsString(true) + BuildConfiguration.pluginTyperelease + "</bold>\n" +
|
||||
public static String PLUGINCOMMAND_INFO = "<#d60532><bold>PickShadow Server Plugin v" + BuildConfiguration.pluginRelease + "-" + BuildConfiguration.getTypeAsString(true) + BuildConfiguration.pluginTyperelease + "</bold> (commit <bold><italic>" + GitHead.commitShaShort + "</italic></bold>)\n" +
|
||||
"Entwickelt von <bold>" + Arrays.toString(BuildConfiguration.pluginAuthors).replace("[", "").replace("]", "") + " & Beitragenden</bold>.\n" +
|
||||
"Der Quellcode ist unter der <bold>" + BuildConfiguration.pluginLicense + " Lizenz </bold>lizensiert und kann <underlined><click:open_url:" + BuildConfiguration.pluginSourceCode + ">hier</click></underlined> gefunden werden.";
|
||||
public static String PLUGINCOMMAND_RELOAD_CONFIG = "Die Konfigurationsdatei wird neugeladen, einen Moment bitte...";
|
||||
|
|
Loading…
Reference in a new issue