Why are replace tokens and expand properties not part of the inputs of the Copy task?

In my own experience with gradle, in the experience of my colleagues, and in my experience answering questions on StackOverflow (like this one), people love Gradle until they use the Copy task and start tearing their hairs because the Copy task considers everything up-to-date although the ‘expand’ or ‘ReplaceTokens’ tokens have changed completely since the last build.

Typical example: you build with ‘-Penv=dev’, then build with ‘-Penv=prod’, and the development environment tokens are used in production.

And that’s really a pity, because faith in Gradle’s incremental build features then starts vanishing, and people start cleaning every time they build to avoid bad surprises.

So my question is: why aren’t these tokens part of the inputs of the copy task? They clearly have an impact on the task’s outputs, so they should be part of them.

If it’s such a problem to add them, couldn’t there be a big blinking warning in the documentation about this, explaining why this is not the case, and how to circumvent the problem?

You can always add them as inputs manually.

inputs.property ‘replacementProps’, propertiesMap

I tend to agree that properties being passed to either ‘expand’ or ‘filter’ should probably be added as a task input. I’m not aware of a particular reason why not.

There’s no fundamental reason why they aren’t considered inputs, beyond problems with non serializable values (but we have this problem elsewhere).

It just hasn’t been patched yet. It’s GRADLE-1646.