I'm in a need of conditionally applying the com.google.gms.google-services
plugin in my project only to certain flavours.
I managed to achieve this analogically to this approach, but it works for static values only (meaning I need to hardcode the flavours that I want to add this plugin to).
I'm searching for a solution that would allow me applying the plugin only if a certain flavour contains the google-services.json
file (or it is in the project's inheritance tree), so the solution is flexible and does not require keeping the list up-to-date.
I managed to scan for the existence of this file for all the build variants using the project.android.applicationVariants
property, but this check is being done already once all the plugins are applied. This means that the results of this scan are not needed anymore.
Is there any way to use the project's applicationVariants
property on an earlier stage, before applying the plugin?