How to avoid editing build.gradle in platforms/android



I need to add some custom build script to in the build.gradle file in platforms/android. But the problem is, I have to generate the platforms folder in every release as a practice. (Because, we have ONLY keep the soruce files and node modules in the source control system. So, in every build we let it download the platforms)
Is it possible to put this custom scripts somewhere in app/App_Resources/android to prevent from my changes to disappear.