From 471c6cddf301658590e4c2a76a55032383c4354a Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 10 Aug 2004 07:23:12 +0000 Subject: [PATCH] Allow digests to be easily created externally. --- .../getdown/tools/DigesterTask.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/java/com/threerings/getdown/tools/DigesterTask.java b/src/java/com/threerings/getdown/tools/DigesterTask.java index d4f0e5d..55922ea 100644 --- a/src/java/com/threerings/getdown/tools/DigesterTask.java +++ b/src/java/com/threerings/getdown/tools/DigesterTask.java @@ -1,5 +1,5 @@ // -// $Id: DigesterTask.java,v 1.3 2004/07/30 02:23:52 mdb Exp $ +// $Id: DigesterTask.java,v 1.4 2004/08/10 07:23:12 mdb Exp $ package com.threerings.getdown.tools; @@ -38,17 +38,27 @@ public class DigesterTask extends Task "directory via the 'appdir' attribute."; throw new BuildException(errmsg); } - File target = new File(_appdir, Digest.DIGEST_FILE); + + try { + createDigest(_appdir); + } catch (IOException ioe) { + throw new BuildException("Error creating digest: " + + ioe.getMessage(), ioe); + } + } + + /** + * Creates a digest file in the specified application directory. + */ + public static void createDigest (File appdir) + throws IOException + { + File target = new File(appdir, Digest.DIGEST_FILE); System.out.println("Generating digest file '" + target + "'..."); // create our application and instruct it to parse its business - Application app = new Application(_appdir); - try { - app.init(false); - } catch (IOException ioe) { - throw new BuildException("Error parsing getdown.txt: " + - ioe.getMessage(), ioe); - } + Application app = new Application(appdir); + app.init(false); ArrayList rsrcs = new ArrayList(); rsrcs.add(app.getConfigResource()); @@ -56,12 +66,7 @@ public class DigesterTask extends Task rsrcs.addAll(app.getResources()); // now generate the digest file - try { - Digest.createDigest(rsrcs, target); - } catch (IOException ioe) { - throw new BuildException("Error creating digest: " + - ioe.getMessage(), ioe); - } + Digest.createDigest(rsrcs, target); } /** The application directory in which we're creating a digest file. */