Class AssetsCopierTask

java.lang.Object
com.mohamnag.jstatic.plugins.AbstractDirectoryCrawler
com.mohamnag.jstatic.plugins.assets_copier.AssetsCopierTask
All Implemented Interfaces:
BuildTask

public class AssetsCopierTask extends AbstractDirectoryCrawler implements BuildTask
Manages copy operations. There might be many operations configured where each operation might define one to many source directories as list under key "sources" and only and only one target directory under key "target".

An optional filter can be used to filter files that are copied under key "pattern".

The name and target path of each file which is copied successfully, will be added to a node with relative path to the source directory into a data key named "assets" as a map.

For example for a configuration of source "src/image" and target "target/assets". A file named "a.jpg" with full path "src/images/some/path/a.jpg" will be copied to "target/assets/some/path/a.jpg" and node with path "some/path" will have a data with key "assets" which is a map containing "a.jpg" ~> "target/assets/some/path/a.jpg".

It is not allowed for target directory to be under any of sources. As files will overwrite the ones on target and might overwrite ones from other sources based on order defined and matching name.

  • Field Details

  • Constructor Details

    • AssetsCopierTask

      public AssetsCopierTask(Config globalConfig)
  • Method Details

    • run

      public void run(BuildContext buildContext)
      Specified by:
      run in interface BuildTask
    • underWatchInputPaths

      public List<Path> underWatchInputPaths()
      Description copied from interface: BuildTask
      If a plugin depends on file input, it shall return list of its input paths to be watched for changes. Paths can be either files or directories. In case of directories, only root path are necessary to be listed and if input path has subdirectories, they will be automatically watched.
      Specified by:
      underWatchInputPaths in interface BuildTask
    • underWatchConfigPaths

      public List<Path> underWatchConfigPaths()
      Description copied from interface: BuildTask
      If a plugin depends on config files in addition to the general config file of the application, like functionality extensions stored in files, it shall return these paths here. A change detected in these paths will result in recreation of the plugin.
      Specified by:
      underWatchConfigPaths in interface BuildTask