Allow digests to be easily created externally.

This commit is contained in:
Michael Bayne
2004-08-10 07:23:12 +00:00
parent 898fcff302
commit 471c6cddf3
@@ -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. */