But anyway, copying to the output directory of another task is a big no-no-never.
And generating into a custom folder and manually configuring it as srcDir is sub-optimal, as then all tasks needing that resource are missing the task dependency.
Instead in a normal build you would make sure the task has its input and especially outputs properly defined - anyway always a good idea - and then configure the task itself as srcDir, that way its outputs are taken as the sources and every task requesting these files automatically has the necessary task dependency.
Thanks for the advice. Lets say we want to have some privacy sensitive files, depending on the build type.
And I like to have it included in the res/raw flatten process. In that case, it will not be in the code base
Nor we don’t want that extrapath to remain in the project file when developing locally.
In that case, copying that under build/ file and attempt to be included in the android.sourceSets.main.res.srcDirs
Or you have another suggestion?
Otherwise, I can put in the .gitignore, but I like to avoid it.
I did not say you should version the file.
I just said you should properly register the task that generates the file “as” srcDir instead of hard-coding a path where it is generated to.
At least if it works with Android the same as in normal builds.
I don’t think you understood what I said.
You should definitely not change the configuration from a task.
I said you should configure the task as source set, at least in a normal build it is like that.