You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Simon MacDonald <si...@gmail.com> on 2018/04/20 19:04:51 UTC

New Android Preference

Hey all,

I'd like to suggest that we add a new Android preference. It would be a
boolean preference, to control whether or not to run the Google Services
Plugin.

A number of plugins need to have this gradle plugin run during build time
and they are handling it via a gradle file included in their plugin like
this:

https://github.com/fechanique/cordova-plugin-fcm/blob/master/src/android/FCMPlugin.gradle

but that falls down if two plugins try to apply GoogleServicesPlugin.

The way to mitigate that right now is to have dependency on
cordova-support-google-services so it will only run once.

<dependency id="cordova-support-google-services" version="~1.1.0"/>

However, it makes sense for this to be a preference in cordova-android.
Perhaps,

<preference name="android-RunGoogleServicesPlugin" value="true"/>

If the value is true, then we apply the GoogleServicesPlugin.

Simon Mac Donald
http://simonmacdonald.com

Re: New Android Preference

Posted by Thomas Brian <tb...@tobostudio.com>.
Wouldn't it be possible to have a more generic solution to handle gradle
plugins in general, rather than Google Service specifically ?

Perhaps something similar to the <framework> tag in config.xml that is used
to add libraries?

I ran into a somewhat related issue with Firebase Crashlytics where the
install instructions [1] ask you to add a gradle plugin at the top of the
file, but using Cordova's build-extra only let you add it at the end. There
doesn't seem to be a solution for this right now, unless I'm mistaken, so
it would be nice if we could also handle this use case.


1: https://firebase.google.com/docs/crashlytics/get-started

On 20 April 2018 at 15:49, Simon MacDonald <si...@gmail.com>
wrote:

> No, I thought I'd start a discussion first.
>
> Simon Mac Donald
> http://simonmacdonald.com
>
> On Fri, Apr 20, 2018 at 3:41 PM, Joe Bowser <bo...@gmail.com> wrote:
>
> > Is there a PR ready for this to land?
> >
> > On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <
> > simon.macdonald@gmail.com
> > > wrote:
> >
> > > Hey all,
> > >
> > > I'd like to suggest that we add a new Android preference. It would be a
> > > boolean preference, to control whether or not to run the Google
> Services
> > > Plugin.
> > >
> > > A number of plugins need to have this gradle plugin run during build
> time
> > > and they are handling it via a gradle file included in their plugin
> like
> > > this:
> > >
> > > https://github.com/fechanique/cordova-plugin-fcm/blob/
> > > master/src/android/FCMPlugin.gradle
> > >
> > > but that falls down if two plugins try to apply GoogleServicesPlugin.
> > >
> > > The way to mitigate that right now is to have dependency on
> > > cordova-support-google-services so it will only run once.
> > >
> > > <dependency id="cordova-support-google-services" version="~1.1.0"/>
> > >
> > > However, it makes sense for this to be a preference in cordova-android.
> > > Perhaps,
> > >
> > > <preference name="android-RunGoogleServicesPlugin" value="true"/>
> > >
> > > If the value is true, then we apply the GoogleServicesPlugin.
> > >
> > > Simon Mac Donald
> > > http://simonmacdonald.com
> > >
> >
>



-- 
Thomas Brian
Développeur Frontend
Frontend Developer
tbrian@tobostudio.com <tb...@tobogganstudio.com>
www.tobostudio.com <http://tobostudio.com/>

Re: New Android Preference

Posted by ch...@gmail.com, ch...@gmail.com.

