mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Track build information in a better way
build.properties replaces buildcreator.properties, buildcreator.default.properties annd buildnumber.properties, but is untracked. 'git describe --tags --always HEAD' is now used to identify the build version, and its result is stored in the build properties file, included with the build. appinfo.properties is removed in favour of build.properties in the compiled jar. The build number is still tracked, but offline, allowing TFM commits to more easily be merged
This commit is contained in:
parent
6aeb56de07
commit
a7a2db15d6
16
.gitignore
vendored
16
.gitignore
vendored
@ -1,14 +1,14 @@
|
|||||||
# Netbeans excludes - StevenLawson & JeromSar
|
# Netbeans excludes
|
||||||
/nbproject/private/
|
nbproject/private/
|
||||||
/dist/
|
dist/
|
||||||
/build/
|
build/
|
||||||
manifest.mf
|
manifest.mf
|
||||||
|
|
||||||
# Eclipse excludes - JeromSar (old)
|
# Eclipse excludes
|
||||||
.project
|
.project
|
||||||
.classpath
|
.classpath
|
||||||
/bin/
|
bin/
|
||||||
/.settings/
|
.settings/
|
||||||
|
|
||||||
# OS generated files
|
# OS generated files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@ -19,4 +19,4 @@ ehthumbs.db
|
|||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
# TFM files
|
# TFM files
|
||||||
buildcreator.properties
|
build.properties
|
||||||
|
57
build.xml
57
build.xml
@ -3,23 +3,52 @@
|
|||||||
<description>Builds, tests, and runs the project TotalFreedomMod.</description>
|
<description>Builds, tests, and runs the project TotalFreedomMod.</description>
|
||||||
<import file="nbproject/build-impl.xml" />
|
<import file="nbproject/build-impl.xml" />
|
||||||
|
|
||||||
<target name="-pre-jar">
|
<!-- if "build.properties" exists, store that in "build.properties.exists" -->
|
||||||
<copy file="buildcreator.default.properties" tofile="buildcreator.properties" overwrite="false" />
|
<target name="-build-properties-exists">
|
||||||
|
<available property="build.properties.exists" file="build.properties"/>
|
||||||
<property file="buildcreator.properties"/>
|
|
||||||
<buildnumber file="buildnumber.properties" />
|
|
||||||
|
|
||||||
<propertyfile file="appinfo.properties">
|
|
||||||
<entry key="program.buildnumber" value="${build.number}" />
|
|
||||||
<entry key="program.builddate" type="date" value="now" pattern="MM/dd/yyyy hh:mm aa" />
|
|
||||||
<entry key="program.buildcreator" value="${program.buildcreator}" />
|
|
||||||
</propertyfile>
|
|
||||||
<copy file="appinfo.properties" todir="${build.classes.dir}" />
|
|
||||||
<delete file="appinfo.properties" />
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<!-- Creates build.properties, unless it exists already -->
|
||||||
|
<target name="create-build-properties" depends="-build-properties-exists" unless="build.properties.exists">
|
||||||
|
<propertyfile file="build.properties" comment="Build information. Edit this to your liking.">
|
||||||
|
<entry key="program.builder" default="unknown" />
|
||||||
|
</propertyfile>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Pre-jar property generation -->
|
||||||
|
<target name="-pre-jar" depends="create-build-properties">
|
||||||
|
|
||||||
|
<!-- Determine git version -->
|
||||||
|
<exec executable="git" outputproperty="program.buildhead" failifexecutionfails="false" errorproperty="">
|
||||||
|
<arg value="describe"/>
|
||||||
|
<arg value="--tags"/>
|
||||||
|
<arg value="--always"/>
|
||||||
|
<arg value="HEAD"/>
|
||||||
|
</exec>
|
||||||
|
<condition property="repository.version" value="${program.buildhead}" else="unknown">
|
||||||
|
<and>
|
||||||
|
<isset property="program.buildhead"/>
|
||||||
|
<length string="${program.buildhead}" trim="yes" length="0" when="greater"/>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<!-- Load build.properties file -->
|
||||||
|
<property file="build.properties"/>
|
||||||
|
|
||||||
|
<!-- Load buildnumber from build.properties, store in ${build.number} -->
|
||||||
|
<buildnumber file="build.properties" />
|
||||||
|
|
||||||
|
<!-- Write build info -->
|
||||||
|
<propertyfile file="${build.classes.dir}/build.properties">
|
||||||
|
<entry key="program.buildnumber" value="${build.number}" />
|
||||||
|
<entry key="program.buildhead" value="${program.buildhead}" />
|
||||||
|
<entry key="program.builder" value="${program.builder}" />
|
||||||
|
<entry key="program.builddate" type="date" value="now" pattern="yyyy-MM-dd hh:mm aa" />
|
||||||
|
</propertyfile>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Cleanup -->
|
||||||
<target name="-post-jar">
|
<target name="-post-jar">
|
||||||
<!-- Cleanup -->
|
|
||||||
<delete file="${dist.dir}/README.TXT" />
|
<delete file="${dist.dir}/README.TXT" />
|
||||||
<delete dir="${dist.dir}/lib/" />
|
<delete dir="${dist.dir}/lib/" />
|
||||||
</target>
|
</target>
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#
|
|
||||||
# Build creator configuration
|
|
||||||
#
|
|
||||||
# Note: Do not edit this file! Edit the generated "buildcreator.properties" file instead.
|
|
||||||
#
|
|
||||||
program.buildcreator=Unknown
|
|
@ -1,3 +0,0 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
|
||||||
#Sun Sep 06 17:00:40 CEST 2015
|
|
||||||
build.number=1055
|
|
@ -44,28 +44,32 @@ public class Command_tfm extends TFM_Command
|
|||||||
TFM_BanManager.load();
|
TFM_BanManager.load();
|
||||||
TFM_CommandBlocker.load();
|
TFM_CommandBlocker.load();
|
||||||
|
|
||||||
final String message = String.format("%s v%s.%s reloaded.",
|
final String message = String.format("%s v%s reloaded.",
|
||||||
TotalFreedomMod.pluginName,
|
TotalFreedomMod.pluginName,
|
||||||
TotalFreedomMod.pluginVersion,
|
TotalFreedomMod.pluginVersion);
|
||||||
TotalFreedomMod.buildNumber);
|
|
||||||
|
|
||||||
playerMsg(message);
|
playerMsg(message);
|
||||||
TFM_Log.info(message);
|
TFM_Log.info(message);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TotalFreedomMod.BuildProperties build = TotalFreedomMod.build;
|
||||||
playerMsg("TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD);
|
playerMsg("TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD);
|
||||||
playerMsg(String.format("Version "
|
|
||||||
+ ChatColor.BLUE + "%s.%s" + ChatColor.GOLD + ", built "
|
|
||||||
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + " by "
|
|
||||||
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ".",
|
|
||||||
TotalFreedomMod.pluginVersion,
|
|
||||||
TotalFreedomMod.buildNumber,
|
|
||||||
TotalFreedomMod.buildDate,
|
|
||||||
TotalFreedomMod.buildCreator), ChatColor.GOLD);
|
|
||||||
playerMsg("Running on " + TFM_ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
|
playerMsg("Running on " + TFM_ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
|
||||||
playerMsg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD);
|
playerMsg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD);
|
||||||
playerMsg("Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
playerMsg(String.format("Version "
|
||||||
|
+ ChatColor.BLUE + "%s.%s " + ChatColor.GOLD + "("
|
||||||
|
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ")",
|
||||||
|
TotalFreedomMod.pluginVersion,
|
||||||
|
build.number,
|
||||||
|
build.head), ChatColor.GOLD);
|
||||||
|
playerMsg(String.format("Compiled "
|
||||||
|
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + " by "
|
||||||
|
+ ChatColor.BLUE + "%s",
|
||||||
|
build.date,
|
||||||
|
build.builder), ChatColor.GOLD);
|
||||||
|
playerMsg("Visit " + ChatColor.AQUA + "http://github.com/TotalFreedom/TotalFreedomMod"
|
||||||
|
+ ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ public class TFM_FrontDoor
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
tempUrl = new URL("http://frontdoor.aws.af.cm/poll"
|
tempUrl = new URL("http://frontdoor.aws.af.cm/poll"
|
||||||
+ "?version=" + TotalFreedomMod.pluginVersion + "-" + TotalFreedomMod.buildCreator
|
+ "?version=" + TotalFreedomMod.build.formattedVersion()
|
||||||
+ "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString() + ":" + TotalFreedomMod.server.getPort()
|
+ "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString() + ":" + TotalFreedomMod.server.getPort()
|
||||||
+ "&name=" + TFM_ConfigEntry.SERVER_NAME.getString()
|
+ "&name=" + TFM_ConfigEntry.SERVER_NAME.getString()
|
||||||
+ "&bukkitversion=" + Bukkit.getVersion());
|
+ "&bukkitversion=" + Bukkit.getVersion());
|
||||||
|
@ -4,7 +4,6 @@ import com.google.common.base.Function;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -45,13 +44,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public static final String PROTECTED_AREA_FILENAME = "protectedareas.dat";
|
public static final String PROTECTED_AREA_FILENAME = "protectedareas.dat";
|
||||||
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
||||||
//
|
//
|
||||||
|
public static final BuildProperties build = new BuildProperties();
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final String YOU_ARE_NOT_OP = me.StevenLawson.TotalFreedomMod.Commands.TFM_Command.YOU_ARE_NOT_OP;
|
public static final String YOU_ARE_NOT_OP = me.StevenLawson.TotalFreedomMod.Commands.TFM_Command.YOU_ARE_NOT_OP;
|
||||||
//
|
//
|
||||||
public static String buildNumber = "1";
|
|
||||||
public static String buildDate = TotalFreedomMod.buildDate = TFM_Util.dateToString(new Date());
|
|
||||||
public static String buildCreator = "Unknown";
|
|
||||||
//
|
|
||||||
public static Server server;
|
public static Server server;
|
||||||
public static TotalFreedomMod plugin;
|
public static TotalFreedomMod plugin;
|
||||||
public static String pluginName;
|
public static String pluginName;
|
||||||
@ -71,14 +67,15 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_Log.setPluginLogger(plugin.getLogger());
|
TFM_Log.setPluginLogger(plugin.getLogger());
|
||||||
TFM_Log.setServerLogger(server.getLogger());
|
TFM_Log.setServerLogger(server.getLogger());
|
||||||
|
|
||||||
setAppProperties();
|
build.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
TFM_Log.info("Made by Madgeek1450 and Prozza");
|
TFM_Log.info("Created by Madgeek1450 and Prozza");
|
||||||
TFM_Log.info("Compiled " + buildDate + " by " + buildCreator);
|
TFM_Log.info("Version " + build.formattedVersion());
|
||||||
|
TFM_Log.info("Compiled " + build.date + " by " + build.builder);
|
||||||
|
|
||||||
final TFM_Util.MethodTimer timer = new TFM_Util.MethodTimer();
|
final TFM_Util.MethodTimer timer = new TFM_Util.MethodTimer();
|
||||||
timer.start();
|
timer.start();
|
||||||
@ -217,25 +214,37 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
return TFM_CommandHandler.handleCommand(sender, cmd, commandLabel, args);
|
return TFM_CommandHandler.handleCommand(sender, cmd, commandLabel, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setAppProperties()
|
public static class BuildProperties {
|
||||||
{
|
public String builder;
|
||||||
try
|
public String number;
|
||||||
{
|
public String head;
|
||||||
final InputStream in = plugin.getResource("appinfo.properties");
|
public String date;
|
||||||
Properties props = new Properties();
|
|
||||||
|
|
||||||
// in = plugin.getClass().getResourceAsStream("/appinfo.properties");
|
public void load() {
|
||||||
props.load(in);
|
try
|
||||||
in.close();
|
{
|
||||||
|
final InputStream in = plugin.getResource("build.properties");
|
||||||
|
|
||||||
TotalFreedomMod.buildNumber = props.getProperty("program.buildnumber");
|
final Properties props = new Properties();
|
||||||
TotalFreedomMod.buildDate = props.getProperty("program.builddate");
|
props.load(in);
|
||||||
TotalFreedomMod.buildCreator = props.getProperty("program.buildcreator");
|
in.close();
|
||||||
|
|
||||||
|
builder = props.getProperty("program.builder", "unknown");
|
||||||
|
number = props.getProperty("program.buildnumber", "1");
|
||||||
|
head = props.getProperty("program.buildhead", "unknown");
|
||||||
|
date = props.getProperty("program.builddate", "unknown");
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TFM_Log.severe("Could not load build properties! Did you compile with Netbeans/ANT?");
|
||||||
|
TFM_Log.severe(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
public String formattedVersion() {
|
||||||
TFM_Log.severe("Could not load App properties!");
|
return pluginVersion + "." + number + " (" + head + ")";
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user