Are Multiple Filters on a Copy Task guaranteed Order?

issue-resolved
not-a-bug

(Ravi Vasamsetty) #1

Hello All,

I have a Copy task with Multiple filters defined like below

Task(‘myCopy’, type: Copy) {
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: myProps) // filter-1
filter{line-> line.endsWith("@") ? “” : line } //filter-2
}

Would Copy ensure that filter-1 runs first and then filter-2?

Although, right now I am getting the desired output, I do not want to depend on something that is not guaranteed to be in sequence.

Thank you in advance.


(James Justinic) #2

Yes, the underlying implementation of filter(...) on a Copy task guarantees that the filters will run in the order added.

This is a long-standing guarantee (even if not explicitly mentioned in the API documentation) and seems very unlikely to change in future versions as it would be a breaking change and backwards step for reproducible builds.


(Ravi Vasamsetty) #3

Thank you very much. This answers my question.