java.lang.Object
com.github.blutorange.maven.plugin.closurecompiler.plugin.ProcessFilesTask
All Implemented Interfaces:
Callable<Object>
Direct Known Subclasses:
ProcessJSFilesTask

public abstract class ProcessFilesTask extends Object implements Callable<Object>
Abstract class for merging and compressing a files list.
  • Field Details

    • TEMP_SUFFIX

      public static final String TEMP_SUFFIX
      See Also:
    • mojoMeta

      protected final MojoMetadata mojoMeta
    • closureConfig

      protected final ClosureConfig closureConfig
    • files

      protected final List<File> files
    • includesEmpty

      protected final boolean includesEmpty
    • outputFilenameInterpolator

      protected final FilenameInterpolator outputFilenameInterpolator
    • processConfig

      protected final FileProcessConfig processConfig
    • sourceDir

      protected final File sourceDir
    • targetDir

      protected final File targetDir
  • Constructor Details

    • ProcessFilesTask

      public ProcessFilesTask(MojoMetadata mojoMeta, FileProcessConfig processConfig, FileSpecifier fileSpecifier, ClosureConfig closureConfig) throws IOException
      Task constructor.
      Parameters:
      mojoMeta - Base mojo data.
      processConfig - Configuration for this file task.
      fileSpecifier - Details about the input / output files.
      closureConfig - Google closure configuration
      Throws:
      IOException
  • Method Details

    • call

      public Object call() throws IOException, org.apache.maven.plugin.MojoFailureException
      Method executed by the thread.
      Specified by:
      call in interface Callable<Object>
      Throws:
      IOException - when the merge or minify steps fail
      org.apache.maven.plugin.MojoFailureException
    • removeMessages

      protected void removeMessages(Collection<File> files)
    • logCompressionGains

      protected void logCompressionGains(List<File> srcFiles, String minified)
      Logs compression gains.
      Parameters:
      srcFiles - list of input files to compress
      minified - output file resulting from the minify step
    • mkDir

      protected void mkDir(File directory)
      Creates the given directory (and parents) and informs the build context.
      Parameters:
      directory -
    • copy

      protected ProcessingResult copy(File sourceFile, File targetFile) throws IOException
      Copies sourceFile to targetFile, making sure to inform the build context of the change.
      Parameters:
      sourceFile -
      targetFile -
      Returns:
      true if execution was performed, false if it was skipped (because files did not change).
      Throws:
      IOException
    • merge

      protected ProcessingResult merge(File mergedFile) throws IOException
      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 boolean haveFilesChanged(Collection<File> sourceFiles, Collection<File> outputFiles)
      Parameters:
      sourceFiles -
      outputFiles -
      Returns:
      Whether any change was made to the source / output files. If not, then we can skip the execution of the current bundle.