Class ProcessFilesTask
java.lang.Object
com.github.blutorange.maven.plugin.closurecompiler.common.ProcessFilesTask
- All Implemented Interfaces:
Callable<List<ProcessingResult>>
- Direct Known Subclasses:
ProcessJSFilesTask
Abstract class for merging and compressing a files list.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClosureConfigprotected final booleanprotected final MojoMetadataprotected final com.github.blutorange.maven.plugin.closurecompiler.common.FilenameInterpolatorprotected final FileProcessConfigprotected final Fileprotected final File -
Constructor Summary
ConstructorsConstructorDescriptionProcessFilesTask(MojoMetadata mojoMeta, FileProcessConfig processConfig, FileSpecifier fileSpecifier, ClosureConfig closureConfig) Task constructor. -
Method Summary
Modifier and TypeMethodDescriptioncall()Method executed by the thread.protected final ProcessingResultCopies sourceFile to targetFile, making sure to inform the build context of the change.protected final booleanhaveFilesChanged(Collection<File> sourceFiles, Collection<File> outputFiles) Checks whether any change was made to the source / output file pairs.protected final voidlogCompressionGains(List<File> srcFiles, String minified) Logs compression gains.protected final ProcessingResultMerges a list of source files.protected final voidCreates the given directory (and parents) and informs the build context.protected final voidremoveMessages(Collection<File> files)
-
Field Details
-
mojoMeta
-
closureConfig
-
files
-
includesEmpty
protected final boolean includesEmpty -
outputFilenameInterpolator
protected final com.github.blutorange.maven.plugin.closurecompiler.common.FilenameInterpolator outputFilenameInterpolator -
processConfig
-
sourceDir
-
targetDir
-
-
Constructor Details
-
Method Details
-
call
public List<ProcessingResult> call() throws IOException, org.apache.maven.plugin.MojoFailureExceptionMethod executed by the thread.- Specified by:
callin interfaceCallable<List<ProcessingResult>>- Throws:
IOException- When an input file could not be read or an output file could not be written.org.apache.maven.plugin.MojoFailureException- When the merge or minify steps fail
-
removeMessages
-
logCompressionGains
Logs compression gains.- Parameters:
srcFiles- list of input files to compressminified- output file resulting from the minify step
-
mkDir
Creates the given directory (and parents) and informs the build context.- Parameters:
directory- Path of the directory to create.
-
copy
Copies sourceFile to targetFile, making sure to inform the build context of the change.- Parameters:
sourceFile- The source file to copy.targetFile- The target file to which to copy the source file.- Returns:
trueif execution was performed,falseif it was skipped (because files did not change).- Throws:
IOException- When an input file could not be read or an output file could not be written.
-
merge
Merges a list of source files. Create missing parent directories if needed.- Parameters:
sourceFiles- list of input files to mergemergedFile- output file resulting from the merged step- Throws:
IOException- when the merge step fails
-
haveFilesChanged
protected final boolean haveFilesChanged(Collection<File> sourceFiles, Collection<File> outputFiles) Checks whether any change was made to the source / output file pairs. If not, then we can skip the execution of the current bundle.- Parameters:
sourceFiles- Source files to check.outputFiles- Output files corresponding to the source files, in that order. Must have the same size as the source files list.- Returns:
- Whether any change was made to the source / output file pairs
-