On 2018/04/20 19:49:11, Simon MacDonald <si...@gmail.com> wrote: 
> No, I thought I'd start a discussion first.
> 
> Simon Mac Donald
> http://simonmacdonald.com
> 
> On Fri, Apr 20, 2018 at 3:41 PM, Joe Bowser <bo...@gmail.com> wrote:
> 
> > Is there a PR ready for this to land?
> >
> > On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <
> > simon.macdonald@gmail.com
> > > wrote:
> >
> > > Hey all,
> > >
> > > I'd like to suggest that we add a new Android preference. It would be a
> > > boolean preference, to control whether or not to run the Google Services
> > > Plugin.
> > >
> > > A number of plugins need to have this gradle plugin run during build time
> > > and they are handling it via a gradle file included in their plugin like
> > > this:
> > >
> > > https://github.com/fechanique/cordova-plugin-fcm/blob/
> > > master/src/android/FCMPlugin.gradle
> > >
> > > but that falls down if two plugins try to apply GoogleServicesPlugin.
> > >
> > > The way to mitigate that right now is to have dependency on
> > > cordova-support-google-services so it will only run once.
> > >
> > > <dependency id="cordova-support-google-services" version="~1.1.0"/>
> > >
> > > However, it makes sense for this to be a preference in cordova-android.
> > > Perhaps,
> > >
> > > <preference name="android-RunGoogleServicesPlugin" value="true"/>
> > >
> > > If the value is true, then we apply the GoogleServicesPlugin.
> > >
> > > Simon Mac Donald
> > > http://simonmacdonald.com
> > >
> >
> 
Just submitted PR at https://github.com/apache/cordova-android/pull/438

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: New Android Preference

Posted by Simon MacDonald <si...@gmail.com>.
No, I thought I'd start a discussion first.

Simon Mac Donald
http://simonmacdonald.com

On Fri, Apr 20, 2018 at 3:41 PM, Joe Bowser <bo...@gmail.com> wrote:

> Is there a PR ready for this to land?
>
> On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <
> simon.macdonald@gmail.com
> > wrote:
>
> > Hey all,
> >
> > I'd like to suggest that we add a new Android preference. It would be a
> > boolean preference, to control whether or not to run the Google Services
> > Plugin.
> >
> > A number of plugins need to have this gradle plugin run during build time
> > and they are handling it via a gradle file included in their plugin like
> > this:
> >
> > https://github.com/fechanique/cordova-plugin-fcm/blob/
> > master/src/android/FCMPlugin.gradle
> >
> > but that falls down if two plugins try to apply GoogleServicesPlugin.
> >
> > The way to mitigate that right now is to have dependency on
> > cordova-support-google-services so it will only run once.
> >
> > <dependency id="cordova-support-google-services" version="~1.1.0"/>
> >
> > However, it makes sense for this to be a preference in cordova-android.
> > Perhaps,
> >
> > <preference name="android-RunGoogleServicesPlugin" value="true"/>
> >
> > If the value is true, then we apply the GoogleServicesPlugin.
> >
> > Simon Mac Donald
> > http://simonmacdonald.com
> >
>

Re: New Android Preference

Posted by Joe Bowser <bo...@gmail.com>.
Is there a PR ready for this to land?

On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <simon.macdonald@gmail.com
> wrote:

> Hey all,
>
> I'd like to suggest that we add a new Android preference. It would be a
> boolean preference, to control whether or not to run the Google Services
> Plugin.
>
> A number of plugins need to have this gradle plugin run during build time
> and they are handling it via a gradle file included in their plugin like
> this:
>
> https://github.com/fechanique/cordova-plugin-fcm/blob/
> master/src/android/FCMPlugin.gradle
>
> but that falls down if two plugins try to apply GoogleServicesPlugin.
>
> The way to mitigate that right now is to have dependency on
> cordova-support-google-services so it will only run once.
>
> <dependency id="cordova-support-google-services" version="~1.1.0"/>
>
> However, it makes sense for this to be a preference in cordova-android.
> Perhaps,
>
> <preference name="android-RunGoogleServicesPlugin" value="true"/>
>
> If the value is true, then we apply the GoogleServicesPlugin.
>
> Simon Mac Donald
> http://simonmacdonald.com
>

Re: New Android Preference

Posted by julio cesar sanchez <jc...@gmail.com>.
+1

El viernes, 20 de abril de 2018, Simon MacDonald <si...@gmail.com>
escribió:

