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
Modifier and TypeFieldDescriptionprotected final ClosureConfig
protected final boolean
protected final MojoMetadata
protected final com.github.blutorange.maven.plugin.closurecompiler.common.FilenameInterpolator
protected final FileProcessConfig
protected final File
protected final File
-
Constructor Summary
ConstructorDescriptionProcessFilesTask
(MojoMetadata mojoMeta, FileProcessConfig processConfig, FileSpecifier fileSpecifier, ClosureConfig closureConfig) Task constructor. -
Method Summary
Modifier and TypeMethodDescriptioncall()
Method executed by the thread.protected final ProcessingResult
Copies sourceFile to targetFile, making sure to inform the build context of the change.protected final boolean
haveFilesChanged
(Collection<File> sourceFiles, Collection<File> outputFiles) Checks whether any change was made to the source / output file pairs.protected final void
logCompressionGains
(List<File> srcFiles, String minified) Logs compression gains.protected final ProcessingResult
Merges a list of source files.protected final void
Creates the given directory (and parents) and informs the build context.protected final void
removeMessages
(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:
call
in 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:
true
if execution was performed,false
if 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:
mergedFile
- 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
-