Search in sources :

Example 1 with SourceTransformationException

use of org.gradle.plugins.javascript.base.SourceTransformationException in project gradle by gradle.

the class GoogleClosureCompiler method execute.

@Override
public WorkResult execute(JavaScriptCompileSpec spec) {
    JavaScriptCompileDestinationCalculator destinationCalculator = new JavaScriptCompileDestinationCalculator(spec.getDestinationDir());
    List<String> allErrors = Lists.newArrayList();
    for (RelativeFile sourceFile : spec.getSources()) {
        allErrors.addAll(compile(sourceFile, spec, destinationCalculator));
    }
    if (allErrors.isEmpty()) {
        return new SimpleWorkResult(true);
    } else {
        throw new SourceTransformationException(String.format("Minification failed with the following errors:\n\t%s", StringUtils.join(allErrors, "\n\t")), null);
    }
}
Also used : RelativeFile(org.gradle.api.internal.file.RelativeFile) SourceTransformationException(org.gradle.plugins.javascript.base.SourceTransformationException) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult)

Aggregations

RelativeFile (org.gradle.api.internal.file.RelativeFile)1 SimpleWorkResult (org.gradle.api.internal.tasks.SimpleWorkResult)1 SourceTransformationException (org.gradle.plugins.javascript.base.SourceTransformationException)1