> Hey all,
>
> I'd like to suggest that we add a new Android preference. It would be a
> boolean preference, to control whether or not to run the Google Services
> Plugin.
>
> A number of plugins need to have this gradle plugin run during build time
> and they are handling it via a gradle file included in their plugin like
> this:
>
> https://github.com/fechanique/cordova-plugin-fcm/blob/
> master/src/android/FCMPlugin.gradle
>
> but that falls down if two plugins try to apply GoogleServicesPlugin.
>
> The way to mitigate that right now is to have dependency on
> cordova-support-google-services so it will only run once.
>
> <dependency id="cordova-support-google-services" version="~1.1.0"/>
>
> However, it makes sense for this to be a preference in cordova-android.
> Perhaps,
>
> <preference name="android-RunGoogleServicesPlugin" value="true"/>
>
> If the value is true, then we apply the GoogleServicesPlugin.
>
> Simon Mac Donald
> http://simonmacdonald.com
>

Re: New Android Preference

Posted by Steven Gill <st...@gmail.com>.
Let's do it.

On Fri, Apr 20, 2018, 2:29 PM julio cesar sanchez <jc...@gmail.com>
wrote:

> Yeah, having the plugin as dependency should be enough, but as Simon said,
> as a lot of plugins will need this, makes sense to add it to the platform
>
> El viernes, 20 de abril de 2018, Jesse <pu...@gmail.com> escribió:
>
> > So instead of plugin authors including gradle files, they would just add
> > the <preference/> to the plugin.xml and be done?
> >
> > I assume this requires a platform update.
> > Do we miss anything from not including a version as in <dependency/> way?
> > If we just ask plugin authors to add a dependency on
> > cordova-support-google-services
> > doesn't that mean that the android platform wouldn't need to change?
> >
> >
> >
> > @purplecabbage
> > risingj.com
> >
> > On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <
> > simon.macdonald@gmail.com
> > > wrote:
> >
> > > Hey all,
> > >
> > > I'd like to suggest that we add a new Android preference. It would be a
> > > boolean preference, to control whether or not to run the Google
> Services
> > > Plugin.
> > >
> > > A number of plugins need to have this gradle plugin run during build
> time
> > > and they are handling it via a gradle file included in their plugin
> like
> > > this:
> > >
> > > https://github.com/fechanique/cordova-plugin-fcm/blob/
> > > master/src/android/FCMPlugin.gradle
> > >
> > > but that falls down if two plugins try to apply GoogleServicesPlugin.
> > >
> > > The way to mitigate that right now is to have dependency on
> > > cordova-support-google-services so it will only run once.
> > >
> > > <dependency id="cordova-support-google-services" version="~1.1.0"/>
> > >
> > > However, it makes sense for this to be a preference in cordova-android.
> > > Perhaps,
> > >
> > > <preference name="android-RunGoogleServicesPlugin" value="true"/>
> > >
> > > If the value is true, then we apply the GoogleServicesPlugin.
> > >
> > > Simon Mac Donald
> > > http://simonmacdonald.com
> > >
> >
>

Re: New Android Preference

Posted by ch...@gmail.com, ch...@gmail.com.

On 2018/04/20 21:29:06, julio cesar sanchez <jc...@gmail.com> wrote: 
> Yeah, having the plugin as dependency should be enough, but as Simon said,
> as a lot of plugins will need this, makes sense to add it to the platform
> 
> El viernes, 20 de abril de 2018, Jesse <pu...@gmail.com> escribió:
> 
> > So instead of plugin authors including gradle files, they would just add
> > the <preference/> to the plugin.xml and be done?
> >
> > I assume this requires a platform update.
> > Do we miss anything from not including a version as in <dependency/> way?
> > If we just ask plugin authors to add a dependency on
> > cordova-support-google-services
> > doesn't that mean that the android platform wouldn't need to change?
> >
> >
> >
> > @purplecabbage
> > risingj.com
> >
> > On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <
> > simon.macdonald@gmail.com
> > > wrote:
> >
> > > Hey all,
> > >
> > > I'd like to suggest that we add a new Android preference. It would be a
> > > boolean preference, to control whether or not to run the Google Services
> > > Plugin.
> > >
> > > A number of plugins need to have this gradle plugin run during build time
> > > and they are handling it via a gradle file included in their plugin like
> > > this:
> > >
> > > https://github.com/fechanique/cordova-plugin-fcm/blob/
> > > master/src/android/FCMPlugin.gradle
> > >
> > > but that falls down if two plugins try to apply GoogleServicesPlugin.
> > >
> > > The way to mitigate that right now is to have dependency on
> > > cordova-support-google-services so it will only run once.
> > >
> > > <dependency id="cordova-support-google-services" version="~1.1.0"/>
> > >
> > > However, it makes sense for this to be a preference in cordova-android.
> > > Perhaps,
> > >
> > > <preference name="android-RunGoogleServicesPlugin" value="true"/>
> > >
> > > If the value is true, then we apply the GoogleServicesPlugin.
> > >
> > > Simon Mac Donald
> > > http://simonmacdonald.com
> > >
> >
> After implementing the google plugin support in cordova-android, I can publish a patch release for https://github.com/chemerisuk/cordova-support-google-services to limit to that version of cordova. So projects with olders version of cordova-android with continue to use cordova-support-google-services, but newer will use the new preference. 

