Is it possible to sync/copy just changed files

So I have a task that needs to copy compiled class files and the jar dependencies into another directory after compilation completes. I have set it up with valid input/output properties so we can track whether it is up to date and I get valid logs about what has changed:

Task ':deployLocal' is not up-to-date because:
  Input property '$2' file /Users/dhensche/Projects/maui-gradle/build/classes/groovy/main/uiowa/maui/biz/degreeaudit/transferextract/ESTransferExtractDAO$PseudoCourses.class has changed.
Syncing built classes into webapp/WEB-INF/classes for local deployment
Syncing libraries into webapp/WEB-INF/lib for local deployment

is there a way I can have my sync and/or copy task only update the files indicated by the changes detected on the input properties? Just for speeding it up, so in this case it would only worry about updating that one changed class file. Thanks!

I don’t think it is possible with the built-in copy and sync tasks.
I guess for most use-cases this would not be worth the effort or maybe even slow down things.

Besides posting a feature request for supporting this,
you could probably write a custom task with incremental inputs that can then skip unchanged inputfiles if in your case it is really huuuuge or maaaany things that are copied around.

This legacy project is a bit of an albatross so it’s like 14k class files :grimacing:, but performance is fairly serviceable as is. I’ve got a couple other ideas up my sleeve, but thanks for the info

1 Like