Rather than forcing a rebuild of our tileset and component bundles every time when we're deploying to a directory bundle, decide based on the oldest modification time stamp of any file within the directory. Otherwise, these builds get crazy long.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@347 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2007-11-13 18:29:49 +00:00
parent a0b5874d5f
commit f57e973987
5 changed files with 74 additions and 20 deletions
@@ -302,16 +302,17 @@ public class ComponentBundlerTask extends Task
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File fromDir = fs.getDir(getProject());
String[] srcFiles = ds.getIncludedFiles();
long tgtModificationDate = getTgtModificationDate(target);
for (int f = 0; f < srcFiles.length; f++) {
File cfile = new File(fromDir, srcFiles[f]);
if (newer(cfile, target)) {
if (newer(cfile, tgtModificationDate)) {
return true;
}
}
return false;
} else if (source instanceof File) {
return newer((File)source, target);
return newer((File)source, getTgtModificationDate(target));
} else {
System.err.println("Can't compare " + source +
@@ -324,9 +325,17 @@ public class ComponentBundlerTask extends Task
* Returns true if <code>source</code> is newer than
* <code>target</code>.
*/
protected boolean newer (File source, File target)
protected boolean newer (File source, long tgtModificationDate)
{
return source.lastModified() > target.lastModified();
return source.lastModified() > tgtModificationDate;
}
/**
* Returns the last modified date of <code>target</code> to be compared for out-of-dateness.
*/
protected long getTgtModificationDate (File target)
{
return target.lastModified();
}
/**
@@ -27,8 +27,9 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import com.threerings.media.tile.TileSet;
import com.threerings.util.FileUtil;
import com.threerings.media.tile.TileSet;
import com.threerings.media.tile.TrimmedTileSet;
/**
@@ -62,9 +63,9 @@ public class DirectoryComponentBundlerTask extends ComponentBundlerTask
}
@Override // documentation inherited
protected boolean outOfDate (Object source, File target)
protected long getTgtModificationDate (File target)
{
// Since we're updating individual files, assume always out of date and rebuild.
return true;
// Return the oldest modification date of anything within the directory.
return FileUtil.getOldestLastModified(target);
}
}