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

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
@ -167,15 +168,18 @@ public class BungeeCord extends ProxyServer
*/
public static void main(String[] args) throws Exception
{
Calendar deadline = Calendar.getInstance();
deadline.set( 2013, 9, 31 ); // year, month, date
if ( Calendar.getInstance().after( deadline ) )
if ( BungeeCord.class.getPackage().getSpecificationVersion() != null )
{
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( "*** You will get NO support regarding this build ***" );
System.err.println( "*** Server will start in 30 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 30 ) );
Calendar deadline = Calendar.getInstance();
deadline.add( Calendar.WEEK_OF_YEAR, 2 );
if ( Calendar.getInstance().after( new SimpleDateFormat( "yyyyMMdd" ).parse( BungeeCord.class.getPackage().getSpecificationVersion() ) ) )
{
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( "*** You will get NO support regarding this build ***" );
System.err.println( "*** Server will start in 30 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 30 ) );
}
}
BungeeCord bungee = new BungeeCord();