Incremental Copy Task

(Adrian Abraham) #1

I have a large set of files (8000+ files, 280 megs) that need to be copied on a regular basis (collected from a bunch of directories into a single app directory). After switching from Ant to Gradle, my developers are complaining that the copy task takes a lot longer to run than it used to (on my machine, it’s 50 seconds vs 15 seconds, and I have one of the fastest machines).

After some investigating, it seems that Ant’s copy task is smart enough to copy only what’s changed, while Gradle’s Copy is all or nothing. I believe I saw something about using enabling incremental compilation for compile tasks; is there something similar for Copy tasks?

I know I could use Ant’s copy from inside Gradle, but I’d rather not: I have a single configurator that I use to configure both a Copy task and a Tar task, but if I use ant.copy, I’ll have to maintain two sets of code that do the exact same thing.

(Peter Niederwieser) #2

Gradle doesn’t support incremental copying at this time. You can either split up the copy task into several, relying on the fact that some of them will be up-to-date. Or you can use the Ant task.

(Adrian Abraham) #3

I’ve tried using multiple copy tasks before, but the gains weren’t as large as I’d hoped: partly because one or two files in multiple trees tend to get changed, and partly because of the up-to-date issue I’ve described in another thread ( ).

I guess for now I’ll just use the Ant task :frowning:

Are there plans to add incremental copy support?

(Peter Niederwieser) #4

Are there plans to add incremental copy support?

It doesn’t have the highest priority, but it will happen. Meanwhile, using an Ant task is your best option.