Github user audreyso commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/574#discussion_r132795105 --- 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 -- Yes, exactly! Also rebased and updated based on feedback. Let me know if there's anything else!
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org