How to make project/task depend on physical file?

I would like to make my project dependent on some physical files, e.g. build.gradle and settings.gradle, but also on some other custom ones (such as my configuration file generated by ./configure equivalent).

In Boost.Build I can do that simply by saying e.g. <dependency>$(PROJECT_PATH_ROOT)/Jamroot in my project’s/target’s requirements section. Is there some easy way how to do this in Gradle?

It seems that the following might be a solution:

tasks.all {
  inputs.file "path-to-the-physical-file"

I was a bit concerned that input file will be then passed e.g. to compiler, which would fail, since it is not C++ source file, but it seems to work. Is inputs really the thing I am looking for or is it working only by coincidence?