use init.gradle to enforce F-Droid setup in builds
Right now it is common to have apps with a free build for F-Droid and a non-free build for Google Play. This is difficult to manage since the F-Droid build requires that there is no trace of the non-free stuff since the checks are just regexps on the text files. Instead, using gradle's init.gradle, any maven repos not in the whitelist can be automatically removed from the build, non-free gradle tasks can be ignored, etc.
These gradle enforcement mechanisms can then be used instead of the regexps, and the regexps would be used for non-gradle builds. The F-Droid init.gradle is then included in the buildserver, and anyone can install on their own machine. This would make it easy for apps that have both a free and non-free build. We could also define a standard gradle task name for the non-free build flavor which would be automatically ignored, e.g. nonFree
, assembleNonFreeRelease
, etc.
Here's other related examples of controlling gradle repos in init.gradle: