Dynamic build dates - see #526

This commit is contained in:
md_5 2013-09-10 11:36:49 +10:00
parent ffdb917f2c
commit 49cffebd9b
2 changed files with 23 additions and 8 deletions

View File

@ -18,6 +18,10 @@
<name>BungeeCord-Proxy</name> <name>BungeeCord-Proxy</name>
<description>Proxy component of the Elastic Portal Suite</description> <description>Proxy component of the Elastic Portal Suite</description>
<properties>
<maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
@ -71,6 +75,12 @@
<build> <build>
<finalName>BungeeCord</finalName> <finalName>BungeeCord</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<!-- Don't deploy proxy to maven repo, only APIs --> <!-- Don't deploy proxy to maven repo, only APIs -->
@ -89,6 +99,7 @@
<manifestEntries> <manifestEntries>
<Main-Class>net.md_5.bungee.BungeeCord</Main-Class> <Main-Class>net.md_5.bungee.BungeeCord</Main-Class>
<Implementation-Version>${describe}</Implementation-Version> <Implementation-Version>${describe}</Implementation-Version>
<Specification-Version>${maven.build.timestamp}</Specification-Version>
</manifestEntries> </manifestEntries>
</archive> </archive>
</configuration> </configuration>

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -166,10 +167,12 @@ public class BungeeCord extends ProxyServer
* @throws Exception when the server cannot be started * @throws Exception when the server cannot be started
*/ */
public static void main(String[] args) throws Exception public static void main(String[] args) throws Exception
{
if ( BungeeCord.class.getPackage().getSpecificationVersion() != null )
{ {
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.set( 2013, 9, 31 ); // year, month, date deadline.add( Calendar.WEEK_OF_YEAR, 2 );
if ( Calendar.getInstance().after( deadline ) ) if ( Calendar.getInstance().after( new SimpleDateFormat( "yyyyMMdd" ).parse( BungeeCord.class.getPackage().getSpecificationVersion() ) ) )
{ {
System.err.println( "*** Warning, this build is outdated ***" ); System.err.println( "*** Warning, this build is outdated ***" );
System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" ); System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" );
@ -177,6 +180,7 @@ public class BungeeCord extends ProxyServer
System.err.println( "*** Server will start in 30 seconds ***" ); System.err.println( "*** Server will start in 30 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 30 ) ); Thread.sleep( TimeUnit.SECONDS.toMillis( 30 ) );
} }
}
BungeeCord bungee = new BungeeCord(); BungeeCord bungee = new BungeeCord();
ProxyServer.setInstance( bungee ); ProxyServer.setInstance( bungee );