Adding files to continous build watch-list


(Taavi Ilves) #1

I have a task which launches external command-line script for generating files (custom asciidoc, pandoc, latex2pdf solution). I discovered that there is incubating feature continuous build (https://docs.gradle.org/current/userguide/continuous_build.html), which seams like a tool for running this script if my input files change (editing & saving).

Looking through documentation, I understood that if I added those files into main or test resources, it should work out of the box. The problem is that I’m not using any plugins, only self-defined tasks.


(Stefan Oehme) #2

The Java plugin is only an example. Continuous build works based on task inputs and will work with custom tasks too.


(Taavi Ilves) #3

Thank you for your answer.

I added inputs.files to my task something like this:

task example {
    inputs.files fileTree(...)
}

This was enough to trigger a continuous build after modifying my input files.


(Stefan Oehme) #4

There’s a problem in that script: The << means “do this at execution time”. But you want to configure inputs at configuration time, so leave out the <<.

I guess you just wrote it accidentally in your post, because your build would not work properly if it contained that.

We will probably remove << at some point as it’s confusing. It’s shorthand for ´doLast {}´


(Taavi Ilves) #5

Thanks again for correction. You are correct, I didn’t test it. I didn’t want show my real build & wanted to add some example for others.

I’ll edit it out of my previous post.