How to interpolate the properties in gradle

I am trying to achieve the following use-case through gradle. I have a properties file which consists of some hundreds of properties. For sample purpose, let us take the values something like this

a=mnop
b=${a}/xyz
c=${b}/abc
d=${c}/pqr

The use-case i want to achieve here through either gradle/groovy is that, this property file (say test.properties) should be copied to another file (test-output.properties) with the values replaced as follows.

a=mnop
b=mnop/xyz
c=mnop/xyz/abc
d=mnop/xyz/abc/pqr

Thanks in advance.

Hey,
this can be done with the expand method of the copy task. have a look at the according chapter in the userguide: https://docs.gradle.org/current/userguide/working_with_files.html#filterOnCopy