Hello, I have a simple question. I have a plugin t...
# community-support
a
Hello, I have a simple question. I have a plugin that transforms some resources before the
processResources
step. It places the transformed resources in a
generated/resources
folder and adds that folder to the
resources
srcDirs. The original resources that have been transformed are then excluded. The task is run before the
processResources
step takes place. However, when I start the build task in
--continuous
mode it doesn't trigger on changes in the resource anymore. Is there a way to exclude files from the resources but still have the
--continuous
flag working when changing the underlying resources (and effectively retriggering the transformation task)?
v
I don't know what your transformation does, but can't you simply transform them as part of the
processResources
task? If you for example just replace some placeholders, you can for example use
expand
or you can use an other
Transformer
or
FilterReader
, ...
a
O wow. I didn’t even know these existed. Transformer seems to be the one I need… Gradle always surprised me with how complete it is.
👌 1
Well, that worked amazingly well. Thanks! I was able to remove a LOT of resource handling code. Learning; read the docs even more
👌 1
v
Keep in mind that you should always set the filtering charset if you do any filter, expand, or similar. And that you should restrict the actions with
filesMatching
and friends in most cases to not hit expected files, especially binary ones.
a
Yes I did the filesmatching one already. I’ll do the charset as well
👌 1