abstract fun sync(action: Action<in CopySpec>): WorkResult
Synchronizes the contents of a destination directory with some source directories and files. The given action is used to configure a CopySpec, which is then used to synchronize the files.
This method is like the #copy(Action)
task, except the destination directory will only contain the files copied. All files that exist in the destination directory will be deleted before copying files, unless a preserve option is specified.
Example:
project.sync { from 'my/shared/dependencyDir' into 'build/deps/compile' }
Note that you can preserve output that already exists in the destination directory: project.sync { from 'source' into 'dest' preserve { include 'extraDir/**' include 'dir1/**' exclude 'dir1/extra.txt' } }
action
- Action to configure the CopySpec.
Since
4.0
Return
WorkResult that can be used to check if the sync did any work.