[Patchanim-commit] SF.net SVN: patchanim: [123] trunk/patchanim
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-02-09 16:15:15
|
Revision: 123 http://patchanim.svn.sourceforge.net/patchanim/?rev=123&view=rev Author: dbrosius Date: 2008-02-09 08:15:18 -0800 (Sat, 09 Feb 2008) Log Message: ----------- auto generate the file version Modified Paths: -------------- trunk/patchanim/build.xml trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java Modified: trunk/patchanim/build.xml =================================================================== --- trunk/patchanim/build.xml 2008-02-09 16:01:47 UTC (rev 122) +++ trunk/patchanim/build.xml 2008-02-09 16:15:18 UTC (rev 123) @@ -34,7 +34,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="patchanim.version" value="0.3.0"/> + <property name="patchanim.version" value="0.4.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> @@ -74,6 +74,7 @@ <include name="**/*.xsl"/> </fileset> </copy> + <echo message="${patchanim.version}" file="${classes.dir}/com/mebigfatguy/patchanim/io/Version.txt"/> </target> <target name="jar" depends="compile, resources" description="produces the patchanim jar file"> @@ -84,6 +85,7 @@ <include name="**/*.gif"/> <include name="**/*.xsd"/> <include name="**/*.xsl"/> + <include name="**/*.txt"/> </fileset> <fileset dir="${basedir}"> <include name="license.txt"/> @@ -105,6 +107,7 @@ <include name="${src.dir}/**/*.xsd"/> <include name="${src.dir}/**/*.xsl"/> <include name="${lib.dir}/**/*.jar"/> + <include name="*.txt"/> </fileset> </zip> </target> Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-02-09 16:01:47 UTC (rev 122) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-02-09 16:15:18 UTC (rev 123) @@ -32,7 +32,10 @@ <xsl:variable name="ext" select="pae:new($doc)"/> <xsl:template match="/"> - <PatchAnimDoc version="0.2.0"> + <PatchAnimDoc> + <xsl:attribute name="version"> + <xsl:value-of select="pae:getVersion($ext)"/> + </xsl:attribute> <Settings> <xsl:attribute name="width"> <xsl:value-of select="pae:getWidth($ext)"/> Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-02-09 16:01:47 UTC (rev 122) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-02-09 16:15:18 UTC (rev 123) @@ -18,6 +18,10 @@ */ package com.mebigfatguy.patchanim.io; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -33,7 +37,7 @@ import com.mebigfatguy.patchanim.surface.PatchCoords; public class PatchAnimExtension { - + private static final String VERSION_URL = "/com/mebigfatguy/patchanim/io/Version.txt"; private PatchAnimDocument paDoc; private Document d; @@ -44,6 +48,18 @@ d = db.newDocument(); } + public String getVersion(@SuppressWarnings("unused") ExpressionContext context) { + BufferedReader br = null; + try { + br = new BufferedReader(new InputStreamReader(PatchAnimExtension.class.getResourceAsStream(VERSION_URL))); + return br.readLine(); + } catch (IOException ioe) { + return "0.0.0"; + } finally { + Closer.close(br); + } + } + public String getWidth(@SuppressWarnings("unused") ExpressionContext context) { return String.valueOf(paDoc.getWidth()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |