Search in sources :

Example 1 with DefaultTwirlCompileSpec

use of org.gradle.play.internal.twirl.DefaultTwirlCompileSpec in project gradle by gradle.

the class TwirlCompile method compile.

@TaskAction
void compile(IncrementalTaskInputs inputs) {
    RelativeFileCollector relativeFileCollector = new RelativeFileCollector();
    getSource().visit(relativeFileCollector);
    TwirlCompileSpec spec = new DefaultTwirlCompileSpec(relativeFileCollector.relativeFiles, getOutputDirectory(), getForkOptions(), getDefaultImports(), userTemplateFormats, additionalImports);
    if (!inputs.isIncremental()) {
        new CleaningPlayToolCompiler<TwirlCompileSpec>(getCompiler(), getOutputs()).execute(spec);
    } else {
        final Set<File> sourcesToCompile = new HashSet<File>();
        inputs.outOfDate(new Action<InputFileDetails>() {

            public void execute(InputFileDetails inputFileDetails) {
                sourcesToCompile.add(inputFileDetails.getFile());
            }
        });
        final Set<File> staleOutputFiles = new HashSet<File>();
        inputs.removed(new Action<InputFileDetails>() {

            public void execute(InputFileDetails inputFileDetails) {
                staleOutputFiles.add(inputFileDetails.getFile());
            }
        });
        if (cleaner == null) {
            cleaner = new TwirlStaleOutputCleaner(getOutputDirectory());
        }
        cleaner.execute(staleOutputFiles);
        getCompiler().execute(spec);
    }
}
Also used : DefaultTwirlCompileSpec(org.gradle.play.internal.twirl.DefaultTwirlCompileSpec) InputFileDetails(org.gradle.api.tasks.incremental.InputFileDetails) DefaultTwirlCompileSpec(org.gradle.play.internal.twirl.DefaultTwirlCompileSpec) TwirlCompileSpec(org.gradle.play.internal.twirl.TwirlCompileSpec) RelativeFile(org.gradle.api.internal.file.RelativeFile) File(java.io.File) HashSet(java.util.HashSet) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

File (java.io.File)1 HashSet (java.util.HashSet)1 RelativeFile (org.gradle.api.internal.file.RelativeFile)1 TaskAction (org.gradle.api.tasks.TaskAction)1 InputFileDetails (org.gradle.api.tasks.incremental.InputFileDetails)1 DefaultTwirlCompileSpec (org.gradle.play.internal.twirl.DefaultTwirlCompileSpec)1 TwirlCompileSpec (org.gradle.play.internal.twirl.TwirlCompileSpec)1