Don't generate image files if there aren't any.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2010-03-28 15:04:42 -07:00
parent f51ed977a2
commit ee36e8ba5c
@@ -350,6 +350,11 @@ BundleTask.prototype.packageType = function()
return 1;
}
function isDataResource(aFilename)
{
return FILE.isFile(aFilename) && isImage(aFilename);
}
BundleTask.prototype.infoPlist = function()
{
var infoPlistPath = this.infoPlistPath();
@@ -370,14 +375,17 @@ BundleTask.prototype.infoPlist = function()
return anEnvironment.name();
}));
infoPlist.setValueForKey("CPBundleExecutable", this.productName() + ".sj");
infoPlist.setValueForKey("CPBundleEnvironmentsWithImageSprites", this.environments().filter(
var environmentsWithImageSprites = this.environments().filter(
function(anEnvironment)
{
return anEnvironment.spritesImages();
}).map(function(anEnvironment)
return anEnvironment.spritesImages() && task(this.buildProductDataURLPathForEnvironment(anEnvironment)).prerequisites().filter(isDataResource).length > 0;
}, this).map(function(anEnvironment)
{
return anEnvironment.name();
}));
});
infoPlist.setValueForKey("CPBundleEnvironmentsWithImageSprites", environmentsWithImageSprites);
var principalClass = this.principalClass();
@@ -581,7 +589,6 @@ BundleTask.prototype.defineResourceTasks = function()
}, this);
}
var RESOURCES_PATH = FILE.join(FILE.absolute(FILE.dirname(module.path)), "RESOURCES"),
MHTMLTestPath = FILE.join(RESOURCES_PATH, "MHTMLTest.txt");
@@ -595,11 +602,6 @@ BundleTask.prototype.defineSpritedImagesTask = function()
var folder = anEnvironment.name() + ".environment",
resourcesPath = FILE.join(this.buildIntermediatesProductPath(), folder, "Resources", "");
function isDataResource(aFilename)
{
return FILE.isFile(aFilename) && aFilename.indexOf(resourcesPath) === 0 && isImage(aFilename);
}
var productName = this.productName(),
dataURLPath = this.buildProductDataURLPathForEnvironment(anEnvironment);