File[] sources = findSourceFiles();
if (sources != null) {
log("Compiling " + sources.length + " file(s)");
UglifyJS uglifyjs = new UglifyJS();
ArrayList<String> options = createUglifyOptions();
for (File source : sources) {
options.add(source.getAbsolutePath());
String[] args = new String[options.size()];
args = options.toArray(args);
if (this.outputFile == null) {
uglifyjs.exec(args);
} else {
String result = uglifyjs.uglify(args);
if (result != null) {
writeResult(result);
} else {
throw new BuildException("uglify failed.");
}