.classpath | 25 ++- build.xml | 301 ++++++++++++++++------------------------ buildRails.xml | 159 +++++++++++++++++++++ buildinfo.xml | 16 -- data/Properties.xml | 2 dev/null |binary rails.bat | 2 rails.sh | 2 rails/common/parser/Config.java | 14 + rails/game/Game.java | 5 test/SVGApplication.java | 105 ------------- test/SVGOffscreenLoader.java | 192 ------------------------- version.number | 5 13 files changed, 328 insertions(+), 500 deletions(-) New commits: commit afa0b856fe9eb2940de45b24d0eb29d0c03abf6c Author: Stefan Frey <ste...@we...> Date: Mon Nov 28 16:34:12 2011 +0100 Further additions to get working build diff --git a/.classpath b/.classpath index 25b28ed..d69b9b9 100644 --- a/.classpath +++ b/.classpath @@ -5,12 +5,25 @@ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2/log4j-1.2.14.jar"/> <classpathentry exported="true" kind="lib" path="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> <classpathentry exported="true" kind="lib" path="lib/jgraph5/jgraph.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/batik.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-bridge.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-dom.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-ext.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-gvt.jar"/> - <classpathentry exported="true" kind="lib" path="lib/batik-1.7/lib/batik-util.jar"/> <classpathentry kind="lib" path="lib/junit-4.8.2/junit.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-transcoder.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-dom.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-swing.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-bridge.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/xml-apis.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-ext.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-gui-util.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-util.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-awt-util.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-css.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-gvt.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-parser.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-script.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-svg-dom.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-xml.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/js.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/xerces_2_5_0.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/xml-apis-ext.jar"/> + <classpathentry kind="lib" path="lib/batik-1.7/lib/batik-anim.jar"/> <classpathentry kind="output" path="classes"/> </classpath> diff --git a/build.xml b/build.xml index 107fde2..2943231 100644 --- a/build.xml +++ b/build.xml @@ -16,17 +16,32 @@ <pathelement location="lib/log4j-1.2/log4j-1.2.14.jar"/> <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> <pathelement location="lib/jgraph5/jgraph.jar"/> - <pathelement location="lib/batik-1.7/batik.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> + <pathelement location="lib/junit-4.8.2/junit.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-transcoder.jar"/> <pathelement location="lib/batik-1.7/lib/batik-dom.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-swing.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> + <pathelement location="lib/batik-1.7/lib/xml-apis.jar"/> <pathelement location="lib/batik-1.7/lib/batik-ext.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-gui-util.jar"/> <pathelement location="lib/batik-1.7/lib/batik-util.jar"/> - <pathelement location="lib/junit-4.8.2/junit.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-awt-util.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-css.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-parser.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-script.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-svg-dom.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-xml.jar"/> + <pathelement location="lib/batik-1.7/lib/js.jar"/> + <pathelement location="lib/batik-1.7/lib/xerces_2_5_0.jar"/> + <pathelement location="lib/batik-1.7/lib/xml-apis-ext.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-anim.jar"/> </path> <target name="init"> <mkdir dir="classes"/> + <!-- this is added --> <copy includeemptydirs="false" todir="classes"> + <filterset refid="developFilter"/> <fileset dir="."> <exclude name="**/*.launch"/> <exclude name="**/*.java"/> diff --git a/buildRails.xml b/buildRails.xml index 142d350..3185488 100644 --- a/buildRails.xml +++ b/buildRails.xml @@ -1,7 +1,13 @@ <?eclipse.ant.import ?> <!-- Extensions to the automatic ant file created by eclipse --> <project basedir="." default="build" name="Rails"> - + + <!-- Sourceforge properties --> + <property name="sf.uri" value="frs.sourceforge.net:/home/frs/project/r/ra/rails/"/> + <property name="sf.filedir" value="Rails/"/> + <property name="sf.user" value="stefanfrey"/> + <!-- Password is asked for --> + <!-- Define a property for the version number --> <property file="version.number"/> @@ -9,13 +15,14 @@ <filterset id="versionFilter"> <filter token="VERSION" value="${version}"/> </filterset> - + <!-- Define a filter to substitute develop tag to version number --> + <filterset id="developFilter"> + <filter token="DEVELOP" value=""/> + </filterset> + <!-- Clean the current release --> <target name="clean-release"> - <delete> - <fileset dir="jar"/> - <fileset dir="rails-${version}"/> - </delete> + <delete dir="rails-${version}"/> </target> <!-- Target that creates the release jar @@ -23,7 +30,6 @@ <target name="build-release" depends="clean-release,clean,build"> <mkdir dir="jar"/> <copy includeemptydirs="false" todir="jar"> - <filterset refid="versionFilter"/> <fileset dir="classes"> <exclude name="**/*.launch"/> <exclude name="**/*.java"/> @@ -33,7 +39,6 @@ <exclude name="18xx.log"/> <exclude name="build.xml"/> <exclude name="buildinfo.xml"/> - <exclude name="user.profiles"/> <exclude name="manifest"/> <exclude name="doc/*"/> <exclude name="html/*"/> @@ -42,7 +47,6 @@ <exclude name="rails-*-${version}/**"/> <exclude name="rails.bat"/> <exclude name="rails.sh"/> - <exclude name="version.number"/> <exclude name=".project"/> <exclude name=".classpath"/> <exclude name=".git/**"/> @@ -54,36 +58,102 @@ </fileset> </copy> <mkdir dir="rails-${version}"/> + <copy includeemptydirs="false" todir="rails-${version}/lib"> + <fileset dir="./lib"> + <include name="log4j-1.2/log4j-1.2.14.jar" /> + <include name="jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> + <include name="jgraph5/jgraph.jar" /> + <include name="junit-4.8.2/junit.jar" /> + <include name="batik-1.7/lib/batik-transcoder.jar" /> + <include name="batik-1.7/lib/batik-dom.jar" /> + <include name="batik-1.7/lib/batik-swing.jar" /> + <include name="batik-1.7/lib/batik-bridge.jar" /> + <include name="batik-1.7/lib/xml-apis.jar" /> + <include name="batik-1.7/lib/batik-ext.jar" /> + <include name="batik-1.7/lib/batik-gui-util.jar" /> + <include name="batik-1.7/lib/batik-util.jar" /> + <include name="batik-1.7/lib/batik-awt-util.jar" /> + <include name="batik-1.7/lib/batik-css.jar" /> + <include name="batik-1.7/lib/batik-gvt.jar" /> + <include name="batik-1.7/lib/batik-parser.jar" /> + <include name="batik-1.7/lib/batik-script.jar" /> + <include name="batik-1.7/lib/batik-svg-dom.jar" /> + <include name="batik-1.7/lib/batik-xml.jar" /> + <include name="batik-1.7/lib/js.jar" /> + <include name="batik-1.7/lib/xerces_2_5_0.jar" /> + <include name="batik-1.7/lib/xml-apis-ext.jar" /> + <include name="batik-1.7/lib/batik-anim.jar" /> + </fileset> + </copy> <copy includeemptydirs="false" todir="rails-${version}"> - <filterset refid="versionFilter"/> - <fileset dir="."> + <filterset refid="versionFilter"/> + <fileset dir="."> <include name="LICENSE"/> <include name="README"/> <include name="AUTHORS"/> <include name="rails.bat"/> <include name="rails.sh"/> - <include name="my.properties"/> - <include name="LocalisedText.properties"/> - <include name="games.properties"/> - <include name="lib/**"/> </fileset> </copy> + <!-- adds executable flags to rails.sh --> + <chmod file="rails-${version}/rails.sh" perm="ugo+rx"/> + <jar destfile="rails-${version}/rails-${version}.jar" basedir="jar" duplicate="preserve"> <manifest> <attribute name="Main-Class" value="rails.util.RunGame" /> - <attribute name="Class-Path" value="./my.properties + <attribute name="Class-Path" value=" ./LocalisedText.properties - ./lib/log4j-1.2/log4j-1.2.14.jar - ./lib/batik-1.7/batik.jar - ./lib/batik-1.7/lib/batik-util.jar - ./lib/batik-1.7/lib/batik-dom.jar - ./lib/batik-1.7/lib/batik-bridge.jar - ./lib/batik-1.7/lib/batik-ext.jar - ./lib/batik-1.7/lib/batik-gvt.jar - ./lib/jgraph5/jgraph.jar - ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> + ./log4j.properties + ./lib/log4j-1.2/log4j-1.2.14.jar + ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar + ./lib/jgraph5/jgraph.jar + ./lib/junit-4.8.2/junit.jar + ./lib/batik-1.7/lib/batik-transcoder.jar + ./lib/batik-1.7/lib/batik-dom.jar + ./lib/batik-1.7/lib/batik-swing.jar + ./lib/batik-1.7/lib/batik-bridge.jar + ./lib/batik-1.7/lib/xml-apis.jar + ./lib/batik-1.7/lib/batik-ext.jar + ./lib/batik-1.7/lib/batik-gui-util.jar + ./lib/batik-1.7/lib/batik-util.jar + ./lib/batik-1.7/lib/batik-awt-util.jar + ./lib/batik-1.7/lib/batik-css.jar + ./lib/batik-1.7/lib/batik-gvt.jar + ./lib/batik-1.7/lib/batik-parser.jar + ./lib/batik-1.7/lib/batik-script.jar + ./lib/batik-1.7/lib/batik-svg-dom.jar + ./lib/batik-1.7/lib/batik-xml.jar + ./lib/batik-1.7/lib/js.jar + ./lib/batik-1.7/lib/xerces_2_5_0.jar + ./lib/batik-1.7/lib/xml-apis-ext.jar + ./lib/batik-1.7/lib/batik-anim.jar"/> </manifest> - </jar> - </target> - + </jar> + <delete dir="jar"/> + <tar destfile="../rails-${version}.tar.gz" compression="gzip"> + <!-- adds executable flags to rails.sh, has to be done again for the tar (see above) --> + <tarfileset dir="." filemode="755"> + <include name="rails-${version}/rails.sh"/> + </tarfileset> + <tarfileset dir="."> + <include name="rails-${version}/**"/> + <exclude name="rails-${version}/rails.sh"/> + </tarfileset> + </tar> + <zip destfile="../rails-${version}.zip" basedir="." includes="rails-${version}/**"/> + </target> + <target name="publish-release"> + <exec executable="rsync" dir=".." failonerror="true"> + <arg value="-avP"/> + <arg value="-e"/> + <arg value="ssh"/> + <arg value="rails-${version}.zip"/> + <arg value="rails-${version}.tar.gz"/> + <arg value="${sf.user},rails@${sf.uri}${sf.filedir}${version}/"/> + </exec> + <exec executable="scp" dir="../rails-${version}" failonerror="true"> + <arg value="Readme.txt"/> + <arg value="${sf.user},rails@${sf.uri}${sf.filedir}${version}/"/> + </exec> + </target> </project> \ No newline at end of file diff --git a/rails/common/parser/Config.java b/rails/common/parser/Config.java index b1895e7..63308d1 100644 --- a/rails/common/parser/Config.java +++ b/rails/common/parser/Config.java @@ -16,6 +16,7 @@ import java.util.Properties; import org.apache.log4j.Logger; +import rails.game.Game; import rails.game.GameManager; import rails.util.Util; @@ -436,6 +437,19 @@ public final class Config { loadProfile(selectedProfile); propertiesLoaded = true; } + + /* Load version number as resource */ + Properties versionNumber = new Properties(); + loadPropertyFile(versionNumber, "version.number", true); + String version = versionNumber.getProperty("version"); + String develop = versionNumber.getProperty("develop"); + if (Util.hasValue("version")) { + if (Util.hasValue(develop)) { + Game.version = version + "+"; + } else { + Game.version = version; + } + } } diff --git a/rails/game/Game.java b/rails/game/Game.java index 250e6b4..a24cbc5 100644 --- a/rails/game/Game.java +++ b/rails/game/Game.java @@ -14,7 +14,10 @@ import rails.game.action.PossibleAction; import rails.util.GameFileIO; public class Game { - public static final String version = "@VERSION@"; + // the correct version number is set during initialLoad in Config class + public static String version = "unknown"; + + public static String develop = "@DEVELOP@"; /** The component Manager */ protected GameManager gameManager; diff --git a/test/SVGApplication.java b/test/SVGApplication.java deleted file mode 100644 index 8b583ec..0000000 --- a/test/SVGApplication.java +++ /dev/null @@ -1,105 +0,0 @@ -package test; - -import java.awt.*; -import java.awt.event.*; -import java.io.*; -import javax.swing.*; - -import org.apache.batik.swing.JSVGCanvas; -import org.apache.batik.swing.gvt.GVTTreeRendererAdapter; -import org.apache.batik.swing.gvt.GVTTreeRendererEvent; -import org.apache.batik.swing.svg.SVGDocumentLoaderAdapter; -import org.apache.batik.swing.svg.SVGDocumentLoaderEvent; -import org.apache.batik.swing.svg.GVTTreeBuilderAdapter; -import org.apache.batik.swing.svg.GVTTreeBuilderEvent; - -public class SVGApplication { - - public static void main(String[] args) { - JFrame f = new JFrame("Batik"); - SVGApplication app = new SVGApplication(f); - f.getContentPane().add(app.createComponents()); - - f.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - System.exit(0); - } - }); - f.setSize(400, 400); - f.setVisible(true); - } - - JFrame frame; - JButton button = new JButton("Load..."); - JLabel label = new JLabel(); - JSVGCanvas svgCanvas = new JSVGCanvas(); - - public SVGApplication(JFrame f) { - frame = f; - } - - public JComponent createComponents() { - final JPanel panel = new JPanel(new BorderLayout()); - - JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT)); - p.add(button); - p.add(label); - - panel.add("North", p); - panel.add("Center", svgCanvas); - - // Set the button action. - button.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent ae) { - JFileChooser fc = new JFileChooser("."); - int choice = fc.showOpenDialog(panel); - if (choice == JFileChooser.APPROVE_OPTION) { - File f = fc.getSelectedFile(); - try { - svgCanvas.setURI(f.toURL().toString()); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - }); - - // Set the JSVGCanvas listeners. - svgCanvas.addSVGDocumentLoaderListener(new SVGDocumentLoaderAdapter() { - - public void documentLoadingStarted(SVGDocumentLoaderEvent e) { - label.setText("Document Loading..."); - } - - public void documentLoadingCompleted(SVGDocumentLoaderEvent e) { - label.setText("Document Loaded."); - } - }); - - svgCanvas.addGVTTreeBuilderListener(new GVTTreeBuilderAdapter() { - - public void gvtBuildStarted(GVTTreeBuilderEvent e) { - label.setText("Build Started..."); - } - - public void gvtBuildCompleted(GVTTreeBuilderEvent e) { - label.setText("Build Done."); - frame.pack(); - } - }); - - svgCanvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() { - - public void gvtRenderingPrepare(GVTTreeRendererEvent e) { - label.setText("Rendering Started..."); - } - - public void gvtRenderingCompleted(GVTTreeRendererEvent e) { - label.setText(""); - } - }); - - return panel; - } -} diff --git a/test/SVGOffscreenLoader.java b/test/SVGOffscreenLoader.java deleted file mode 100644 index 5426d5f..0000000 --- a/test/SVGOffscreenLoader.java +++ /dev/null @@ -1,192 +0,0 @@ -package test; - -import java.awt.Rectangle; -import java.awt.geom.AffineTransform; -import java.io.*; -import java.util.List; - -import org.apache.batik.bridge.*; -import org.apache.batik.dom.svg.SAXSVGDocumentFactory; -import org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam; -import org.apache.batik.ext.awt.image.codec.png.PNGImageEncoder; -import org.apache.batik.gvt.*; -import org.apache.batik.gvt.renderer.*; -import org.apache.batik.util.RunnableQueue; -import org.apache.batik.util.XMLResourceDescriptor; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class SVGOffscreenLoader { - - static final String SVGNS = "http://www.w3.org/2000/svg"; - - Document document; - UserAgentAdapter userAgent; - GVTBuilder builder; - BridgeContext ctx; - ImageRenderer renderer; - AffineTransform curTxf; - UpdateManager manager; - GraphicsNode gvtRoot; - int DISPLAY_WIDTH = 1280; - int DISPLAY_HEIGHT = 1024; - - public SVGOffscreenLoader(Document doc) { - userAgent = new UserAgentAdapter(); - ctx = new BridgeContext(userAgent); - builder = new GVTBuilder(); - document = doc; - } - - public void init() { - GraphicsNode gvtRoot = null; - - try { - ctx.setDynamicState(BridgeContext.DYNAMIC); - gvtRoot = builder.build(ctx, document); - } catch (BridgeException e) { - e.printStackTrace(); - System.exit(1); - } - - ImageRendererFactory rendererFactory; - rendererFactory = new ConcreteImageRendererFactory(); - renderer = rendererFactory.createDynamicImageRenderer(); - renderer.setDoubleBuffered(false); - - float docWidth = (float) ctx.getDocumentSize().getWidth(); - float docHeight = (float) ctx.getDocumentSize().getHeight(); - - float xscale = DISPLAY_WIDTH / docWidth; - float yscale = DISPLAY_HEIGHT / docHeight; - float scale = Math.min(xscale, yscale); - - AffineTransform px = AffineTransform.getScaleInstance(scale, scale); - - double tx = -0 + (DISPLAY_WIDTH / scale - docWidth) / 2; - double ty = -0 + (DISPLAY_WIDTH / scale - docHeight) / 2; - px.translate(tx, ty); - CanvasGraphicsNode cgn = getGraphicsNode(gvtRoot); - if (cgn != null) { - cgn.setViewingTransform(px); - curTxf = new AffineTransform(); - } else { - curTxf = px; - } - manager = new UpdateManager(ctx, gvtRoot, document); - // 'setMinRepaintTime' was added to SVN. This isn't - // essential but prevents 'frame skipping' (useful - // for "recording" content, not needed for live display). - // manager.setMinRepaintTime(-1); - - try { - manager.dispatchSVGLoadEvent(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - - renderer.updateOffScreen(DISPLAY_WIDTH, DISPLAY_HEIGHT); - renderer.setTree(gvtRoot); - renderer.setTransform(curTxf); - renderer.clearOffScreen(); - renderer.repaint(new Rectangle(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT)); - manager.addUpdateManagerListener(new UpdateManagerAdapter() { - - @Override - public void updateCompleted(UpdateManagerEvent e) { - render(e.getImage()); - } - - @Override - public void managerSuspended(UpdateManagerEvent e) { - // Make sure pending updates are completed. - System.exit(0); - } - }); - manager.manageUpdates(renderer); - this.gvtRoot = gvtRoot; - } - - private CanvasGraphicsNode getGraphicsNode(GraphicsNode gn) { - if (!(gn instanceof CompositeGraphicsNode)) return null; - CompositeGraphicsNode cgn = (CompositeGraphicsNode) gn; - List<?> children = cgn.getChildren(); - if (children.size() == 0) return null; - gn = (GraphicsNode) children.get(0); - if (!(gn instanceof CanvasGraphicsNode)) return null; - return (CanvasGraphicsNode) gn; - - } - - int imgCount = 1; - - public void render(java.awt.image.BufferedImage img) { - // paint the image or stream the image to the client display - try { - String file = "frame." + (imgCount++) + ".png"; - System.err.println("Output: " + file); - OutputStream os = new FileOutputStream(file); - - PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); - PNGImageEncoder pngEncoder = new PNGImageEncoder(os, params); - pngEncoder.encode(img); - os.flush(); - } catch (IOException ioe) { - ioe.printStackTrace(); - } - } - - /** - * @param args - */ - public static void main(String[] args) { - /* - * if (args.length < 1) { System.out.println("You must provide - * background SVG file"); System.exit(1); } - */ - String docStr = "tiles/svg/tile-901.svg"; - - String xmlParser = XMLResourceDescriptor.getXMLParserClassName(); - SAXSVGDocumentFactory df; - df = new SAXSVGDocumentFactory(xmlParser); - Document doc = null; - SVGOffscreenLoader render = null; - Element r = null; - try { - File f = new File(docStr); - doc = df.createSVGDocument(f.toURL().toString()); - r = doc.createElementNS(SVGNS, "rect"); - r.setAttributeNS(null, "x", "100"); - r.setAttributeNS(null, "y", "200"); - r.setAttributeNS(null, "width", "200"); - r.setAttributeNS(null, "height", "150"); - r.setAttributeNS(null, "fill", "crimson"); - r.setAttributeNS(null, "stroke", "gold"); - r.setAttributeNS(null, "stroke-width", "3"); - doc.getDocumentElement().appendChild(r); - render = new SVGOffscreenLoader(doc); - render.init(); - } catch (IOException ioe) { - ioe.printStackTrace(); - System.exit(0); - } - - final Element rect = r; - - RunnableQueue rq = render.manager.getUpdateRunnableQueue(); - for (int i = 1; i < 10; i++) { - final int x = 100 + (i * 10); - try { - rq.invokeAndWait(new Runnable() { - - public void run() { - rect.setAttributeNS(null, "x", "" + x); - } - }); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - render.manager.suspend(); - } -} diff --git a/tools/lib/jarbundler-2.1.0.jar b/tools/lib/jarbundler-2.1.0.jar deleted file mode 100644 index 5127987..0000000 Binary files a/tools/lib/jarbundler-2.1.0.jar and /dev/null differ diff --git a/version.number b/version.number index 72b919f..b52774a 100644 --- a/version.number +++ b/version.number @@ -1,2 +1,5 @@ -#Property file that contains only the version number -version=1.5.3+ \ No newline at end of file +#Property file that contains version number and the develop indicator +version=1.5.3 +# the following string "@DEVELOP@ is replaced by an empty string in the release version +# this is done automatically by ant +develop=@DEVELOP@ \ No newline at end of file commit f46a2a4f1f31b3eeae95cb4379c69b359a0e16a6 Author: Stefan Frey <ste...@we...> Date: Mon Nov 28 13:37:11 2011 +0100 Updated ant build files to increase automation diff --git a/build.xml b/build.xml index 3900603..107fde2 100644 --- a/build.xml +++ b/build.xml @@ -1,180 +1,112 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- WARNING: Eclipse auto-generated file. - Any modifications will be overwritten. - To include a user specific buildfile here, simply create one in the same - directory with the processing instruction <?eclipse.ant.import?> - as the first entry and export the buildfile again. --> -<project basedir="." default="build" name="18xx"> - <property environment="env"/> - <property name="debuglevel" value="source,lines,vars"/> - <property name="target" value="1.5"/> - <property name="source" value="1.5"/> - <property name="version" value="1.5.3"/> - <taskdef name="jarbundler" - classpath="tools/lib/jarbundler-2.1.0.jar" - classname="net.sourceforge.jarbundler.JarBundler" /> - <path id="18xx.classpath"> - <pathelement location="classes"/> - <pathelement location="lib/log4j-1.2/log4j-1.2.14.jar"/> - <pathelement location="lib/batik-1.7/batik.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-dom.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-util.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> - <pathelement location="lib/batik-1.7/lib/batik-ext.jar"/> - <pathelement location="lib/jgraph5/jgraph.jar"/> - <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> - <pathelement location="lib/junit-4.8.2/junit.jar"/> - </path> - <target depends="clean" name="init"> - <mkdir dir="classes"/> - <copy includeemptydirs="false" todir="classes"> - <fileset dir="."> - <exclude name="**/*.launch"/> - <exclude name="**/*.java"/> - <exclude name="tools/**"/> - <exclude name="images/**"/> - </fileset> - </copy> - </target> - <target name="clean"> - <delete dir="classes"/> - <delete dir="jar"/> - </target> - <target depends="clean" name="cleanall"> - <delete dir="rails-${version}"/> - <delete dir="rails-mac-${version}"/> - <delete file="18xx.log"/> - </target> - <target depends="build-subprojects,build-project,build-release" name="build"/> - <target name="build-subprojects"/> - <target depends="init" name="build-project"> - <echo message="${ant.project.name}: ${ant.file}"/> - <javac debug="true" debuglevel="${debuglevel}" destdir="classes" source="${source}" target="${target}"> - <src path="."/> - <classpath refid="18xx.classpath"/> - </javac> - </target> - <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> - <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler"> - <copy todir="${ant.library.dir}"> - <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> - </copy> - <unzip dest="${ant.library.dir}"> - <patternset includes="jdtCompilerAdapter.jar"/> - <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> - </unzip> - </target> - <target description="compile project with Eclipse compiler" name="build-eclipse-compiler"> - <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> - <antcall target="build"/> - </target> - <target name="build-release"> - <mkdir dir="jar"/> - <copy includeemptydirs="false" todir="jar"> - <fileset dir="classes"> - <exclude name="**/*.launch"/> - <exclude name="**/*.java"/> - <exclude name="rails/test/*"/> - <exclude name="test/**"/> - <exclude name="tiles/*.*"/> - <exclude name="18xx.log"/> - <exclude name="build.xml"/> - <exclude name="buildinfo.xml"/> - <exclude name="user.profiles"/> - <exclude name="manifest"/> - <exclude name="doc/*"/> - <exclude name="html/*"/> - <exclude name="lib/**"/> - <exclude name="rails-${version}/**"/> - <exclude name="rails-*-${version}/**"/> - <exclude name="rails.bat"/> - <exclude name="rails.sh"/> - <exclude name=".project"/> - <exclude name=".classpath"/> - <exclude name=".git/**"/> - <exclude name=".gitignore"/> - <exclude name="Rails-format.xml"/> - <exclude name="**/CVS/*"/> - <exclude name="**/.settings/*"/> - <exclude name="**/rails-${version}.jar"/> - </fileset> - </copy> - <mkdir dir="rails-${version}"/> - <copy includeemptydirs="false" todir="rails-${version}"> - <fileset dir="."> - <include name="LICENSE"/> - <include name="README"/> - <include name="AUTHORS"/> - <include name="rails.bat"/> - <include name="rails.sh"/> - <include name="my.properties"/> - <include name="LocalisedText.properties"/> - <include name="games.properties"/> - <include name="lib/**"/> - </fileset> - </copy> - <jar destfile="rails-${version}/rails-${version}.jar" basedir="jar" duplicate="preserve"> - <manifest> - <attribute name="Main-Class" value="rails.util.RunGame" /> - <attribute name="Class-Path" value="./my.properties - ./LocalisedText.properties - ./lib/log4j-1.2/log4j-1.2.14.jar - ./lib/batik-1.7/batik.jar - ./lib/batik-1.7/lib/batik-util.jar - ./lib/batik-1.7/lib/batik-dom.jar - ./lib/batik-1.7/lib/batik-bridge.jar - ./lib/batik-1.7/lib/batik-ext.jar - ./lib/batik-1.7/lib/batik-gvt.jar - ./lib/jgraph5/jgraph.jar - ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> - </manifest> - </jar> - </target> - <target name="build-mac"> - <mkdir dir="rails-mac-${version}" /> - <copy includeemptydirs="false" todir="rails-mac-${version}"> - <fileset dir="."> - <include name="LICENSE"/> - <include name="README"/> - <include name="AUTHORS"/> - <include name="my.properties"/> - </fileset> - </copy> - <jarbundler dir="rails-mac-${version}" - name="Rails" - mainclass="rails.util.RunGame" - icon="images/icon/rails.icns" - version="${version}"> - <jarfileset dir="rails-${version}"> - <include name="rails-${version}.jar"/> - <include name="lib/**"/> - </jarfileset> - <javaproperty name="apple.laf.useScreenMenuBar" value="true"/> - </jarbundler> - </target> - <target name="RunGame"> - <java classname="rails.util.RunGame" failonerror="true" fork="yes"> - <classpath refid="18xx.classpath"/> - </java> - </target> - <target name="TestGames"> - <property name="test.xml.dir" value="test/xml"/> - <property name="test.report.dir" value="test/report"/> - <mkdir dir="${test.xml.dir}"/> - <mkdir dir="${test.report.dir}"/> - <junit> - <classpath refid="18xx.classpath"/> - <formatter type="brief" usefile="false" /> - <formatter type="xml" /> - <test name ="test.TestGameBuilder" todir="${test.xml.dir}"/> - </junit> - <junitreport todir="${test.xml.dir}"> - <fileset dir="${test.xml.dir}"> - <include name="TEST-*.xml"/> - </fileset> - <report format="noframes" todir="${test.report.dir}"/> - </junitreport> - </target> - + Any modifications will be overwritten. + To include a user specific buildfile here, simply create one in the same + directory with the processing instruction <?eclipse.ant.import?> + as the first entry and export the buildfile again. --> +<project basedir="." default="build" name="Rails"> + <property environment="env"/> + <property name="junit.output.dir" value="junit"/> + <property name="debuglevel" value="source,lines,vars"/> + <property name="target" value="1.5"/> + <property name="source" value="1.5"/> + <import file="buildRails.xml"/> + <path id="Rails.classpath"> + <pathelement location="classes"/> + <pathelement location="lib/log4j-1.2/log4j-1.2.14.jar"/> + <pathelement location="lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar"/> + <pathelement location="lib/jgraph5/jgraph.jar"/> + <pathelement location="lib/batik-1.7/batik.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-bridge.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-dom.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-ext.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-gvt.jar"/> + <pathelement location="lib/batik-1.7/lib/batik-util.jar"/> + <pathelement location="lib/junit-4.8.2/junit.jar"/> + </path> + <target name="init"> + <mkdir dir="classes"/> + <copy includeemptydirs="false" todir="classes"> + <fileset dir="."> + <exclude name="**/*.launch"/> + <exclude name="**/*.java"/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/junit-4.8.2"/> + <exclude name="lib/log4j-1.2/"/> + <exclude name="lib/log4j-1.2/"/> + </fileset> + </copy> + </target> + <target name="clean"> + <delete dir="classes"/> + </target> + <target depends="clean" name="cleanall"/> + <target depends="build-subprojects,build-project" name="build"/> + <target name="build-subprojects"/> + <target depends="init" name="build-project"> + <echo message="${ant.project.name}: ${ant.file}"/> + <javac debug="true" debuglevel="${debuglevel}" destdir="classes" includeantruntime="false" source="${source}" target="${target}"> + <src path="."/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/batik-1.7/lib/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgraph5/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/jgrapht-0.7.3/"/> + <exclude name="lib/junit-4.8.2"/> + <exclude name="lib/log4j-1.2/"/> + <exclude name="lib/log4j-1.2/"/> + <classpath refid="Rails.classpath"/> + </javac> + </target> + <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> + <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler"> + <copy todir="${ant.library.dir}"> + <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> + </copy> + <unzip dest="${ant.library.dir}"> + <patternset includes="jdtCompilerAdapter.jar"/> + <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> + </unzip> + </target> + <target description="compile project with Eclipse compiler" name="build-eclipse-compiler"> + <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> + <antcall target="build"/> + </target> + <target name="TestGameBuilder (1)"> + <java classname="test.TestGameBuilder" failonerror="true" fork="yes"> + <classpath refid="Rails.classpath"/> + </java> + </target> + <target name="RunGame"> + <java classname="rails.util.RunGame" failonerror="true" fork="yes"> + <jvmarg line="-DRevenueCalculation=suggest -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"/> + <classpath refid="Rails.classpath"/> + </java> + </target> + <target name="TestGameBuilder"> + <mkdir dir="${junit.output.dir}"/> + <junit fork="yes" printsummary="withOutAndErr"> + <formatter type="xml"/> + <test name="test.TestGameBuilder" todir="${junit.output.dir}"/> + <classpath refid="Rails.classpath"/> + </junit> + </target> + <target name="junitreport"> + <junitreport todir="${junit.output.dir}"> + <fileset dir="${junit.output.dir}"> + <include name="TEST-*.xml"/> + </fileset> + <report format="frames" todir="${junit.output.dir}"/> + </junitreport> + </target> </project> diff --git a/buildRails.xml b/buildRails.xml new file mode 100644 index 0000000..142d350 --- /dev/null +++ b/buildRails.xml @@ -0,0 +1,89 @@ +<?eclipse.ant.import ?> + <!-- Extensions to the automatic ant file created by eclipse --> +<project basedir="." default="build" name="Rails"> + + <!-- Define a property for the version number --> + <property file="version.number"/> + + <!-- Define a filter to substitute version number --> + <filterset id="versionFilter"> + <filter token="VERSION" value="${version}"/> + </filterset> + + <!-- Clean the current release --> + <target name="clean-release"> + <delete> + <fileset dir="jar"/> + <fileset dir="rails-${version}"/> + </delete> + </target> + + <!-- Target that creates the release jar + this is legacy code --> + <target name="build-release" depends="clean-release,clean,build"> + <mkdir dir="jar"/> + <copy includeemptydirs="false" todir="jar"> + <filterset refid="versionFilter"/> + <fileset dir="classes"> + <exclude name="**/*.launch"/> + <exclude name="**/*.java"/> + <exclude name="rails/test/*"/> + <exclude name="test/**"/> + <exclude name="tiles/*.*"/> + <exclude name="18xx.log"/> + <exclude name="build.xml"/> + <exclude name="buildinfo.xml"/> + <exclude name="user.profiles"/> + <exclude name="manifest"/> + <exclude name="doc/*"/> + <exclude name="html/*"/> + <exclude name="lib/**"/> + <exclude name="rails-${version}/**"/> + <exclude name="rails-*-${version}/**"/> + <exclude name="rails.bat"/> + <exclude name="rails.sh"/> + <exclude name="version.number"/> + <exclude name=".project"/> + <exclude name=".classpath"/> + <exclude name=".git/**"/> + <exclude name=".gitignore"/> + <exclude name="Rails-format.xml"/> + <exclude name="**/CVS/*"/> + <exclude name="**/.settings/*"/> + <exclude name="**/rails-${version}.jar"/> + </fileset> + </copy> + <mkdir dir="rails-${version}"/> + <copy includeemptydirs="false" todir="rails-${version}"> + <filterset refid="versionFilter"/> + <fileset dir="."> + <include name="LICENSE"/> + <include name="README"/> + <include name="AUTHORS"/> + <include name="rails.bat"/> + <include name="rails.sh"/> + <include name="my.properties"/> + <include name="LocalisedText.properties"/> + <include name="games.properties"/> + <include name="lib/**"/> + </fileset> + </copy> + <jar destfile="rails-${version}/rails-${version}.jar" basedir="jar" duplicate="preserve"> + <manifest> + <attribute name="Main-Class" value="rails.util.RunGame" /> + <attribute name="Class-Path" value="./my.properties + ./LocalisedText.properties + ./lib/log4j-1.2/log4j-1.2.14.jar + ./lib/batik-1.7/batik.jar + ./lib/batik-1.7/lib/batik-util.jar + ./lib/batik-1.7/lib/batik-dom.jar + ./lib/batik-1.7/lib/batik-bridge.jar + ./lib/batik-1.7/lib/batik-ext.jar + ./lib/batik-1.7/lib/batik-gvt.jar + ./lib/jgraph5/jgraph.jar + ./lib/jgrapht-0.7.3/jgrapht-jdk1.5.jar" /> + </manifest> + </jar> + </target> + +</project> \ No newline at end of file diff --git a/buildinfo.xml b/buildinfo.xml deleted file mode 100644 index 6c1fb15..0000000 --- a/buildinfo.xml +++ /dev/null @@ -1,16 +0,0 @@ -<!-- Generate a java class with the current svn revision number --> -<project name="buildinfo " default="makeBuildInfo" basedir="."> - <target name="makeBuildInfo" description="Create a BuildInfo source"> - <tstamp> - <format property="TODAY" pattern="yyyy-MM-dd"/> - </tstamp> - <!-- the source code of the java class --> - <echo file="${basedir}/rails/util/BuildInfo.java"> -package rails.util; - -public class BuildInfo { - public static final String buildDate = "${TODAY}"; -} -</echo> - </target> -</project> \ No newline at end of file diff --git a/rails.bat b/rails.bat index 5fb363c..fafb975 100644 --- a/rails.bat +++ b/rails.bat @@ -1,2 +1,2 @@ -java -jar rails-1.5.jar %1 \ No newline at end of file +java -jar rails-@VERSION@.jar %1 \ No newline at end of file diff --git a/rails.sh b/rails.sh index 201aab0..12e626d 100644 --- a/rails.sh +++ b/rails.sh @@ -1,3 +1,3 @@ #!/bin/bash -java -jar ./rails-1.5.jar $1 \ No newline at end of file +java -jar ./rails-@VERSION@.jar $1 \ No newline at end of file diff --git a/rails/game/Game.java b/rails/game/Game.java index c9d1054..250e6b4 100644 --- a/rails/game/Game.java +++ b/rails/game/Game.java @@ -14,7 +14,7 @@ import rails.game.action.PossibleAction; import rails.util.GameFileIO; public class Game { - public static final String version = "1.5.3+"; + public static final String version = "@VERSION@"; /** The component Manager */ protected GameManager gameManager; diff --git a/version.number b/version.number new file mode 100644 index 0000000..72b919f --- /dev/null +++ b/version.number @@ -0,0 +1,2 @@ +#Property file that contains only the version number +version=1.5.3+ \ No newline at end of file commit 760a9358b8a2e9e16e0b7542c5df9a1c64e188d5 Author: Stefan Frey <ste...@we...> Date: Mon Nov 28 11:42:11 2011 +0100 Fixed reference in properties file for the setLocale method as the class was moved previously diff --git a/data/Properties.xml b/data/Properties.xml index b54129b..eb95d4c 100644 --- a/data/Properties.xml +++ b/data/Properties.xml @@ -4,7 +4,7 @@ <Properties> <Section name="General"> <Property name="locale" type="LIST" values="en_US,te_ST" - initClass="rails.util.LocalText" initMethod="setLocale" + initClass="rails.common.LocalText" initMethod="setLocale" initParameter="yes" /> <Property name="default_game" type="STRING" /> <Property name="default_players" type="STRING" /> |