Symlink as an output - without evaluating the target folder

plugins

(Jonathan Gafner) #1

We are sharing some local packages between dev environments, and we would like a task that create symlink to those local packages.
We would like the task to be out of date only if the Link does not exists and not in case the content of the folder changes. is there any way to set the output files (links) with no nofollow rule or something similar ?

thanks
Joanthan


(James Justinic) #2

Since you don’t want the normal up-to-date checking behavior, you can just implement your own. Something like this should work as you want:

outputs.upToDateWhen {
    def symlink = file('/path/to/symlink')
    java.nio.file.Files.isSymbolicLink(symlink.toPath())                   
}