How to get an incremental task to work

Browsing the doc. I found in Developing Custom Gradle Task Types what I need:
“a transformer task that converts input files to output files on a 1:1 basis”.
In my case, the input files are .jar files defined in a configurations.someJars setup in dependencies, and results should end in some resultDir.

First I tried to do this with a Copy task (with a doLast for transforming) but the copies always got “removed” when task was re-run because of (thanks to --info) “Cleaned previous output of task ‘:subproject:copyWsJars’ as it has no source files.” and I did not find a way to “tell the source files to the task”

So I tried it with a custom task with a “ConfigurableFileCollection inputFiles” but I did not find a way to initialize inputFiles from my configurations.someJars (gradle errors because of bad types)

Of course, any hint/help is welcome…

I got it to work with the “ ConfigurableFileCollection inputFiles ”,
was able to initiaize inputFile with = files(configurations.someJars.resolve())

Sadly, the task is not incremental, inputChanges.incremental is always false

Hi Jess,

I suppose this is what you are missing:

In addition, the task needs to declare at least one incremental file input property by using either @Incremental or @SkipWhenEmpty.

Please check out the documentation and the samples in the user manual: Developing Custom Gradle Task Types