Gradle build task, how to exclude selected input dirs?


(coder82) #1

I am running a continuous build like this:

gradle build -t

It works great except when It hasn’t to eheh.
Essentially I want to exclude certain directory from being whatched for changes…
It goes and watches even stuff way back in the chain of dependencies, so if I touch some files on the other side of my hard drive, yet it triggers. These files are in a dependent project src dir.
Is there a way to exclude some input dirs?

I tried to print the inputs inside the build task but it’s empty!!

Why does this print false?

build {
   println(inputs.hasInputs)
}

Update:
Meantime I found a workaround, which might actually is the way it is, don’t know.
Essentially the inputs go and check in the whole dependency chain if something changed.
Turns out the js files I was changing were declared as inputs in one of the tasks in the chain of dependencies way back.

tasks.withType(WebPackBundleTask) {
inputs.dir “$srcDir/js”
outputs.dir jsBundleDir
}

so insted of running:

gradle build -t

I run

gradle build -t -x “:frontend:webpack-bundle”

so that it excludes the continuous build of of that part, which I continuously build separately.

Thanks.