cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/5] cordova-lib git commit: Make all ad-hoc plugin.xml parsing use PluginInfo instead
Date Thu, 22 Jan 2015 20:58:15 GMT
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index 6b0f410..8da6f8b 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -29,7 +29,6 @@ var path = require('path'),
     child_process = require('child_process'),
     semver = require('semver'),
     PlatformJson = require('./util/PlatformJson'),
-    PluginInfoProvider = require('../PluginInfoProvider'),
     CordovaError  = require('../CordovaError'),
     Q = require('q'),
     platform_modules = require('./platforms'),
@@ -42,6 +41,9 @@ var path = require('path'),
     isWindows = (os.platform().substr(0,3) === 'win'),
     cordovaUtil = require('../cordova/util');
 
+var PluginInfo = require('../PluginInfo');
+var PluginInfoProvider = require('../PluginInfoProvider');
+
 /* INSTALL FLOW
    ------------
    There are four functions install "flows" through. Here is an attempt at
@@ -201,22 +203,22 @@ function callEngineScripts(engines) {
 }
 
 // return only the engines we care about/need
-function getEngines(pluginElement, platform, project_dir, plugin_dir){
-    var engines = pluginElement.findall('engines/engine');
+function getEngines(pluginInfo, platform, project_dir, plugin_dir){
+    var engines = pluginInfo.getEngines();
     var defaultEngines = require('./util/default-engines')(project_dir);
     var uncheckedEngines = [];
     var cordovaEngineIndex, cordovaPlatformEngineIndex, theName, platformIndex, defaultPlatformIndex;
     // load in known defaults and update when necessary
 
     engines.forEach(function(engine){
-        theName = engine.attrib['name'];
+        theName = engine.name;
 
         // check to see if the engine is listed as a default engine
         if(defaultEngines[theName]){
             // make sure engine is for platform we are installing on
             defaultPlatformIndex = defaultEngines[theName].platform.indexOf(platform);
             if(defaultPlatformIndex > -1 || defaultEngines[theName].platform === '*'){
-                defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.attrib['version'];
+                defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.version;
                 defaultEngines[theName].currentVersion = defaultEngines[theName].currentVersion ? defaultEngines[theName].currentVersion : null;
                 defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? defaultEngines[theName].scriptSrc : null;
                 defaultEngines[theName].name = theName;
@@ -229,9 +231,9 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
             }
         // check for other engines
         }else{
-            platformIndex = engine.attrib['platform'].indexOf(platform);
-            if(platformIndex > -1 || engine.attrib['platform'] === '*'){
-                uncheckedEngines.push({ 'name': theName, 'platform': engine.attrib['platform'], 'scriptSrc':path.resolve(plugin_dir, engine.attrib['scriptSrc']), 'minVersion' :  engine.attrib['version']});
+            platformIndex = engine.platform.indexOf(platform);
+            if(platformIndex > -1 || engine.platform === '*'){
+                uncheckedEngines.push({ 'name': theName, 'platform': engine.platform, 'scriptSrc':path.resolve(plugin_dir, engine.scriptSrc), 'minVersion' :  engine.version});
             }
         }
     });
@@ -266,7 +268,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
     }
     events.emit('log', 'Installing "' + pluginInfo.id + '" for ' + platform);
 
-    var theEngines = getEngines(pluginInfo._et, platform, project_dir, plugin_dir);
+    var theEngines = getEngines(pluginInfo, platform, project_dir, plugin_dir);
 
     var install = {
         actions: actions,
@@ -523,57 +525,46 @@ function handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir,
 
     var handler = platform_modules[platform];
 
-    var platformTag = pluginInfo._et.find('./platform[@name="'+platform+'"]');
-
-    // CB-6976 Windows Universal Apps. For smooth transition and to prevent mass api failures
-    // we allow using windows8 tag for new windows platform
-    if (platform == 'windows' && !platformTag) {
-        platformTag = pluginInfo._et.find('platform[@name="' + 'windows8' + '"]');
-    }
-    if (platformTag) {
-        var sourceFiles = platformTag.findall('./source-file'),
-            headerFiles = platformTag.findall('./header-file'),
-            resourceFiles = platformTag.findall('./resource-file'),
-            frameworkFiles = platformTag.findall('./framework'),
-            libFiles = platformTag.findall('./lib-file');
-
-        // queue up native stuff
-        sourceFiles && sourceFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler['source-file'].install,
-                                              [item, plugin_dir, project_dir, pluginInfo.id, options],
-                                              handler['source-file'].uninstall,
-                                              [item, project_dir, pluginInfo.id, options]));
-        });
-
-        headerFiles && headerFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler['header-file'].install,
-                                             [item, plugin_dir, project_dir, pluginInfo.id, options],
-                                             handler['header-file'].uninstall,
-                                             [item, project_dir, pluginInfo.id, options]));
-        });
+    var sourceFiles = pluginInfo.getSourceFiles(platform);
+    var headerFiles = pluginInfo.getHeaderFiles(platform);
+    var libFiles = pluginInfo.getLibFiles(platform);
+    var resourceFiles = pluginInfo.getResourceFiles(platform);
+    var frameworkFiles = pluginInfo.getFrameworks(platform);
+
+    // queue up native stuff
+    sourceFiles.forEach(function(item) {
+        actions.push(actions.createAction(handler['source-file'].install,
+                                          [item, plugin_dir, project_dir, pluginInfo.id, options],
+                                          handler['source-file'].uninstall,
+                                          [item, project_dir, pluginInfo.id, options]));
+    });
 
-        resourceFiles && resourceFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler['resource-file'].install,
-                                              [item, plugin_dir, project_dir, pluginInfo.id, options],
-                                              handler['resource-file'].uninstall,
-                                              [item, project_dir, pluginInfo.id, options]));
-        });
-        // CB-5238 custom frameworks only
-        frameworkFiles && frameworkFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler['framework'].install,
-                                             [item, plugin_dir, project_dir, pluginInfo.id, options],
-                                             handler['framework'].uninstall,
-                                             [item, project_dir, pluginInfo.id, options]));
-        });
+    headerFiles.forEach(function(item) {
+        actions.push(actions.createAction(handler['header-file'].install,
+                                         [item, plugin_dir, project_dir, pluginInfo.id, options],
+                                         handler['header-file'].uninstall,
+                                         [item, project_dir, pluginInfo.id, options]));
+    });
 
-        libFiles && libFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler['lib-file'].install,
-                                                [item, plugin_dir, project_dir, pluginInfo.id, options],
-                                                handler['lib-file'].uninstall,
-                                                [item, project_dir, pluginInfo.id, options]));
+    resourceFiles.forEach(function(item) {
+        actions.push(actions.createAction(handler['resource-file'].install,
+                                          [item, plugin_dir, project_dir, pluginInfo.id, options],
+                                          handler['resource-file'].uninstall,
+                                          [item, project_dir, pluginInfo.id, options]));
+    });
+    frameworkFiles.forEach(function(item) {
+        actions.push(actions.createAction(handler['framework'].install,
+                                         [item, plugin_dir, project_dir, pluginInfo.id, options],
+                                         handler['framework'].uninstall,
+                                         [item, project_dir, pluginInfo.id, options]));
+    });
+    libFiles.forEach(function(item) {
+        actions.push(actions.createAction(handler['lib-file'].install,
+                                            [item, plugin_dir, project_dir, pluginInfo.id, options],
+                                            handler['lib-file'].uninstall,
+                                            [item, project_dir, pluginInfo.id, options]));
 
-        });
-    }
+    });
 
     // run through the action stack
     return actions.process(platform, project_dir)
@@ -617,7 +608,7 @@ function isRelativePath(path) {
 
 // Copy or link a plugin from plugin_dir to plugins_dir/plugin_id.
 function copyPlugin(plugin_src_dir, plugins_dir, link, pluginInfoProvider) {
-    var pluginInfo = pluginInfoProvider.get(plugin_src_dir);
+    var pluginInfo = new PluginInfo(plugin_src_dir);
     var dest = path.join(plugins_dir, pluginInfo.id);
     shell.rm('-rf', dest);
 
@@ -630,7 +621,8 @@ function copyPlugin(plugin_src_dir, plugins_dir, link, pluginInfoProvider) {
         events.emit('verbose', 'Copying from location "' + plugin_src_dir + '" to location "' + dest + '"');
         shell.cp('-R', path.join(plugin_src_dir, '*') , dest);
     }
-    pluginInfoProvider.put(dest, pluginInfo);
+    pluginInfo.dir = dest;
+    pluginInfoProvider.put(pluginInfo);
 
     return dest;
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/amazon-fireos.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/amazon-fireos.js b/cordova-lib/src/plugman/platforms/amazon-fireos.js
index 76cbbef..a7e9d33 100644
--- a/cordova-lib/src/plugman/platforms/amazon-fireos.js
+++ b/cordova-lib/src/plugman/platforms/amazon-fireos.js
@@ -46,64 +46,64 @@ module.exports = {
         return mDoc._root.attrib['package'];
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id) {
-            var src = source_el.attrib['src'];
+        install:function(obj, plugin_dir, project_dir, plugin_id) {
+            var src = obj.src;
             if (!src) {
-                throw new CordovaError('<source-file> element is missing "src" attribute: ' + source_el);
+                throw new CordovaError('<source-file> element is missing "src" attribute for plugin: ' + plugin_id);
             }
-            var targetDir = source_el.attrib['target-dir'];
+            var targetDir = obj.targetDir;
             if (!targetDir) {
-                throw new CordovaError('<source-file> element is missing "target-dir" attribute: ' + source_el);
+                throw new CordovaError('<source-file> element is missing "target-dir" attribute for plugin: ' + plugin_id);
             }
             var dest = path.join(targetDir, path.basename(src));
 
             common.copyNewFile(plugin_dir, src, project_dir, dest);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
-            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.deleteJava(project_dir, dest);
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-fileinstall is not supported for amazon-fireos');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for amazon-fireos');
         }
     },
     'lib-file':{
-        install:function(lib_el, plugin_dir, project_dir, plugin_id, options) {
-            var src = lib_el.attrib.src;
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
             var dest = path.join('libs', path.basename(src));
             common.copyFile(plugin_dir, src, project_dir, dest);
         },
-        uninstall:function(lib_el, project_dir, plugin_id, options) {
-            var src = lib_el.attrib.src;
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var src = obj.src;
             var dest = path.join('libs', path.basename(src));
             common.removeFile(project_dir, dest);
         }
     },
     'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options) {
-            var src = el.attrib.src;
-            var target = el.attrib.target;
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var target = obj.target;
             events.emit('verbose', 'Copying resource file ' + src + ' to ' + target);
             common.copyFile(plugin_dir, src, project_dir, target);
         },
-        uninstall:function(el, project_dir, plugin_id, options) {
-            var target = el.attrib.target;
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var target = obj.target;
             common.removeFile(project_dir, target);
         }
     },
     'framework': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var src = source_el.attrib.src;
-            var custom = source_el.attrib.custom;
-            if (!src) throw new CordovaError('src not specified in <framework>: ' + source_el);
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var custom = obj.custom;
+            if (!src) throw new CordovaError('src not specified in <framework> for plugin ' + plugin_id);
 
             events.emit('verbose', 'Installing Android library: ' + src);
-            var parent = source_el.attrib.parent;
+            var parent = obj.parent;
             var parentDir = parent ? path.resolve(project_dir, parent) : project_dir;
             var subDir;
 
@@ -117,7 +117,7 @@ module.exports = {
             }
 
             var projectConfig = module.exports.parseProjectFile(project_dir);
-            var type = source_el.attrib.type;
+            var type = obj.type;
             if (type == 'gradleReference') {
                 //add reference to build.gradle
                 projectConfig.addGradleReference(parentDir, subDir);
@@ -125,13 +125,13 @@ module.exports = {
                 projectConfig.addSubProject(parentDir, subDir);
             }
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
-            var src = source_el.attrib.src;
-            var custom = source_el.attrib.custom;
-            if (!src) throw new CordovaError('src not specified in <framework>: ' + source_el);
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var custom = obj.custom;
+            if (!src) throw new CordovaError('src not specified in <framework> for plugin: ' + plugin_id);
 
             events.emit('verbose', 'Uninstalling Android library: ' + src);
-            var parent = source_el.attrib.parent;
+            var parent = obj.parent;
             var parentDir = parent ? path.resolve(project_dir, parent) : project_dir;
             var subDir;
 
@@ -145,7 +145,7 @@ module.exports = {
             }
 
             var projectConfig = module.exports.parseProjectFile(project_dir);
-            var type = source_el.attrib.type;
+            var type = obj.type;
             if (type == 'gradleReference') {
                 projectConfig.removeGradleReference(parentDir, subDir);
             } else {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/android.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/android.js b/cordova-lib/src/plugman/platforms/android.js
index 10a4ebd..faeddc0 100644
--- a/cordova-lib/src/plugman/platforms/android.js
+++ b/cordova-lib/src/plugman/platforms/android.js
@@ -51,64 +51,64 @@ module.exports = {
         return packageName.substring(lastDotIndex + 1);
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var src = source_el.attrib['src'];
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
             if (!src) {
-                throw new CordovaError('<source-file> element is missing "src" attribute: ' + source_el);
+                throw new CordovaError('<source-file> element is missing "src" attribute for plugin: ' + plugin_id);
             }
-            var targetDir = source_el.attrib['target-dir'];
+            var targetDir = obj.targetDir;
             if (!targetDir) {
-                throw new CordovaError('<source-file> element is missing "target-dir" attribute: ' + source_el);
+                throw new CordovaError('<source-file> element is missing "target-dir" attribute for plugin: ' + plugin_id);
             }
             var dest = path.join(targetDir, path.basename(src));
 
             common.copyNewFile(plugin_dir, src, project_dir, dest, options && options.link);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
-            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.deleteJava(project_dir, dest);
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.install is not supported for android');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for android');
         }
     },
     'lib-file':{
-        install:function(lib_el, plugin_dir, project_dir, plugin_id, options) {
-            var src = lib_el.attrib.src;
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
             var dest = path.join('libs', path.basename(src));
             common.copyFile(plugin_dir, src, project_dir, dest, !!(options && options.link));
         },
-        uninstall:function(lib_el, project_dir, plugin_id, options) {
-            var src = lib_el.attrib.src;
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var src = obj.src;
             var dest = path.join('libs', path.basename(src));
             common.removeFile(project_dir, dest);
         }
     },
     'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options) {
-            var src = el.attrib.src;
-            var target = el.attrib.target;
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var target = obj.target;
             events.emit('verbose', 'Copying resource file ' + src + ' to ' + target);
             common.copyFile(plugin_dir, src, project_dir, path.normalize(target), !!(options && options.link));
         },
-        uninstall:function(el, project_dir, plugin_id, options) {
-            var target = el.attrib.target;
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var target = obj.target;
             common.removeFile(project_dir, path.normalize(target));
         }
     },
     'framework': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var src = source_el.attrib.src;
-            var custom = source_el.attrib.custom;
-            if (!src) throw new CordovaError('src not specified in <framework>: ' + source_el);
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var custom = obj.custom;
+            if (!src) throw new CordovaError('src not specified in <framework> for plugin: ' + plugin_id);
 
             events.emit('verbose', 'Installing Android library: ' + src);
-            var parent = source_el.attrib.parent;
+            var parent = obj.parent;
             var parentDir = parent ? path.resolve(project_dir, parent) : project_dir;
             var subDir;
 
@@ -122,7 +122,7 @@ module.exports = {
             }
 
             var projectConfig = module.exports.parseProjectFile(project_dir);
-            var type = source_el.attrib.type;
+            var type = obj.type;
             if (type == 'gradleReference') {
                 //add reference to build.gradle
                 projectConfig.addGradleReference(parentDir, subDir);
@@ -130,13 +130,13 @@ module.exports = {
                 projectConfig.addSubProject(parentDir, subDir);
             }
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
-            var src = source_el.attrib.src;
-            var custom = source_el.attrib.custom;
-            if (!src) throw new CordovaError('src not specified in <framework>: ' + source_el);
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var custom = obj.custom;
+            if (!src) throw new CordovaError('src not specified in <framework> for plugin: ' + plugin_id);
 
             events.emit('verbose', 'Uninstalling Android library: ' + src);
-            var parent = source_el.attrib.parent;
+            var parent = obj.parent;
             var parentDir = parent ? path.resolve(project_dir, parent) : project_dir;
             var subDir;
 
@@ -150,7 +150,7 @@ module.exports = {
             }
 
             var projectConfig = module.exports.parseProjectFile(project_dir);
-            var type = source_el.attrib.type;
+            var type = obj.type;
             if (type == 'gradleReference') {
                 projectConfig.removeGradleReference(parentDir, subDir);
             } else {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/blackberry10.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/blackberry10.js b/cordova-lib/src/plugman/platforms/blackberry10.js
index 33a554c..b7e0b92 100644
--- a/cordova-lib/src/plugman/platforms/blackberry10.js
+++ b/cordova-lib/src/plugman/platforms/blackberry10.js
@@ -40,18 +40,18 @@ module.exports = {
         return widget_doc._root.attrib['id'];
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var src = source_el.attrib['src'];
-            var target = source_el.attrib['target-dir'] || plugin_id;
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var target = obj.targetDir || plugin_id;
             TARGETS.forEach(function(arch) {
                 var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
 
                 common.copyNewFile(plugin_dir, src, project_dir, dest);
             });
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
-            var src = source_el.attrib['src'];
-            var target = source_el.attrib['target-dir'] || plugin_id;
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var target = obj.targetDir || plugin_id;
             TARGETS.forEach(function(arch) {
                 var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
                 common.removeFile(project_dir, dest);
@@ -59,40 +59,40 @@ module.exports = {
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.install is not supported for blackberry');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for blackberry');
         }
     },
     'lib-file':{
-        install:function(lib_el, plugin_dir, project_dir, plugin_id, options) {
-            var src = lib_el.attrib.src;
-            var arch = lib_el.attrib.arch;
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var arch = obj.arch;
             var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
             common.copyFile(plugin_dir, src, project_dir, dest, false);
         },
-        uninstall:function(lib_el, project_dir, plugin_id, options) {
-            var src = lib_el.attrib.src;
-            var arch = lib_el.attrib.arch;
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var src = obj.src;
+            var arch = obj.arch;
             var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
             common.removeFile(project_dir, dest);
         }
     },
     'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.install is not supported for blackberry');
         },
-        uninstall:function(el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.uninstall is not supported for blackberry');
         }
     },
     'framework': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.install is not supported for blackberry');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.uninstall is not supported for blackberry');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/browser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/browser.js b/cordova-lib/src/plugman/platforms/browser.js
index 9774005..db6fc19 100644
--- a/cordova-lib/src/plugman/platforms/browser.js
+++ b/cordova-lib/src/plugman/platforms/browser.js
@@ -55,44 +55,44 @@ module.exports = {
         return widget_doc._root.attrib['id'];
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
-            common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var dest = path.join(obj.targetDir, path.basename(obj.src));
+            common.copyFile(plugin_dir, obj.src, project_dir, dest);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
-            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.removeFile(project_dir, dest);
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-fileinstall is not supported for browser');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for browser');
         }
     },
     'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.install is not supported for browser');
         },
-        uninstall:function(el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.uninstall is not supported for browser');
         }
     },
     'framework': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.install is not supported for browser');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.uninstall is not supported for browser');
         }
     },
     'lib-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.install is not supported for browser');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.uninstall is not supported for browser');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/common.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/common.js b/cordova-lib/src/plugman/platforms/common.js
index dce15ea..e2289f3 100644
--- a/cordova-lib/src/plugman/platforms/common.js
+++ b/cordova-lib/src/plugman/platforms/common.js
@@ -103,18 +103,18 @@ module.exports = common = {
     },
     // handle <asset> elements
     asset:{
-        install:function(src, target, plugin_dir, www_dir) {
-            if (!src) {
-                throw new Error('<asset> tag without required "src" attribute');
+        install:function(asset, plugin_dir, www_dir) {
+            if (!asset.src) {
+                throw new Error('<asset> tag without required "src" attribute. plugin=' + plugin_dir);
             }
-            if (!target) {
+            if (!asset.target) {
                 throw new Error('<asset> tag without required "target" attribute');
             }
 
-            common.copyFile(plugin_dir, src, www_dir, target);
+            common.copyFile(plugin_dir, asset.src, www_dir, asset.target);
         },
-        uninstall:function(src, target, www_dir, plugin_id) {
-            target = target || src;
+        uninstall:function(asset, www_dir, plugin_id) {
+            var target = asset.target || asset.src;
 
             if (!target) {
                 throw new Error('<asset> tag without required "target" attribute');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/firefoxos.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/firefoxos.js b/cordova-lib/src/plugman/platforms/firefoxos.js
index 00d5aa6..560b92b 100644
--- a/cordova-lib/src/plugman/platforms/firefoxos.js
+++ b/cordova-lib/src/plugman/platforms/firefoxos.js
@@ -55,44 +55,44 @@ module.exports = {
         return widget_doc._root.attrib['id'];
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
-            common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var dest = path.join(obj.targetDir, path.basename(obj.src));
+            common.copyFile(plugin_dir, obj.src, project_dir, dest);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
-            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+        uninstall:function(obj, project_dir, plugin_id, options) {
+            var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.removeFile(project_dir, dest);
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-fileinstall is not supported for firefoxos');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for firefoxos');
         }
     },
     'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.install is not supported for firefoxos');
         },
-        uninstall:function(el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.uninstall is not supported for firefoxos');
         }
     },
     'framework': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.install is not supported for firefoxos');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.uninstall is not supported for firefoxos');
         }
     },
     'lib-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.install is not supported for firefoxos');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.uninstall is not supported for firefoxos');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/ios.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ios.js b/cordova-lib/src/plugman/platforms/ios.js
index e67c3b3..41d768f 100644
--- a/cordova-lib/src/plugman/platforms/ios.js
+++ b/cordova-lib/src/plugman/platforms/ios.js
@@ -41,13 +41,12 @@ module.exports = {
         return plist.parse(fs.readFileSync(plist_file, 'utf8')).CFBundleIdentifier;
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options, project) {
-            var src = source_el.attrib['src'];
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project) {
+            var src = obj.src;
             var srcFile = path.resolve(plugin_dir, src);
-            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(source_el));
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || '');
             var destFile = path.resolve(targetDir, path.basename(src));
-            var is_framework = source_el.attrib['framework'] && (source_el.attrib['framework'] == 'true' || source_el.attrib['framework'] === true);
-            var has_flags = source_el.attrib['compiler-flags'] && source_el.attrib['compiler-flags'].length ? true : false ;
+            var is_framework = obj.framework;
 
             if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <source-file>');
             if (fs.existsSync(destFile)) throw new Error('target destination "' + destFile + '" already exists');
@@ -55,22 +54,21 @@ module.exports = {
             project_ref = fixPathSep(project_ref);
 
             if (is_framework) {
-                var weak = source_el.attrib['weak'];
-                var opt = { weak: (weak === weak == 'true') };
+                var opt = { weak: obj.weak };
                 var project_relative = path.join(path.basename(project.xcode_path), project_ref);
                 project.xcode.addFramework(project_relative, opt);
                 project.xcode.addToLibrarySearchPaths({path:project_ref});
             } else {
-                project.xcode.addSourceFile(project_ref, has_flags ? {compilerFlags:source_el.attrib['compiler-flags']} : {});
+                project.xcode.addSourceFile(project_ref, obj.compilerFlags ? {compilerFlags:obj.compilerFlags} : {});
             }
             shell.mkdir('-p', targetDir);
             shell.cp(srcFile, destFile);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options, project) {
-            var src = source_el.attrib['src'];
-            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(source_el));
+        uninstall:function(obj, project_dir, plugin_id, options, project) {
+            var src = obj.src;
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || '');
             var destFile = path.resolve(targetDir, path.basename(src));
-            var is_framework = source_el.attrib['framework'] && (source_el.attrib['framework'] == 'true' || source_el.attrib['framework'] === true);
+            var is_framework = obj.framework;
 
             var project_ref = path.join('Plugins', path.relative(project.plugins_dir, destFile));
             project_ref = fixPathSep(project_ref);
@@ -89,10 +87,10 @@ module.exports = {
         }
     },
     'header-file':{
-        install:function(header_el, plugin_dir, project_dir, plugin_id, options, project) {
-            var src = header_el.attrib['src'];
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project) {
+            var src = obj.src;
             var srcFile = path.resolve(plugin_dir, src);
-            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(header_el));
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || '');
             var destFile = path.resolve(targetDir, path.basename(src));
             if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <header-file>');
             if (fs.existsSync(destFile)) throw new Error('target destination "' + destFile + '" already exists');
@@ -104,9 +102,9 @@ module.exports = {
             shell.mkdir('-p', targetDir);
             shell.cp(srcFile, destFile);
         },
-        uninstall:function(header_el, project_dir, plugin_id, options, project) {
-            var src = header_el.attrib['src'];
-            var targetDir = path.resolve(project.plugins_dir, plugin_id, getRelativeDir(header_el));
+        uninstall:function(obj, project_dir, plugin_id, options, project) {
+            var src = obj.src;
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || '');
             var destFile = path.resolve(targetDir, path.basename(src));
             
             var project_ref = path.join('Plugins', path.relative(project.plugins_dir, destFile));
@@ -120,8 +118,8 @@ module.exports = {
         }
     },
     'resource-file':{
-        install:function(resource_el, plugin_dir, project_dir, plugin_id, options, project) {
-            var src = resource_el.attrib['src'],
+        install:function(reobj, plugin_dir, project_dir, plugin_id, options, project) {
+            var src = reobj.src,
                 srcFile = path.resolve(plugin_dir, src),
                 destFile = path.resolve(project.resources_dir, path.basename(src));
             if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <resource-file>');
@@ -129,17 +127,17 @@ module.exports = {
             project.xcode.addResourceFile(path.join('Resources', path.basename(src)));
             shell.cp('-R', srcFile, project.resources_dir);
         },
-        uninstall:function(resource_el, project_dir, plugin_id, options, project) {
-            var src = resource_el.attrib['src'],
+        uninstall:function(reobj, project_dir, plugin_id, options, project) {
+            var src = reobj.src,
                 destFile = path.resolve(project.resources_dir, path.basename(src));
             project.xcode.removeResourceFile(path.join('Resources', path.basename(src)));
             shell.rm('-rf', destFile);
         }
     },
     'framework':{ // CB-5238 custom frameworks only
-        install:function(framework_el, plugin_dir, project_dir, plugin_id, options, project) {
-            var src = framework_el.attrib['src'],
-                custom = framework_el.attrib['custom'],
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project) {
+            var src = obj.src,
+                custom = obj.custom,
                 srcFile = path.resolve(plugin_dir, src),
                 targetDir = path.resolve(project.plugins_dir, plugin_id, path.basename(src));
             if (!custom) return; //non-custom frameworks are processed in config-changes.js
@@ -150,18 +148,18 @@ module.exports = {
             var project_relative = path.relative(project_dir, targetDir);
             project.xcode.addFramework(project_relative, {customFramework: true});
         },
-        uninstall:function(framework_el, project_dir, plugin_id, options, project) {
-            var src = framework_el.attrib['src'],
+        uninstall:function(obj, project_dir, plugin_id, options, project) {
+            var src = obj.src,
                 targetDir = path.resolve(project.plugins_dir, plugin_id, path.basename(src));
             project.xcode.removeFramework(targetDir, {customFramework: true});
             shell.rm('-rf', targetDir);
         }
     },
     'lib-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.install is not supported for ios');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.uninstall is not supported for ios');
         }
     },
@@ -223,15 +221,6 @@ module.exports = {
     }
 };
 
-function getRelativeDir(file) {
-    var targetDir = file.attrib['target-dir'];
-    if (targetDir) {
-        return targetDir;
-    } else {
-        return '';
-    }
-}
-
 var pathSepFix = new RegExp(path.sep.replace(/\\/,'\\\\'),'g');
 function fixPathSep(file) {
     return file.replace(pathSepFix, '/');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/tizen.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/tizen.js b/cordova-lib/src/plugman/platforms/tizen.js
index f471b13..728e4fb 100644
--- a/cordova-lib/src/plugman/platforms/tizen.js
+++ b/cordova-lib/src/plugman/platforms/tizen.js
@@ -52,23 +52,23 @@ module.exports = {
         return widget_doc._root.attrib['id'];
     },
     'source-file':{
-        install: function(source_el, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(source_el, project_dir, plugin_id, options) {}
+        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function(obj, project_dir, plugin_id, options) {}
     },
     'header-file': {
-        install: function(source_el, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(source_el, project_dir, plugin_id, options) {}
+        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function(obj, project_dir, plugin_id, options) {}
     },
     'resource-file':{
-        install: function(source_el, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(source_el, project_dir, plugin_id, options) {}
+        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function(obj, project_dir, plugin_id, options) {}
     },
     'framework': {
-        install: function(source_el, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(source_el, project_dir, plugin_id, options) {}
+        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function(obj, project_dir, plugin_id, options) {}
     },
     'lib-file': {
-        install: function(source_el, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(source_el, project_dir, plugin_id, options) {}
+        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function(obj, project_dir, plugin_id, options) {}
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/ubuntu.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ubuntu.js b/cordova-lib/src/plugman/platforms/ubuntu.js
index d16a8e7..ce5ff56 100644
--- a/cordova-lib/src/plugman/platforms/ubuntu.js
+++ b/cordova-lib/src/plugman/platforms/ubuntu.js
@@ -50,44 +50,44 @@ module.exports = {
         return widget_doc._root.attrib['id'];
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(source_el.attrib.src));
-            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(obj.src));
+            common.copyFile(plugin_dir, obj.src, project_dir, dest);
 
             var cmake = path.join(project_dir, 'build', 'CMakeLists.txt');
             shell.exec('touch ' + cmake);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
-            shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
+            shell.rm(path.join(dest, path.basename(obj.src)));
 
             var cmake = path.join(project_dir, 'build', 'CMakeLists.txt');
             shell.exec('touch ' + cmake);
         }
     },
     'header-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(source_el.attrib.src));
-            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(obj.src));
+            common.copyFile(plugin_dir, obj.src, project_dir, dest);
 
             var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
             var src = String(fs.readFileSync(plugins));
 
-            src = src.replace('INSERT_HEADER_HERE', '#include "plugins/' + plugin_id + '/' + path.basename(source_el.attrib.src) +'"\nINSERT_HEADER_HERE');
+            src = src.replace('INSERT_HEADER_HERE', '#include "plugins/' + plugin_id + '/' + path.basename(obj.src) +'"\nINSERT_HEADER_HERE');
             var class_name = plugin_id.match(/\.[^.]+$/)[0].substr(1);
             class_name = toCamelCase(class_name);
             src = src.replace('INSERT_PLUGIN_HERE', 'INIT_PLUGIN(' + class_name + ');INSERT_PLUGIN_HERE');
 
             fs.writeFileSync(plugins, src);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
-            shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
+            shell.rm(path.join(dest, path.basename(obj.src)));
 
             var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
             var src = String(fs.readFileSync(plugins));
 
-            src = src.replace('#include "plugins/' + plugin_id + '/' + path.basename(source_el.attrib.src) +'"', '');
+            src = src.replace('#include "plugins/' + plugin_id + '/' + path.basename(obj.src) +'"', '');
             var class_name = plugin_id.match(/\.[^.]+$/)[0].substr(1);
             class_name = toCamelCase(class_name);
             src = src.replace('INIT_PLUGIN(' + class_name + ');', '');
@@ -96,32 +96,32 @@ module.exports = {
         }
     },
     'resource-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
-            var dest = path.join('qml', path.basename(source_el.attrib.src));
-            if (source_el.attrib['target-dir'])
-                dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib.src));
-            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+            var dest = path.join('qml', path.basename(obj.src));
+            if (obj.targetDir)
+                dest = path.join(obj.targetDir, path.basename(obj.src));
+            common.copyFile(plugin_dir, obj.src, project_dir, dest);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             var dest = path.join(project_dir, 'qml');
-            if (source_el.attrib['target-dir'])
-                dest = path.join(project_dir, source_el.attrib['target-dir']);
-            shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
+            if (obj.targetDir)
+                dest = path.join(project_dir, obj.targetDir);
+            shell.rm(path.join(dest, path.basename(obj.src)));
         }
     },
     'framework': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.install is not supported for ubuntu');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.uninstall is not supported for ubuntu');
         }
     },
     'lib-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.install is not supported for ubuntu');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.uninstall is not supported for ubuntu');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/windows.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/windows.js b/cordova-lib/src/plugman/platforms/windows.js
index 30994af..b96ce1b 100644
--- a/cordova-lib/src/plugman/platforms/windows.js
+++ b/cordova-lib/src/plugman/platforms/windows.js
@@ -59,58 +59,58 @@ module.exports = {
         return new jsproj(path.join(project_dir, project_files[0]));
     },
     'source-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options, project_file) {
-            var targetDir = source_el.attrib['target-dir'] || '';
-            var dest = path.join('plugins', plugin_id, targetDir, path.basename(source_el.attrib['src']));
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
+            var targetDir = obj.targetDir || '';
+            var dest = path.join('plugins', plugin_id, targetDir, path.basename(obj.src));
 
-            common.copyNewFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
+            common.copyNewFile(plugin_dir, obj.src, project_dir, dest);
             // add reference to this file to jsproj.
             project_file.addSourceFile(dest);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options, project_file) {
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
             var dest = path.join('plugins', plugin_id,
-                                 source_el.attrib['target-dir'] || '',
-                                 path.basename(source_el.attrib['src']));
+                                 obj.targetDir || '',
+                                 path.basename(obj.src));
             common.removeFile(project_dir, dest);
             // remove reference to this file from csproj.
             project_file.removeSourceFile(dest);
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-fileinstall is not supported for Windows 8');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for Windows 8');
         }
     },
     'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options, project_file) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'resource-file is not supported for Windows 8');
         },
-        uninstall:function(el, project_dir, plugin_id, options, project_file) {
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
         }
     },
     'lib-file': {
-        install:function(el, plugin_dir, project_dir, plugin_id, options, project_file) {
-            var inc  = el.attrib['Include'];
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
+            var inc  = obj.Include;
             project_file.addSDKRef(inc);
         },
-        uninstall:function(el, project_dir, plugin_id, options, project_file) {
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'windows8 lib-file uninstall :: ' + plugin_id);
-            var inc = el.attrib['Include'];
+            var inc = obj.Include;
             project_file.removeSDKRef(inc);
         }
     },
     'framework': {
-        install:function(el, plugin_dir, project_dir, plugin_id, options, project_file) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'windows8 framework install :: ' + plugin_id);
 
-            var src = el.attrib['src'];
+            var src = obj.src;
             var dest = src; // if !isCustom, we will just add a reference to the file in place
             // technically it is not possible to get here without isCustom == true -jm
-            // var isCustom = el.attrib.custom == 'true';
-            var type = el.attrib['type'];
+            // var isCustom = obj.custom;
+            var type = obj.type;
 
             if(type == 'projectReference') {
                 project_file.addProjectReference(path.join(plugin_dir,src));
@@ -123,13 +123,13 @@ module.exports = {
             }
 
         },
-        uninstall:function(el, project_dir, plugin_id, options, project_file) {
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'windows8 framework uninstall :: ' + plugin_id  );
 
-            var src = el.attrib['src'];
+            var src = obj.src;
             // technically it is not possible to get here without isCustom == true -jm
-            // var isCustom = el.attrib.custom == 'true';
-            var type = el.attrib['type'];
+            // var isCustom = obj.custom;
+            var type = obj.type;
 
             if(type == 'projectReference') {
                 // unfortunately we have to generate the plugin_dir path because it is not passed to uninstall. Note

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/platforms/wp8.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/wp8.js b/cordova-lib/src/plugman/platforms/wp8.js
index a641feb..b097f41 100644
--- a/cordova-lib/src/plugman/platforms/wp8.js
+++ b/cordova-lib/src/plugman/platforms/wp8.js
@@ -46,43 +46,43 @@ module.exports = {
         return new csproj(path.join(project_dir, project_files[0]));
     },
     'source-file':{
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options, project_file) {
-            var dest = path.join('Plugins', plugin_id, source_el.attrib['target-dir'] ? source_el.attrib['target-dir'] : '', path.basename(source_el.attrib['src']));
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
+            var dest = path.join('Plugins', plugin_id, obj.targetDir ? obj.targetDir : '', path.basename(obj.src));
 
-            common.copyNewFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
+            common.copyNewFile(plugin_dir, obj.src, project_dir, dest);
             // add reference to this file to csproj.
             project_file.addSourceFile(dest);
         },
-        uninstall:function(source_el, project_dir, plugin_id, options, project_file) {
-            var dest = path.join('Plugins', plugin_id, source_el.attrib['target-dir'] ? source_el.attrib['target-dir'] : '', path.basename(source_el.attrib['src']));
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
+            var dest = path.join('Plugins', plugin_id, obj.targetDir ? obj.targetDir : '', path.basename(obj.src));
             common.removeFile(project_dir, dest);
             // remove reference to this file from csproj.
             project_file.removeSourceFile(dest);
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id, options) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.install is not supported for wp8');
         },
-        uninstall:function(source_el, project_dir, plugin_id, options) {
+        uninstall:function(obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for wp8');
         }
     },
     'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options, project_file) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'resource-file.install is not supported for wp8');
         },
-        uninstall:function(el, project_dir, plugin_id, options, project_file) {
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'resource-file.uninstall is not supported for wp8');
         }
     },
     'framework':{
-        install:function(el, plugin_dir, project_dir, plugin_id, options, project_file) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'wp8 framework install :: ' + plugin_id  );
 
-            var src = el.attrib['src'];
+            var src = obj.src;
             var dest = src; // if !isCustom, we will just add a reference to the file in place
-            var isCustom = el.attrib.custom == 'true';
+            var isCustom = obj.custom;
 
             if(isCustom) {
                 dest = path.join('plugins', plugin_id, path.basename(src));
@@ -92,11 +92,11 @@ module.exports = {
             project_file.addReference(dest);
 
         },
-        uninstall:function(el, project_dir, plugin_id, options, project_file) {
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'wp8 framework uninstall :: ' + plugin_id  );
 
-            var src = el.attrib['src'];
-            var isCustom = el.attrib.custom == 'true';
+            var src = obj.src;
+            var isCustom = obj.custom;
 
             if(isCustom) {
                 var dest = path.join('plugins', plugin_id);
@@ -107,14 +107,14 @@ module.exports = {
         }
     },
     'lib-file': {
-        install:function(el, plugin_dir, project_dir, plugin_id, options, project_file) {
+        install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'wp8 lib-file install :: ' + plugin_id);
-            var inc  = el.attrib['Include'];
+            var inc  = obj.Include;
             project_file.addSDKRef(inc);
         },
-        uninstall:function(el, project_dir, plugin_id, options, project_file) {
+        uninstall:function(obj, project_dir, plugin_id, options, project_file) {
             events.emit('verbose', 'wp8 lib-file uninstall :: ' + plugin_id);
-            var inc = el.attrib['Include'];
+            var inc = obj.Include;
             project_file.removeSDKRef(inc);
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/prepare-browserify.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare-browserify.js b/cordova-lib/src/plugman/prepare-browserify.js
index 58cf5b5..44234b1 100644
--- a/cordova-lib/src/plugman/prepare-browserify.js
+++ b/cordova-lib/src/plugman/prepare-browserify.js
@@ -152,7 +152,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
     uninstallQueuedPlugins(platformJson, www_dir);
 
     events.emit('verbose', 'Processing configuration changes for plugins.');
-    config_changes.process(plugins_dir, project_dir, platform, platformJson);
+    config_changes.process(plugins_dir, project_dir, platform, platformJson, pluginInfoProvider);
 
     if(!is_top_level) {
         return Q();
@@ -188,7 +188,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
 
             // Copy www assets described in <asset> tags.
             assets.forEach(function(asset) {
-                common.asset.install(asset.src, asset.target, pluginDir, wwwDir);
+                common.asset.install(asset, pluginDir, wwwDir);
             });
             jsModules.forEach(function(module) {
                 // Copy the plugin's files into the www directory.

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare.js b/cordova-lib/src/plugman/prepare.js
index 55d4bde..175153a 100644
--- a/cordova-lib/src/plugman/prepare.js
+++ b/cordova-lib/src/plugman/prepare.js
@@ -69,7 +69,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
     }
 
     events.emit('verbose', 'Processing configuration changes for plugins.');
-    config_changes.process(plugins_dir, project_dir, platform, platformJson);
+    config_changes.process(plugins_dir, project_dir, platform, platformJson, pluginInfoProvider);
 
     // This array holds all the metadata for each module and ends up in cordova_plugins.json
     var plugins = Object.keys(platformJson.root.installed_plugins).concat(Object.keys(platformJson.root.dependent_plugins));
@@ -95,7 +95,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
 
         // Copy www assets described in <asset> tags.
         assets.forEach(function(asset) {
-            common.asset.install(asset.src, asset.target, pluginDir, wwwDir);
+            common.asset.install(asset, pluginDir, wwwDir);
         });
 
         jsModules.forEach(function(module) {
@@ -134,7 +134,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
                 obj.clobbers = module.clobbers.map(function(o) { return o.target; });
             }
             if (module.merges.length > 0) {
-                obj.clobbers = module.merges.map(function(o) { return o.target; });
+                obj.merges = module.merges.map(function(o) { return o.target; });
             }
             if (module.runs.length > 0) {
                 obj.runs = true;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/registry/manifest.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/manifest.js b/cordova-lib/src/plugman/registry/manifest.js
index 13abe17..b994249 100644
--- a/cordova-lib/src/plugman/registry/manifest.js
+++ b/cordova-lib/src/plugman/registry/manifest.js
@@ -21,12 +21,13 @@
           indent:4, unused:vars, latedef:nofunc
 */
 
