Is there a way to set the up-to-date flag on the exec task based on the existence of a particular file?

I’m attempting to build a very large tarball within gradle.

I cannot use the tar tree task since the source files contain symbolic links and I have to preserve them.

I’m using the Exec task.

Since the tarball is huge, the exec task takes a very long time. Is there a way to set the up-to-date flag on the exec task based on the existence of a particular file?

Thank you in advance for your help.

You can declare another input or output file for the task (e.g. ‘outputs.file “foo/bar”’), or use the generic ‘outputs.upToDateWhen { someCondtion() }’.