Another suggestion is to drop android- prefix from the preference name - it seems like new cordova preferences use only camel case style, may be better to be consistent. Something like RunGoogleServicesPlugin or EnableGoogleServicesPlugin.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: New Android Preference

Posted by julio cesar sanchez <jc...@gmail.com>.
Yeah, having the plugin as dependency should be enough, but as Simon said,
as a lot of plugins will need this, makes sense to add it to the platform

El viernes, 20 de abril de 2018, Jesse <pu...@gmail.com> escribió:

> So instead of plugin authors including gradle files, they would just add
> the <preference/> to the plugin.xml and be done?
>
> I assume this requires a platform update.
> Do we miss anything from not including a version as in <dependency/> way?
> If we just ask plugin authors to add a dependency on
> cordova-support-google-services
> doesn't that mean that the android platform wouldn't need to change?
>
>
>
> @purplecabbage
> risingj.com
>
> On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <
> simon.macdonald@gmail.com
> > wrote:
>
> > Hey all,
> >
> > I'd like to suggest that we add a new Android preference. It would be a
> > boolean preference, to control whether or not to run the Google Services
> > Plugin.
> >
> > A number of plugins need to have this gradle plugin run during build time
> > and they are handling it via a gradle file included in their plugin like
> > this:
> >
> > https://github.com/fechanique/cordova-plugin-fcm/blob/
> > master/src/android/FCMPlugin.gradle
> >
> > but that falls down if two plugins try to apply GoogleServicesPlugin.
> >
> > The way to mitigate that right now is to have dependency on
> > cordova-support-google-services so it will only run once.
> >
> > <dependency id="cordova-support-google-services" version="~1.1.0"/>
> >
> > However, it makes sense for this to be a preference in cordova-android.
> > Perhaps,
> >
> > <preference name="android-RunGoogleServicesPlugin" value="true"/>
> >
> > If the value is true, then we apply the GoogleServicesPlugin.
> >
> > Simon Mac Donald
> > http://simonmacdonald.com
> >
>

Re: New Android Preference

Posted by Jesse <pu...@gmail.com>.
So instead of plugin authors including gradle files, they would just add
the <preference/> to the plugin.xml and be done?

I assume this requires a platform update.
Do we miss anything from not including a version as in <dependency/> way?
If we just ask plugin authors to add a dependency on
cordova-support-google-services
doesn't that mean that the android platform wouldn't need to change?



@purplecabbage
risingj.com

On Fri, Apr 20, 2018 at 12:04 PM, Simon MacDonald <simon.macdonald@gmail.com
> wrote:

> Hey all,
>
> I'd like to suggest that we add a new Android preference. It would be a
> boolean preference, to control whether or not to run the Google Services
> Plugin.
>
> A number of plugins need to have this gradle plugin run during build time
> and they are handling it via a gradle file included in their plugin like
> this:
>
> https://github.com/fechanique/cordova-plugin-fcm/blob/
> master/src/android/FCMPlugin.gradle
>
> but that falls down if two plugins try to apply GoogleServicesPlugin.
>
> The way to mitigate that right now is to have dependency on
> cordova-support-google-services so it will only run once.
>
> <dependency id="cordova-support-google-services" version="~1.1.0"/>
>
> However, it makes sense for this to be a preference in cordova-android.
> Perhaps,
>
> <preference name="android-RunGoogleServicesPlugin" value="true"/>
>
> If the value is true, then we apply the GoogleServicesPlugin.
>
> Simon Mac Donald
> http://simonmacdonald.com
>