Using war copySpec for ant.copy task

I found out that when doing exploded war construction for development purpose, doing ant.copy is a lot faster than using copy { into ‘dir’; with war }.
The problem with gradle copy is that it isnt really doing the copy incrementally (while the task itself have up-to-date checking); at least that is what I understand from here .
On the other hand, Ant’s Copy task only copy ‘newer’ file.

The question: is there an easy way to reuse war copySpec to ant.copy() ?

I think you want Sync rather than Copy

I tried both Copy and Sync.
Both are painfully slow; at least in Windows 10 needing to copy/sync thousand of small files.
Ant’s copy is a lot faster since it has timestamp checking; only newer files are being copied.
As far as I know this method of copying is not yet supported in Gradle.

You could likely implement this via eachFile { … } and FileCopyDetails.exclude()

Sounds like a good idea; I assume this way I can do the timestamp checking myself and manually copy where applicable.
Will try this out.

Sort of…

You’d be adding an extra action to a Copy task which would FileCopyDetails.exclude() any files that don’t pass your timestamp check

No manual copy

See the javadoc

Adds an action to be applied to each file as it is about to be copied into its destination. The action can change the destination path of the file, filter the contents of the file, or exclude the file from the result entirely. Actions are executed in the order added, and are inherited from the parent spec.