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
@@ -36,6 +36,7 @@ import javax.imageio.ImageIO;
import org.apache.commons.io.IOUtils;
import com.threerings.media.Log;
import com.threerings.util.FileUtil;
import com.threerings.media.tile.ImageProvider;
import com.threerings.media.tile.ObjectTileSet;
import com.threerings.media.tile.TileSet;
@@ -155,9 +156,9 @@ public class DirectoryTileSetBundler extends TileSetBundler
}
@Override // documentation inherited
protected boolean maySkipIfNewer ()
protected long getTgtModificationDate (File target)
{
// Can't skip since we're copying individual files.
return false;
// Return the oldest modification date of anything within the directory.
return FileUtil.getOldestLastModified(target);
}
}
@@ -310,7 +310,7 @@ public class TileSetBundler
}
// see if our newest file is newer than the tileset bundle
if (newest < target.lastModified() && maySkipIfNewer()) {
if (newest < getTgtModificationDate(target)) {
return false;
}
@@ -325,14 +325,6 @@ public class TileSetBundler
return createBundle(target, bundle, improv, bundleDesc.getParent());
}
/**
* Whether we're allowed to skip creation of the bundle if we're not out of date.
*/
protected boolean maySkipIfNewer ()
{
return true;
}
/**
* Finish the creation of a tileset bundle jar file.
*
@@ -462,6 +454,14 @@ public class TileSetBundler
}
}
/**
* Returns the last modified date of <code>target</code> to be compared for out-of-dateness.
*/
protected long getTgtModificationDate (File target)
{
return target.lastModified();
}
/** Replaces the image suffix with <code>.raw</code>. */
protected static String adjustImagePath (String imagePath)
{