[ 
https://issues.apache.org/jira/browse/CB-13145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16144562#comment-16144562
 ] 

ASF GitHub Bot commented on CB-13145:
-------------------------------------

Github user stevengill commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/590#discussion_r135664127
  
    --- Diff: src/cordova/plugin/util.js ---
    @@ -35,3 +40,39 @@ function saveToConfigXmlOn (config_json, options) {
         var autosave = config_json.auto_save_plugins || false;
         return autosave || options.save;
     }
    +
    +/*
    + * Merges cli and config.xml variables.
    + *
    + * @param   {object}    pluginInfo
    + * @param   {object}    config.xml
    + * @param   {object}    options
    + *
    + * @return  {object}    object containing the new merged variables
    + */
    +
    +function mergeVariables (pluginInfo, cfg, opts) {
    +    // Validate top-level required variables
    +    var pluginVariables = pluginInfo.getPreferences();
    +    opts.cli_variables = opts.cli_variables || {};
    +    var pluginEntry = cfg.getPlugin(pluginInfo.id);
    +    // Get variables from config.xml
    +    var configVariables = pluginEntry ? pluginEntry.variables : {};
    +    // Add config variable if it's missing in cli_variables
    +    Object.keys(configVariables).forEach(function (variable) {
    +        opts.cli_variables[variable] = opts.cli_variables[variable] || 
configVariables[variable];
    +    });
    +    var missingVariables = Object.keys(pluginVariables)
    +        .filter(function (variableName) {
    +            // discard variables with default value
    +            return !(pluginVariables[variableName] || 
opts.cli_variables[variableName]);
    +        });
    +
    +    if (missingVariables.length) {
    +        events.emit('verbose', 'Removing ' + pluginInfo.dir + ' because 
mandatory plugin variables were missing.');
    +        shell.rm('-rf', pluginInfo.dir);
    +        var msg = 'Variable(s) missing (use: --variable ' + 
missingVariables.join('=value --variable ') + '=value).';
    +        return Q.reject(new CordovaError(msg));
    --- End diff --
    
    get rid of Q dep


> Create playservices version preference in config.xml
> ----------------------------------------------------
>
>                 Key: CB-13145
>                 URL: https://issues.apache.org/jira/browse/CB-13145
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-lib
>            Reporter: Steve Gill
>              Labels: backlog, tools-next
>             Fix For: cordova@7.2.0
>
>
> We are seeing an issue in the community of two plugins using different 
> versions of google play services. This causes gradle to error out. We are 
> running into this with the phonegap-push-plugin.
> Potential solution:
> We could create an Android only preference called PlayServicesVersion in 
> config.xml which would control the version of Play Services used for the 
> entire project.
> In config.xml:
> {code}
> <preference name="PlayServicesVersion" value="11.0.1"/>
> {code}
> Then if the push plugin wanted to include the FCM libraries in it's 
> plugin.xml it would do:
> <framework src="com.google.firebase:firebase-messaging:$PlayServicesVersion"/>
> and the cordova-plugin-google-analytics wanted to include Play Services in 
> it's plugin.xml it would do:
> {code}
> <framework 
> src="com.google.android.gms:play-services-analytics:$PlayServicesVersion" />
> {code}
> they would both use the same version of Play Services. This gets around the 
> problem of plugins using + in the framework tag and having two plugins pin 
> different versions of Play Services.
> The + wildcard fails to compile with the following error:
> {code}
> > Failed to apply plugin [id 'com.google.gms.google-services']
>    > For input string: "+"
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to