Up-to-date checks doing too much work?

I’m using Gradle M6 (I’ve also tried this with M8 with the same result).

I have a series of copy tasks that all share the same destination tree. Some of the tasks put their files in the root of the tree; others put the files further down. Originally, all these tasks shared the same destinationDirectory and used from() { into } to control where the files went.

As I was trying to diagnose some speed issues, I noticed that, if I cleared the destination directory first, the smaller copy tasks would complete almost instantly; but that if the entire destination tree were present, then the copy tasks could take 15 or 20 seconds to complete.

I’ve gone back through those tasks and changed the destinationDirectory to be as deep into the tree as possible; this has sped them up greatly. Even so, there are a couple of tasks that have to copy their files into the tree root, and these still take 15 or 20 seconds to run.

It looks like the up-to-date checker is examining the entire destination directory recursively, not just looking at the files that would be created by the copy task. Is this a bug/known issue/expected behavior?

Is there something I can do to speed up the copy tasks that copy into the tree root?

Is there any particular reason why you use multiple Copy tasks? Typically I’d use one Copy task per destination tree. That said, how many/big files are we talking?

This is for a task that’s run on a very regular basis (a developer runs this on his own machine any time he wants to test his changes). The destination tree ends up with > 8500 files totaling about 300 megs. Thanks to something (Windows? antivirus? I don’t know), this task took upwards of 5 minutes for many people.

In an attempt to speed things up, I’ve broken the monolithic task into a bunch of smaller tasks - my theory was that most of the files wouldn’t be changing, so it would be a waste to copy all of them every time (since Gradle’s tasks aren’t incremental yet). It’s helped a good bit, but things are still slower than I’d like.

Looking over the profiles the devs sent me, I found that every up-to-date copy task was taking about 15 seconds. Fixing the destinationDir dropped the tasks down to 1-2 seconds each (which still seems awfully long, but it’s a lot better).