Skip to content

Commit

Permalink
Improved build automation.
Browse files Browse the repository at this point in the history
  • Loading branch information
albertus82 committed Sep 28, 2014
1 parent eb52b7f commit 871c450
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
13 changes: 13 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
<property file="build.properties" />
<property file="build.properties.default" />

<property file="src/version.properties" />

<property name="main.class" value="it.albertus.cycles.engine.CyclesMod" />

<scriptdef language="javascript" name="lower">
<attribute name="string" />
<attribute name="to" />
project.setProperty( attributes.get( "to" ), attributes.get( "string" ).toLowerCase() );
</scriptdef>

<target name="clean">
<delete dir="${build.dir}" />
</target>
Expand Down Expand Up @@ -45,4 +53,9 @@
<jar destfile="${build.dir}/dist/${ant.project.name}.jar" basedir="${build.dir}/classes" level="9" />
</target>

<target name="zip" depends="jar">
<lower string="${ant.project.name}" to="project.name.lowercase" />
<zip destfile="${build.dir}/release/${project.name.lowercase}-${version.number}-bin.zip" basedir="${build.dir}/dist" level="9" />
</target>

</project>
14 changes: 11 additions & 3 deletions src/it/albertus/cycles/engine/CyclesMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class CyclesMod {

private static final Logger log = LoggerFactory.getLogger( CyclesMod.class );

private static final String VERSION_NUMBER = "1.1.2";
private static final String BUILD_DATE = "2014-09-26";
private static final String VERSION_FILE_PATH = "/";
private static final String VERSION_FILE_NAME = "version.properties";

private static final String CFG_FILE_NAME = "BIKES.CFG";

Expand All @@ -58,7 +58,7 @@ public CyclesMod( String path ) {

public static void main( final String... args ) throws Exception {
try {
log.info( Messages.get( "msg.welcome", VERSION_NUMBER, BUILD_DATE ) );
log.info( getWelcomeMessage() );

// Gestione parametri da riga di comando...
if ( args.length > 1 ) {
Expand All @@ -85,6 +85,14 @@ public static void main( final String... args ) throws Exception {
}
}
}

private static String getWelcomeMessage() throws IOException {
InputStream is = CyclesMod.class.getResourceAsStream( VERSION_FILE_PATH + VERSION_FILE_NAME );
Properties version = new Properties();
version.load( is );
is.close();
return Messages.get( "msg.welcome", version.get( "version.number" ), version.get( "version.date" ) );
}

private void execute() throws Exception {
log.info( Messages.get( "msg.reading.original.file" , BikesInf.NAME ) );
Expand Down
2 changes: 2 additions & 0 deletions src/version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version.number=1.1.2
version.date=2014-09-28

0 comments on commit 871c450

Please sign in to comment.