Regression in registrations of file watchers for continuous mode in 2.11

There seems to be a regression in 2.11 around registering file watchers when using the continuous mode. It looks like if a task is executed that registers an input file inside of a directory and then there is a task that registers that directory as an input then any changes made to files which are located in subdirectories of that file do not trigger a rebuild.

I managed to reproduce that on 2.11 and 2.12 but it works correctly on 2.10.

To reproduce:

  • clone
  • run ./gradlew outer -t
  • change src/topLevel.txt and see the build being retriggerred
  • change src/subdirectory/nested.txt and see that the build is not retriggered

If you change the version of the wrapper to 2.10 then changing src/subdirectory/nested.txt will retrigger the build.

If you change the outer task not to depend on the inner task while using 2.11 then changing changing src/subdirectory/nested.txt will also retrigger the build.

I had a peek at WatchPointsRegistry and WatchServiceRegistrar and it looks like @lhotari might be the best person to investigate this.

Thanks for the bug report @erdi . I’ll take a look.

I created a jira issue GRADLE-3415 and I’ve pushed commits to add test coverage and to fix the problem for Gradle 2.13 .
The reason why this broke in 2.11 is that we are now watching for changes during the build and that caused a change in how the watches have be maintained.

Thanks for fixing it that quickly!

I will take the next nightly for a spin because I see that the latest nightly was built around the time you put the fix in so most probably it won’t contain it. I will report back, hopefully that it now works.

Just to confirm, I checked with the latest nightly and the changes are being picked up and rebuild is triggered so this is fixed for me. Thanks again.