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

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

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

    https://github.com/apache/cordova-lib/pull/574#discussion_r132781446
  
    --- Diff: src/cordova/restore-util.js ---
    @@ -341,19 +340,29 @@ function installPluginsFromConfigXML (args) {
                 fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 
2), 'utf8');
             }
         }
    -    // Write config.xml (only if plugins exist in package.json).
    +    // Write to config.xml (only if it is different from package.json in 
content)
         comboPluginIdArray.forEach(function (plugID) {
    +        var configXMLPlugin = cfg.getPlugin(plugID);
             if (pluginIdConfig.indexOf(plugID) < 0) {
                 pluginIdConfig.push(plugID);
    -        }
    -        cfg.removePlugin(plugID);
    -        if (mergedPluginSpecs[plugID]) {
    +            if (mergedPluginSpecs[plugID]) {
    +                cfg.removePlugin(plugID);
    +                cfg.addPlugin({name: plugID, spec: 
mergedPluginSpecs[plugID]}, comboObject[plugID]);
    +                modifiedConfigXML = true;
    +            } else {
    +                cfg.removePlugin(plugID);
    +                cfg.addPlugin({name: plugID}, comboObject[plugID]);
    +                modifiedConfigXML = true;
    +            }
    +
    +        // Write only if the plugin variables or specs are different from 
pkgJson
    +        } else if (((pluginIdConfig.indexOf(plugID) > 0) && 
(mergedPluginSpecs[plugID]) &&
    +            ((configXMLPlugin.variables !== comboObject[plugID]))) ||
    +            ((mergedPluginSpecs[plugID] !== configXMLPlugin.spec) ||
    --- End diff --
    
    so to confirm, either `((pluginIdConfig.indexOf(plugID) > 0) && 
(mergedPluginSpecs[plugID]) &&(configXMLPlugin.variables !== 
comboObject[plugID]))` or `((mergedPluginSpecs[plugID] !== 
configXMLPlugin.spec) || (configXMLPlugin.variables !== comboObject[plugID]))` 
need to be true


> Order of plugins in config.xml modified during build
> ----------------------------------------------------
>
>                 Key: CB-12838
>                 URL: https://issues.apache.org/jira/browse/CB-12838
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-cli
>    Affects Versions: cordova@7.0.0
>         Environment: Mac OS 10.12.4, Cordova 7.0.1
>            Reporter: Anton Weber
>            Assignee: Audrey So
>            Priority: Minor
>              Labels: android, cordova-8.0.0, ios, reproduced, triaged
>
> Running cordova build android or cordova build ios changes the order in which 
> plugins are listed in the config.xml (arranging them alphabetically). 
> This causes problems when manually resolving dependencies, e.g. when 
> installing a specific version of a dependency first by having it higher up in 
> the list.
> Example:
> Original config.xml content:
> ...
>     <plugin name="cordova-plugin-device" spec="^1.1.6" />
>     <plugin name="cordova-plugin-camera" spec="^2.4.1" />
>     <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
>     <engine name="android" spec="^6.2.3" />
>     <engine name="ios" spec="^4.4.0" />
> ...
> After cordova build:
> ...
>     <engine name="android" spec="^6.2.3" />
>     <engine name="ios" spec="^4.4.0" />
>     <plugin name="cordova-plugin-camera" spec="^2.4.1" />
>     <plugin name="cordova-plugin-device" spec="^1.1.6" />
>     <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
> ...



--
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