-var xml_helpers = require('../../util/xml-helpers'),
-    path = require('path'),
+var path = require('path'),
     Q = require('q'),
     fs = require('fs'),
     whitelist = require('./whitelist');
 
+var PluginInfo = require('../../PluginInfo');
+
 function validateName(name) {
     if (!name.match(/^(\S+\.){2,}.*$/)) {
         throw new Error('Invalid plugin ID. It has to follow the reverse domain `com.domain.plugin` format');
@@ -39,37 +40,26 @@ function validateName(name) {
     return true;
 }
 
-// Java world big-up!
 // Returns a promise.
 function generatePackageJsonFromPluginXml(plugin_path) {
     return Q().then(function() {
         var package_json = {};
-        var pluginXml = xml_helpers.parseElementtreeSync(path.join(plugin_path, 'plugin.xml'));
-
-        if(!pluginXml) throw new Error('invalid plugin.xml document');
-
-        var pluginElm = pluginXml.getroot();
-
-        if(!pluginElm) throw new Error('invalid plugin.xml document');
+        var pluginInfo = new PluginInfo(plugin_path);
 
         // REQUIRED: name, version
         // OPTIONAL: description, license, keywords, engine
-        var name = pluginElm.attrib.id,
-            version = pluginElm.attrib.version,
-            cordova_name = pluginElm.findtext('name'),
-            description = pluginElm.findtext('description'),
-            license = pluginElm.findtext('license'),
-            keywords = pluginElm.findtext('keywords'),
-            repo = pluginElm.findtext('repo'),
-            issue = pluginElm.findtext('issue'),
-            engines = pluginElm.findall('engines/engine'),
-            platformsElm = pluginElm.findall('platform'),
-            englishdoc = '',
-            platforms = [];
-
-        platformsElm.forEach(function(plat){
-            platforms.push(plat.attrib.name);
-        });
+        var name = pluginInfo.id,
+            version = pluginInfo.version,
+            cordova_name = pluginInfo.name,
+            description = pluginInfo.description,
+            license = pluginInfo.license,
+            keywords = pluginInfo.keywords,
+            repo = pluginInfo.repo,
+            issue = pluginInfo.issue,
+            engines = pluginInfo.getEngines(),
+            platforms = pluginInfo.getPlatforms(),
+            englishdoc = '';
+
         if(!version) throw new Error('`version` required');
 
         package_json.version = version;
@@ -86,14 +76,17 @@ function generatePackageJsonFromPluginXml(plugin_path) {
         if(repo)         package_json.repo         = repo;
         if(issue)        package_json.issue        = issue;
         if(keywords)     package_json.keywords     = keywords.split(',');
-        if(platforms)    package_json.platforms    = platforms;
+        if(platforms) {
+            package_json.platforms = platforms.map(function(p) {
+                return p.name;
+            });
+        }
 
         // Adding engines
         if(engines) {
-            package_json.engines = [];
-            for(var i = 0, j = engines.length ; i < j ; i++) {
-                package_json.engines.push({name: engines[i].attrib.name, version: engines[i].attrib.version});
-            }
+            package_json.engines = engines.map(function(e) {
+                return {name: e.name, version: e.version};
+            });
         }
 
         // Set docs_path to doc/index.md exists

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/15adc1b9/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index dc3148f..05d5b07 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -25,7 +25,6 @@
 var path = require('path'),
     fs   = require('fs'),
     shell= require('shelljs'),
-    xml_helpers = require('../util/xml-helpers'),
     action_stack = require('./util/action-stack'),
     dependencies = require('./util/dependencies'),
     CordovaError  = require('../CordovaError'),
@@ -50,11 +49,10 @@ function uninstall(platform, project_dir, id, plugins_dir, options) {
     options.pluginInfoProvider = options.pluginInfoProvider || new PluginInfoProvider();
     plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
 
-    // Allow path to file to grab an ID
+    // Allow `id` to be a path to a file.
     var xml_path = path.join(id, 'plugin.xml');
     if ( fs.existsSync(xml_path) ) {
-        var plugin_et  = xml_helpers.parseElementtreeSync(xml_path);
-        id = plugin_et._root.attrib['id'];
+        id = options.pluginInfoProvider.get(id).id;
     }
 
     return module.exports.uninstallPlatform(platform, project_dir, id, plugins_dir, options)
@@ -87,6 +85,8 @@ module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_d
 // Returns a promise.
 module.exports.uninstallPlugin = function(id, plugins_dir, options) {
     options = options || {};
+    options.pluginInfoProvider = options.pluginInfoProvider || new PluginInfoProvider();
+    var pluginInfoProvider = options.pluginInfoProvider;
 
     var plugin_dir = path.join(plugins_dir, id);
 
@@ -99,8 +99,6 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
         return Q();
     }
 
-   // var xml_path  = path.join(plugin_dir, 'plugin.xml'), plugin_et = xml_helpers.parseElementtreeSync(xml_path);
-
     var doDelete = function(id) {
         var plugin_dir = path.join(plugins_dir, id);
         if ( !fs.existsSync(plugin_dir) ) {
@@ -127,12 +125,13 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
             events.emit('verbose', 'Plugin "'+ pluginId +'" does not exist ('+ depPluginDir +')');
             return;
         }
-        var config = xml_helpers.parseElementtreeSync(path.join(depPluginDir, 'plugin.xml')),
-            deps = config.findall('.//dependency').map(function (p) { return p.attrib.id; });
+        var pluginInfo = pluginInfoProvider.get(depPluginDir);
+        // TODO: Should remove dependencies in a separate step, since dependencies depend on platform.
+        var deps = pluginInfo.getDependencies();
         deps.forEach(function (d) {
-            if (toDelete.indexOf(d) === -1) {
-                toDelete.push(d);
-                findDependencies(d);
+            if (toDelete.indexOf(d.id) === -1) {
+                toDelete.push(d.id);
+                findDependencies(d.id);
             }
         });
     }
@@ -149,7 +148,7 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
     var dependList = {};
     platforms.forEach(function(platform) {
         var platformJson = PlatformJson.load(plugins_dir, platform);
-        var depsInfo = dependencies.generateDependencyInfo(platformJson, plugins_dir);
+        var depsInfo = dependencies.generateDependencyInfo(platformJson, plugins_dir, pluginInfoProvider);
         var tlps = depsInfo.top_level_plugins;
         var deps;
 
@@ -164,7 +163,7 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
         });
 
         toDelete.forEach(function(plugin) {
-            deps = dependencies.dependents(plugin, depsInfo, platformJson);
+            deps = dependencies.dependents(plugin, depsInfo, platformJson, pluginInfoProvider);
 
             var i = deps.indexOf(top_plugin_id);
             if(i >= 0)
@@ -206,21 +205,21 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
 // possible options: cli_variables, www_dir, is_top_level
 // Returns a promise
 function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugins_dir, options) {
+    var pluginInfoProvider = options.pluginInfoProvider;
     // If this plugin is not really installed, return (CB-7004).
     if (!fs.existsSync(plugin_dir)) {
         return Q();
     }
 
-    var xml_path     = path.join(plugin_dir, 'plugin.xml');
-    var plugin_et    = xml_helpers.parseElementtreeSync(xml_path);
-    var plugin_id    = plugin_et._root.attrib['id'];
+    var pluginInfo = pluginInfoProvider.get(plugin_dir);
+    var plugin_id = pluginInfo.id;
 
     // Deps info can be passed recusively
     var platformJson = PlatformJson.load(plugins_dir, platform);
-    var depsInfo = options.depsInfo || dependencies.generateDependencyInfo(platformJson, plugins_dir);
+    var depsInfo = options.depsInfo || dependencies.generateDependencyInfo(platformJson, plugins_dir, pluginInfoProvider);
 
     // Check that this plugin has no dependents.
-    var dependents = dependencies.dependents(plugin_id, depsInfo, platformJson);
+    var dependents = dependencies.dependents(plugin_id, depsInfo, platformJson, pluginInfoProvider);
 
     if(options.is_top_level && dependents && dependents.length > 0) {
         var msg = 'The plugin \'' + plugin_id + '\' is required by (' + dependents.join(', ') + ')';
@@ -233,7 +232,7 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
 
     // Check how many dangling dependencies this plugin has.
     var deps = depsInfo.graph.getChain(plugin_id);
-    var danglers = dependencies.danglers(plugin_id, depsInfo, platformJson);
+    var danglers = dependencies.danglers(plugin_id, depsInfo, platformJson, pluginInfoProvider);
 
     var promise;
     if (deps && deps.length && danglers && danglers.length) {
@@ -241,7 +240,7 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
         // @tests - important this event is checked spec/uninstall.spec.js
         events.emit('log', 'Uninstalling ' + danglers.length + ' dependent plugins.');
         promise = promiseutil.Q_chainmap(danglers, function(dangler) {
-            var dependent_path = dependencies.resolvePath(dangler, plugins_dir);
+            var dependent_path = path.join(plugins_dir, dangler);
 
             var opts = underscore.extend({}, options, {
                 is_top_level: depsInfo.top_level_plugins.indexOf(dangler) > -1,
@@ -257,8 +256,6 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
     var projectRoot = cordovaUtil.isCordova();
 
     if(projectRoot) {
-        // TODO: May want to use pluginInfoProvider, but there's not much caching value.
-        var pluginInfo = options.pluginInfoProvider.get(plugin_dir);
 
         // using unified hooksRunner
         var hooksRunnerOptions = {
@@ -276,79 +273,74 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
         return promise.then(function() {
             return hooksRunner.fire('before_plugin_uninstall', hooksRunnerOptions);
         }).then(function() {
-            return handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, options.www_dir, plugins_dir, plugin_dir, options.is_top_level, options);
+            return handleUninstall(actions, platform, pluginInfo, project_dir, options.www_dir, plugins_dir, options.is_top_level, options);
         });
     } else {
         // TODO: Need review here - this condition added for plugman install.spec.js and uninstall.spec.js passing -
         // where should we get projectRoot - via going up from project_dir?
-        return handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, options.www_dir, plugins_dir, plugin_dir, options.is_top_level, options);
+        return handleUninstall(actions, platform, pluginInfo, project_dir, options.www_dir, plugins_dir, options.is_top_level, options);
     }
 }
 
 // Returns a promise.
-function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, www_dir, plugins_dir, plugin_dir, is_top_level, options) {
+function handleUninstall(actions, platform, pluginInfo, project_dir, www_dir, plugins_dir, is_top_level, options) {
+    var plugin_id = pluginInfo.id;
+    var plugin_dir = pluginInfo.dir;
     var platform_modules = require('./platforms');
     var handler = platform_modules[platform];
-    var platformTag = plugin_et.find('./platform[@name="'+platform+'"]');
-    // CB-6976 Windows Universal Apps. For smooth transition and to prevent mass api failures
-    // we allow using windows8 tag for new windows platform
-    if (platform == 'windows' && !platformTag) {
-        platformTag = plugin_et.find('platform[@name="' + 'windows8' + '"]');
-    }
     www_dir = www_dir || handler.www_dir(project_dir);
     events.emit('log', 'Uninstalling ' + plugin_id + ' from ' + platform);
 
-    var assets = plugin_et.findall('./asset');
-    if (platformTag) {
-        var sourceFiles = platformTag.findall('./source-file'),
-            headerFiles = platformTag.findall('./header-file'),
-            libFiles = platformTag.findall('./lib-file'),
-            resourceFiles = platformTag.findall('./resource-file'),
-            frameworkFiles = platformTag.findall('./framework[@custom="true"]');
-        assets = assets.concat(platformTag.findall('./asset'));
-
-        // queue up native stuff
-        sourceFiles && sourceFiles.forEach(function(source) {
-            actions.push(actions.createAction(handler['source-file'].uninstall,
-                                             [source, project_dir, plugin_id, options],
-                                             handler['source-file'].install,
-                                             [source, plugin_dir, project_dir, plugin_id, options]));
-        });
+    var assets = pluginInfo.getAssets(platform);
+    var sourceFiles = pluginInfo.getSourceFiles(platform);
+    var headerFiles = pluginInfo.getHeaderFiles(platform);
+    var libFiles = pluginInfo.getLibFiles(platform);
+    var resourceFiles = pluginInfo.getResourceFiles(platform);
+    var frameworkFiles = pluginInfo.getFrameworks(platform);
+
+    // queue up native stuff
+    sourceFiles.forEach(function(source) {
+        actions.push(actions.createAction(handler['source-file'].uninstall,
+                                         [source, project_dir, plugin_id, options],
+                                         handler['source-file'].install,
+                                         [source, plugin_dir, project_dir, plugin_id, options]));
+    });
 
-        headerFiles && headerFiles.forEach(function(header) {
-            actions.push(actions.createAction(handler['header-file'].uninstall,
-                                             [header, project_dir, plugin_id, options],
-                                             handler['header-file'].install,
-                                             [header, plugin_dir, project_dir, plugin_id, options]));
-        });
+    headerFiles.forEach(function(header) {
+        actions.push(actions.createAction(handler['header-file'].uninstall,
+                                         [header, project_dir, plugin_id, options],
+                                         handler['header-file'].install,
+                                         [header, plugin_dir, project_dir, plugin_id, options]));
+    });
 
-        resourceFiles && resourceFiles.forEach(function(resource) {
-            actions.push(actions.createAction(handler['resource-file'].uninstall,
-                                              [resource, project_dir, plugin_id, options],
-                                              handler['resource-file'].install,
-                                              [resource, plugin_dir, project_dir, options]));
-        });
+    resourceFiles.forEach(function(resource) {
+        actions.push(actions.createAction(handler['resource-file'].uninstall,
+                                          [resource, project_dir, plugin_id, options],
+                                          handler['resource-file'].install,
+                                          [resource, plugin_dir, project_dir, options]));
+    });
 
-        // CB-5238 custom frameworks only
-        frameworkFiles && frameworkFiles.forEach(function(framework) {
+    // CB-5238 custom frameworks only
+    frameworkFiles.forEach(function(framework) {
+        if (framework.custom) {
             actions.push(actions.createAction(handler['framework'].uninstall,
                                               [framework, project_dir, plugin_id, options],
                                               handler['framework'].install,
                                               [framework, plugin_dir, project_dir, options]));
-        });
+        }
+    });
 
-        libFiles && libFiles.forEach(function(source) {
-            actions.push(actions.createAction(handler['lib-file'].uninstall,
-                                              [source, project_dir, plugin_id, options],
-                                              handler['lib-file'].install,
-                                              [source, plugin_dir, project_dir, plugin_id, options]));
-        });
-    }
+    libFiles.forEach(function(libFile) {
+        actions.push(actions.createAction(handler['lib-file'].uninstall,
+                                          [libFile, project_dir, plugin_id, options],
+                                          handler['lib-file'].install,
+                                          [libFile, plugin_dir, project_dir, plugin_id, options]));
+    });
 
     // queue up asset installation
     var common = require('./platforms/common');
-    assets && assets.forEach(function(asset) {
-        actions.push(actions.createAction(common.asset.uninstall, [asset.attrib.src, asset.attrib.target, www_dir, plugin_id], common.asset.install, [asset, plugin_dir, www_dir]));
+    assets.forEach(function(asset) {
+        actions.push(actions.createAction(common.asset.uninstall, [asset, www_dir, plugin_id], common.asset.install, [asset, plugin_dir, www_dir]));
     });
 
     // run through the action stack


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


Mime
View raw message