You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2015/02/13 01:53:57 UTC

[01/12] cordova-lib git commit: CB-8123 Plugin references can target specific windows platforms.

Repository: cordova-lib
Updated Branches:
  refs/heads/CB-8416 e539aa5da -> f37d6a6f1


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/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 c601bd0..07186cb 100644
--- a/cordova-lib/src/plugman/platforms/windows.js
+++ b/cordova-lib/src/plugman/platforms/windows.js
@@ -15,21 +15,25 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
-/* jshint laxcomma:true, sub:true */
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true, sub:true
+ */
 
 var common = require('./common'),
     path = require('path'),
     fs   = require('fs'),
     glob = require('glob'),
-    jsproj = require('../../util/windows/jsproj'),
+    jsprojManager = require('../../util/windows/jsproj'),
     events = require('../../events'),
     xml_helpers = require('../../util/xml-helpers');
 
 module.exports = {
     platformName: 'windows',
     InvalidProjectPathError: 'does not appear to be a Windows 8 or Unified Windows Store project (no .projitems|jsproj file)',
+
     www_dir:function(project_dir) {
         return path.join(project_dir, 'www');
     },
@@ -53,7 +57,7 @@ module.exports = {
                 throw new Error(this.InvalidProjectPathError);
             }
         }
-        return new jsproj(path.join(project_dir, project_files[0]));
+        return new jsprojManager(path.join(project_dir, project_files[0]));
     },
     'source-file': {
         install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
@@ -66,8 +70,8 @@ module.exports = {
         },
         uninstall:function(obj, project_dir, plugin_id, options, project_file) {
             var dest = path.join('plugins', plugin_id,
-                                 obj.targetDir || '',
-                                 path.basename(obj.src));
+                obj.targetDir || '',
+                path.basename(obj.src));
             common.removeFile(project_dir, dest);
             // remove reference to this file from csproj.
             project_file.removeSourceFile(dest);
@@ -75,33 +79,33 @@ module.exports = {
     },
     'header-file': {
         install:function(obj, plugin_dir, project_dir, plugin_id, options) {
-            events.emit('verbose', 'header-fileinstall is not supported for Windows 8');
+            events.emit('verbose', 'header-file.install is not supported for Windows');
         },
         uninstall:function(obj, project_dir, plugin_id, options) {
-            events.emit('verbose', 'header-file.uninstall is not supported for Windows 8');
+            events.emit('verbose', 'header-file.uninstall is not supported for Windows');
         }
     },
     'resource-file':{
         install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
-            events.emit('verbose', 'resource-file is not supported for Windows 8');
+            events.emit('verbose', 'resource-file is not supported for Windows');
         },
         uninstall:function(obj, project_dir, plugin_id, options, project_file) {
         }
     },
     'lib-file': {
         install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
-            var inc  = obj.Include;
-            project_file.addSDKRef(inc);
+            var inc  = obj.Include || obj.src;
+            project_file.addSDKRef(inc, getTargetConditions(obj));
         },
         uninstall:function(obj, project_dir, plugin_id, options, project_file) {
-            events.emit('verbose', 'windows8 lib-file uninstall :: ' + plugin_id);
-            var inc = obj.Include;
-            project_file.removeSDKRef(inc);
+            events.emit('verbose', 'windows lib-file uninstall :: ' + plugin_id);
+            var inc = obj.Include || obj.src;
+            project_file.removeSDKRef(inc, getTargetConditions(obj));
         }
     },
     'framework': {
         install:function(obj, plugin_dir, project_dir, plugin_id, options, project_file) {
-            events.emit('verbose', 'windows8 framework install :: ' + plugin_id);
+            events.emit('verbose', 'windows framework install :: ' + plugin_id);
 
             var src = obj.src;
             var dest = src; // if !isCustom, we will just add a reference to the file in place
@@ -109,38 +113,42 @@ module.exports = {
             // var isCustom = obj.custom;
             var type = obj.type;
 
-            if(type == 'projectReference') {
-                project_file.addProjectReference(path.join(plugin_dir,src));
+            if(type === 'projectReference') {
+                project_file.addProjectReference(path.join(plugin_dir,src), getTargetConditions(obj));
             }
             else {
                 // if(isCustom) {}
                 dest = path.join('plugins', plugin_id, path.basename(src));
                 common.copyFile(plugin_dir, src, project_dir, dest);
-                project_file.addReference(dest, src);
+                project_file.addReference(dest, getTargetConditions(obj));
             }
 
         },
         uninstall:function(obj, project_dir, plugin_id, options, project_file) {
-            events.emit('verbose', 'windows8 framework uninstall :: ' + plugin_id  );
+            events.emit('verbose', 'windows framework uninstall :: ' + plugin_id  );
 
             var src = obj.src;
             // technically it is not possible to get here without isCustom == true -jm
             // var isCustom = obj.custom;
             var type = obj.type;
 
-            if(type == 'projectReference') {
+            if(type === 'projectReference') {
                 // unfortunately we have to generate the plugin_dir path because it is not passed to uninstall. Note
                 // that project_dir is the windows project directory ([project]\platforms\windows) - we need to get to
                 // [project]\plugins\[plugin_id]
                 var plugin_dir = path.join(project_dir, '..', '..', 'plugins', plugin_id, src);
-                project_file.removeProjectReference(plugin_dir);
+                project_file.removeProjectReference(plugin_dir, getTargetConditions(obj));
             }
             else {
                 // if(isCustom) {  }
                 var targetPath = path.join('plugins', plugin_id);
                 common.removeFile(project_dir, targetPath);
-                project_file.removeReference(src);
+                project_file.removeReference(src, getTargetConditions(obj));
             }
         }
     }
 };
+
+function getTargetConditions(obj) {
+    return {versions: obj.versions, target: obj.target, arch: obj.arch};
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/src/util/windows/jsproj.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsproj.js b/cordova-lib/src/util/windows/jsproj.js
index fd23c49..57642ba 100644
--- a/cordova-lib/src/util/windows/jsproj.js
+++ b/cordova-lib/src/util/windows/jsproj.js
@@ -1,35 +1,38 @@
 /**
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-*/
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
 
 /* jshint quotmark:false, unused:false */
 
 /*
-  Helper for dealing with Windows Store JS app .jsproj files
-*/
+ Helper for dealing with Windows Store JS app .jsproj files
+ */
 
 
-var xml_helpers = require('../../util/xml-helpers'),
+var util = require('util'),
+    xml_helpers = require('../../util/xml-helpers'),
     et = require('elementtree'),
     fs = require('fs'),
+    glob = require('glob'),
     shell = require('shelljs'),
     events = require('../../events'),
-    path = require('path');
+    path = require('path'),
+    semver = require('semver');
 
 var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  // .csproj
 var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";  // .vcxproj
@@ -40,138 +43,91 @@ var JsProjectRegEx = /(Project\("\{262852C6-CD72-467D-83FE-5EEB1973A190}"\)\s*=\
 // Chars in a string that need to be escaped when used in a RegExp
 var RegExpEscRegExp = /([.?*+\^$\[\]\\(){}|\-])/g;
 
-function jsproj(location) {
-    if (!location) {
-        throw new Error('Project file location can\'t be null or empty' );
-    }
-    events.emit('verbose','creating jsproj from project at : ' + location);
-    this.location = location;
-    this.xml = xml_helpers.parseElementtreeSync(location);
-    // Detect universal Windows app project template
-    this.isUniversalWindowsApp = location.match(/\.(projitems|shproj)$/i);
-    return this;
+function jsprojManager(location) {
+    this.isUniversalWindowsApp = path.extname(location).toLowerCase() === ".projitems";
+    this.projects = [];
+    this.master = this.isUniversalWindowsApp ? new proj(location) : new jsproj(location);
+    this.projectFolder = path.dirname(location);
+
 }
 
-jsproj.prototype = {
-    location:null,
-    xml:null,
-    plugins_dir:"Plugins",
-    write:function() {
-        fs.writeFileSync(this.location, this.xml.write({indent:4}), 'utf-8');
+jsprojManager.prototype = {
+    _projects: null,
+
+    write: function () {
+        this.master.write();
+        if (this._projects) {
+            var that = this;
+            this._projects.forEach(function (project) {
+                if (project !== that.master && project.touched) {
+                    project.write();
+                }
+            });
+        }
     },
 
-    // add/remove the item group for SDKReference
-    // example :
-    // <ItemGroup><SDKReference Include="Microsoft.VCLibs, version=12.0" /></ItemGroup>
-    addSDKRef:function(incText) {
-        var item_group = new et.Element('ItemGroup');
-        var elem = new et.Element('SDKReference');
-        elem.attrib.Include = incText;
-
-        item_group.append(elem);
-        this.xml.getroot().append(item_group);
-    },
+    addSDKRef: function (incText, targetConditions) {
+        events.emit('verbose', 'jsprojManager.addSDKRef(incText: ' + incText + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
-    removeSDKRef:function(incText) {
-        var item_group = this.xml.find('ItemGroup/SDKReference[@Include="' + incText + '"]/..');
-        if(item_group) { // TODO: error handling
-            this.xml.getroot().remove(0, item_group);
-        }
+        var item = createReferenceElement('ItemGroup/SDKReference', incText, targetConditions);
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.appendToRoot(item);
+        });
     },
 
-    addReference:function(relPath) {
-        events.emit('verbose','addReference::' + relPath);
+    removeSDKRef: function (incText, targetConditions) {
+        events.emit('verbose', 'jsprojManager.removeSDKRef(incText: ' + incText + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
-        var item = new et.Element('ItemGroup');
-        var extName = path.extname(relPath);
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.removeReferenceElementItemGroup('ItemGroup/SDKReference', incText, targetConditions);
+        });
+    },
 
-        var elem = new et.Element('Reference');
-        // add file name
-        elem.attrib.Include = path.basename(relPath, extName);
+    addReference: function (relPath, targetConditions) {
+        events.emit('verbose', 'jsprojManager.addReference(incText: ' + relPath + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
         // add hint path with full path
         var hint_path = new et.Element('HintPath');
         hint_path.text = relPath;
+        var children = [hint_path];
 
-        elem.append(hint_path);
-
-        if(extName == ".winmd") {
+        var extName = path.extname(relPath);
+        if (extName === ".winmd") {
             var mdFileTag = new et.Element("IsWinMDFile");
             mdFileTag.text = "true";
-            elem.append(mdFileTag);
+            children.push(mdFileTag);
         }
 
-        item.append(elem);
-        this.xml.getroot().append(item);
-    },
-
-    removeReference:function(relPath) {
-        events.emit('verbose','removeReference::' + relPath);
-
-        var extName = path.extname(relPath);
-        var includeText = path.basename(relPath,extName);
-        // <ItemGroup>
-        //   <Reference Include="WindowsRuntimeComponent1">
-        var item_group = this.xml.find('ItemGroup/Reference[@Include="' + includeText + '"]/..');
+        var item = createReferenceElement('ItemGroup/Reference', path.basename(relPath, extName), targetConditions, children);
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.appendToRoot(item);
+        });
 
-        if(item_group) { // TODO: erro handling
-            this.xml.getroot().remove(0, item_group);
-        }
     },
 
-    addSourceFile:function(relative_path) {
-        // we allow multiple paths to be passed at once as array so that
-        // we don't create separate ItemGroup for each source file, CB-6874
-        if (!(relative_path instanceof Array)) {
-            relative_path = [relative_path];
-        }
-        // make ItemGroup to hold file.
-        var item = new et.Element('ItemGroup');
+    removeReference: function (relPath, targetConditions) {
+        events.emit('verbose', 'jsprojManager.removeReference(incText: ' + relPath + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
-        relative_path.forEach(function(filePath) {
-            filePath = filePath.split('/').join('\\');
+        var extName = path.extname(relPath);
+        var includeText = path.basename(relPath, extName);
 
-            var content = new et.Element('Content');
-            content.attrib.Include = filePath;
-            item.append(content);
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.removeReferenceElementItemGroup('ItemGroup/Reference', includeText, targetConditions);
         });
-        this.xml.getroot().append(item);
     },
 
-    removeSourceFile: function(relative_path) {
-        var isRegexp = relative_path instanceof RegExp;
-        if (!isRegexp) {
-            // path.normalize(relative_path);// ??
-            relative_path = relative_path.split('/').join('\\');
-        }
-
-        var root = this.xml.getroot();
-        // iterate through all ItemGroup/Content elements and remove all items matched
-        this.xml.findall('ItemGroup').forEach(function(group){
-            // matched files in current ItemGroup
-            var filesToRemove = group.findall('Content').filter(function(item) {
-                if (!item.attrib.Include) return false;
-                return isRegexp ? item.attrib.Include.match(relative_path) :
-                    item.attrib.Include == relative_path;
-            });
-
-            // nothing to remove, skip..
-            if (filesToRemove.length < 1) return;
+    addSourceFile: function (relative_path) {
+        events.emit('verbose', 'jsprojManager.addSourceFile(relative_path: ' + relative_path + ')');
+        this.master.addSourceFile(relative_path);
+    },
 
-            filesToRemove.forEach(function(file) {
-                // remove file reference
-                group.remove(0, file);
-            });
-            // remove ItemGroup if empty
-            if(group.findall('*').length < 1) {
-                root.remove(0, group);
-            }
-        });
+    removeSourceFile: function (relative_path) {
+        events.emit('verbose', 'jsprojManager.removeSourceFile(incText: ' + relative_path + ')');
+        this.master.removeSourceFile(relative_path);
     },
 
-    // relative path must include the project file, so we can determine .csproj, .jsproj, .vcxproj...
-    addProjectReference: function (relative_path) {
-        events.emit('verbose', 'adding project reference to ' + relative_path);
+    addProjectReference: function (relative_path, targetConditions) {
+        events.emit('verbose', 'jsprojManager.addProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
         relative_path = relative_path.split('/').join('\\');
 
@@ -194,19 +150,37 @@ jsproj.prototype = {
             projName + '", "' + relative_path + '", ' +
             '"' + projectGuid + '"\r\nEndProject';
 
-        // There may be multiple solutions (for different VS versions) - process them all
-        getSolutionPaths(this.location).forEach(function (solutionPath) {
-            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
+        var matchingProjects = this._getMatchingProjects(targetConditions);
+        if (matchingProjects.length === 0) {
+            // No projects meet the specified target and version criteria, so nothing to do.
+            return;
+        }
 
-            // Insert a project dependency into each jsproj in the solution.
-            var jsProjectFound = false;
-            solText = solText.replace(JsProjectRegEx, function (match) {
-                jsProjectFound = true;
-                return match + preInsertText;
-            });
+        // Will we be writing into the .projitems file rather than individual .jsproj files?
+        var useProjItems = this.isUniversalWindowsApp && matchingProjects.length === 1 && matchingProjects[0] === this.master;
+
+        // There may be multiple solution files (for different VS versions) - process them all
+        getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
+            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
 
-            if (!jsProjectFound) {
-                throw new Error("no jsproj found in solution");
+            if (useProjItems) {
+                // Insert a project dependency into every jsproj in the solution.
+                var jsProjectFound = false;
+                solText = solText.replace(JsProjectRegEx, function (match) {
+                    jsProjectFound = true;
+                    return match + preInsertText;
+                });
+
+                if (!jsProjectFound) {
+                    throw new Error("no jsproj found in solution");
+                }
+            } else {
+                // Insert a project dependency only for projects that match specified target and version
+                matchingProjects.forEach(function (project) {
+                    solText = solText.replace(getJsProjRegExForProject(path.basename(project.location)), function (match) {
+                        return match + preInsertText;
+                    });
+                });
             }
 
             // Add the project after existing projects. Note that this fairly simplistic check should be fine, since the last
@@ -221,17 +195,16 @@ jsproj.prototype = {
             fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
         });
 
-        // Add the ItemGroup/ProjectReference to the cordova project :
+        // Add the ItemGroup/ProjectReference to each matching cordova project :
         // <ItemGroup><ProjectReference Include="blahblah.csproj"/></ItemGroup>
-        var item = new et.Element('ItemGroup');
-        var projRef = new et.Element('ProjectReference');
-        projRef.attrib.Include = relative_path;
-        item.append(projRef);
-        this.xml.getroot().append(item);
+        var item = createReferenceElement('ItemGroup/ProjectReference', relative_path, targetConditions);
+        matchingProjects.forEach(function (project) {
+            project.appendToRoot(item);
+        });
     },
 
-    removeProjectReference: function (relative_path) {
-        events.emit('verbose', 'removing project reference to ' + relative_path);
+    removeProjectReference: function (relative_path, targetConditions) {
+        events.emit('verbose', 'jsprojManager.removeProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
         // find the guid + name of the referenced project
         var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
@@ -248,7 +221,7 @@ jsproj.prototype = {
         var postInsertTextRegExp = getProjectReferencePostInsertRegExp(projName, projectGuid, relative_path, projectTypeGuid);
 
         // There may be multiple solutions (for different VS versions) - process them all
-        getSolutionPaths(this.location).forEach(function (solutionPath) {
+        getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
             var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
 
             // To be safe (to handle subtle changes in formatting, for example), use a RegExp to find and remove
@@ -265,12 +238,50 @@ jsproj.prototype = {
             fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
         });
 
-        // select first ItemsGroups with a ChildNode ProjectReference
-        // ideally select all, and look for @attrib 'Include'= projectFullPath
-        var projectRefNodesPar = this.xml.find("ItemGroup/ProjectReference[@Include='" + relative_path + "']/..");
-        if (projectRefNodesPar) {
-            this.xml.getroot().remove(0, projectRefNodesPar);
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.removeReferenceElementItemGroup('ItemGroup/ProjectReference', relative_path, targetConditions);
+        });
+    },
+
+    _getMatchingProjects: function (targetConditions) {
+        // If specified, target can be 'all' (default), 'phone' or 'windows'. Ultimately should probably allow a comma
+        // separated list, but not needed now.
+        var target = getTarget(targetConditions);
+        var versions = getVersions(targetConditions);
+
+        if (target || versions) {
+            var matchingProjects = this.projects.filter(function (project) {
+                return (!target || target === project.target) && (!versions || semver.satisfies(project.version, versions, /* loose */ true));
+            });
+
+            if (matchingProjects.length < this.projects.length) {
+                return matchingProjects;
+            }
         }
+
+        // All projects match. If this is a universal project, return the projitems file. Otherwise return our single
+        // project.
+        return [this.master];
+    },
+
+    get projects() {
+        var projects = this._projects;
+        if (!projects) {
+            projects = [];
+            this._projects = projects;
+
+            if (this.isUniversalWindowsApp) {
+                var projectPath = this.projectFolder;
+                var projectFiles = glob.sync('*.jsproj', {cwd: projectPath});
+                projectFiles.forEach(function (projectFile) {
+                    projects.push(new jsproj(path.join(projectPath, projectFile)));
+                });
+            } else {
+                this.projects.push(this.master);
+            }
+        }
+
+        return projects;
     }
 };
 
@@ -287,14 +298,19 @@ function getProjectReferencePostInsertRegExp(projName, projectGuid, relative_pat
     return new RegExp('\\s*Project\\("' + projectTypeGuid + '"\\)\\s*=\\s*"' + projName + '"\\s*,\\s*"' + relative_path + '"\\s*,\\s*"' + projectGuid + '"\\s*EndProject', 'gi');
 }
 
-function getSolutionPaths(jsprojLocation) {
-    return shell.ls(path.join(path.dirname(jsprojLocation), "*.sln")); // TODO:error handling
+function getSolutionPaths(projectFolder) {
+    return shell.ls(path.join(projectFolder, "*.sln")); // TODO:error handling
 }
 
 function escapeRegExpString(regExpString) {
     return regExpString.replace(RegExpEscRegExp, "\\$1");
 }
 
+function getJsProjRegExForProject(projectFile) {
+    projectFile = escapeRegExpString(projectFile);
+    return new RegExp('(Project\\("\\{262852C6-CD72-467D-83FE-5EEB1973A190}"\\)\\s*=\\s*"[^"]+",\\s*"' + projectFile + '",\\s*"\\{[0-9a-f\\-]+}"[^\\r\\n]*[\\r\\n]*)', 'gi');
+}
+
 function getProjectTypeGuid(projectPath) {
     switch (path.extname(projectPath)) {
         case ".vcxproj":
@@ -306,4 +322,212 @@ function getProjectTypeGuid(projectPath) {
     return null;
 }
 
-module.exports = jsproj;
+function createReferenceElement(path, incText, targetConditions, children) {
+    path = path.split('/');
+    path.reverse();
+
+    var lastElement = null;
+    path.forEach(function (elementName) {
+        var element = new et.Element(elementName);
+        if (lastElement) {
+            element.append(lastElement);
+        } else {
+            element.attrib.Include = incText;
+
+            var condition = createConditionAttrib(targetConditions);
+            if (condition) {
+                element.attrib.Condition = condition;
+            }
+
+            if (children) {
+                children.forEach(function (child) {
+                    element.append(child);
+                });
+            }
+        }
+        lastElement = element;
+    });
+
+    return lastElement;
+}
+
+function getTarget(targetConditions) {
+    var target = targetConditions.target;
+    if (target) {
+        target = target.toLowerCase().trim();
+        if (target === "all") {
+            target = null;
+        } else if (target === "win") {
+            // Allow "win" as alternative to "windows"
+            target = "windows";
+        } else if (target !== 'phone' && target !== 'windows') {
+            throw new Error('Invalid lib-file target attribute (must be "all", "phone", "windows" or "win"): ' + target);
+        }
+    }
+    return target;
+}
+
+function getVersions(targetConditions) {
+    var versions = targetConditions.versions;
+    if (versions && !semver.validRange(versions, /* loose */ true)) {
+        throw new Error('Invalid lib-file versions attribute (must be a valid a valid node semantic version range): ' + versions);
+    }
+    return versions;
+}
+
+
+/* proj */
+
+function proj(location) {
+    // Class to handle simple project xml operations
+    if (!location) {
+        throw new Error('Project file location can\'t be null or empty');
+    }
+    this.location = location;
+    this.xml = xml_helpers.parseElementtreeSync(location);
+}
+
+proj.prototype = {
+    write: function () {
+        fs.writeFileSync(this.location, this.xml.write({indent: 4}), 'utf-8');
+    },
+
+    appendToRoot: function (element) {
+        this.touched = true;
+        this.xml.getroot().append(element);
+    },
+
+    removeReferenceElementItemGroup: function (path, incText, targetConditions) {
+        var xpath = path + '[@Include="' + incText + '"]';
+        var condition = createConditionAttrib(targetConditions);
+        if (condition) {
+            xpath += '[@Condition="' + condition + '"]';
+        }
+        xpath += '/..';
+
+        var itemGroup = this.xml.find(xpath);
+        if (itemGroup) {
+            this.touched = true;
+            this.xml.getroot().remove(0, itemGroup);
+        }
+    },
+
+    addSourceFile: function (relative_path) {
+        // we allow multiple paths to be passed at once as array so that
+        // we don't create separate ItemGroup for each source file, CB-6874
+        if (!(relative_path instanceof Array)) {
+            relative_path = [relative_path];
+        }
+
+        // make ItemGroup to hold file.
+        var item = new et.Element('ItemGroup');
+
+        relative_path.forEach(function (filePath) {
+            filePath = filePath.split('/').join('\\');
+
+            var content = new et.Element('Content');
+            content.attrib.Include = filePath;
+            item.append(content);
+        });
+
+        this.appendToRoot(item);
+    },
+
+    removeSourceFile: function (relative_path) {
+        var isRegexp = relative_path instanceof RegExp;
+        if (!isRegexp) {
+            // path.normalize(relative_path);// ??
+            relative_path = relative_path.split('/').join('\\');
+        }
+
+        var root = this.xml.getroot();
+        var that = this;
+        // iterate through all ItemGroup/Content elements and remove all items matched
+        this.xml.findall('ItemGroup').forEach(function (group) {
+            // matched files in current ItemGroup
+            var filesToRemove = group.findall('Content').filter(function (item) {
+                if (!item.attrib.Include) {
+                    return false;
+                }
+                return isRegexp ? item.attrib.Include.match(relative_path) : item.attrib.Include === relative_path;
+            });
+
+            // nothing to remove, skip..
+            if (filesToRemove.length < 1) {
+                return;
+            }
+
+            filesToRemove.forEach(function (file) {
+                // remove file reference
+                group.remove(0, file);
+            });
+            // remove ItemGroup if empty
+            if (group.findall('*').length < 1) {
+                that.touched = true;
+                root.remove(0, group);
+            }
+        });
+    }
+};
+
+
+/* jsproj */
+
+function jsproj(location) {
+    function targetPlatformIdentifierToDevice(jsprojPlatform) {
+        var index = ["Windows", "WindowsPhoneApp"].indexOf(jsprojPlatform);
+        if (index < 0) {
+            throw new Error("Unknown TargetPlatformIdentifier '" + jsprojPlatform + "' in project file '" + location + "'");
+        }
+        return ["windows", "phone"][index];
+    }
+
+    function validateVersion(version) {
+        version = version.split('.');
+        while (version.length < 3) {
+            version.push("0");
+        }
+        return version.join(".");
+    }
+
+    // Class to handle a jsproj file
+    proj.call(this, location);
+
+    var propertyGroup = this.xml.find('PropertyGroup[TargetPlatformIdentifier]');
+    if (!propertyGroup) {
+        throw new Error("Unable to find PropertyGroup/TargetPlatformIdentifier in project file '" + this.location + "'");
+    }
+
+    var jsprojPlatform = propertyGroup.find('TargetPlatformIdentifier').text;
+    this.target = targetPlatformIdentifierToDevice(jsprojPlatform);
+
+    var version = propertyGroup.find('TargetPlatformVersion');
+    if (!version) {
+        throw new Error("Unable to find PropertyGroup/TargetPlatformVersion in project file '" + this.location + "'");
+    }
+    this.version = validateVersion(version.text);
+}
+
+util.inherits(jsproj, proj);
+
+jsproj.prototype.target = null;
+jsproj.prototype.version = null;
+
+/* Common support functions */
+
+function createConditionAttrib(targetConditions) {
+    var arch = targetConditions.arch;
+    if (arch) {
+        if (arch === "arm") {
+            // Specifcally allow "arm" as alternative to "ARM"
+            arch = "ARM";
+        } else if (arch !== "x86" && arch !== "x64" && arch !== "ARM") {
+            throw new Error('Invalid lib-file arch attribute (must be "x86", "x64" or "ARM"): ' + arch);
+        }
+        return "'$(Platform)'=='" + arch + "'";
+    }
+    return null;
+}
+
+
+module.exports = jsprojManager;


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


[09/12] cordova-lib git commit: CB-8123 Fix JSHINT issue.

Posted by st...@apache.org.
CB-8123 Fix JSHINT issue.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/98d17dd7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/98d17dd7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/98d17dd7

Branch: refs/heads/CB-8416
Commit: 98d17dd7976af2cdd3b7bfa9ce0612728dd5e6d7
Parents: d98343e
Author: Tim Barham <ti...@microsoft.com>
Authored: Tue Feb 10 13:38:09 2015 +1000
Committer: Tim Barham <ti...@microsoft.com>
Committed: Tue Feb 10 13:38:09 2015 +1000

----------------------------------------------------------------------
 cordova-lib/spec-plugman/platforms/windows.spec.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/98d17dd7/cordova-lib/spec-plugman/platforms/windows.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows.spec.js b/cordova-lib/spec-plugman/platforms/windows.spec.js
index 583586f..ac6a56c 100644
--- a/cordova-lib/spec-plugman/platforms/windows.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows.spec.js
@@ -56,7 +56,7 @@ beforeEach(function () {
                 return 'Expected xml \'' + et.tostring(xml) + '\' ' + notText + 'to contain elements matching \'' + xpath + '\'.';
             };
 
-            return xml.find(xpath) != null;
+            return xml.find(xpath) !== null;
         }    });
 });
 


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


[03/12] cordova-lib git commit: CB-8123 Rename windows platform related files.

Posted by st...@apache.org.
CB-8123 Rename windows platform related files.

Renames `windows8` plugin platform folders in tests to `windows`. Renames `jsproj.js` to `jsprojManager.js`.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/48852eef
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/48852eef
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/48852eef

Branch: refs/heads/CB-8416
Commit: 48852eefb20840149fa9ada28082e6cb0a2ff208
Parents: 8b6f7b9
Author: Tim Barham <ti...@microsoft.com>
Authored: Wed Jan 28 11:30:27 2015 -0800
Committer: Tim Barham <ti...@microsoft.com>
Committed: Wed Jan 28 11:30:27 2015 -0800

----------------------------------------------------------------------
 .../spec-plugman/platforms/windows8.spec.js     |  20 +-
 .../org.test.plugins.dummyplugin/plugin.xml     |  18 +-
 .../src/windows/dummer.js                       |   1 +
 .../src/windows/dummy1.dll                      |   0
 .../src/windows/dummy1.vcxproj                  |   7 +
 .../src/windows/dummy2.dll                      |   0
 .../src/windows/dummy2.vcxproj                  |   7 +
 .../src/windows/dummy3.dll                      |   0
 .../src/windows/dummy3.vcxproj                  |   7 +
 .../src/windows/dummy4.dll                      |   0
 .../src/windows/dummy4.vcxproj                  |   7 +
 .../src/windows8/dummer.js                      |   1 -
 .../src/windows8/dummy1.dll                     |   0
 .../src/windows8/dummy1.vcxproj                 |   7 -
 .../src/windows8/dummy2.dll                     |   0
 .../src/windows8/dummy2.vcxproj                 |   7 -
 .../src/windows8/dummy3.dll                     |   0
 .../src/windows8/dummy3.vcxproj                 |   7 -
 .../src/windows8/dummy4.dll                     |   0
 .../src/windows8/dummy4.vcxproj                 |   7 -
 .../org.test.plugins.faultyplugin/plugin.xml    |   6 +-
 .../src/windows/faultyPlugin.js                 |   1 +
 .../src/windows8/faultyPlugin.js                |   1 -
 cordova-lib/src/plugman/platforms/windows.js    |   2 +-
 cordova-lib/src/util/windows/jsproj.js          | 533 -------------------
 cordova-lib/src/util/windows/jsprojManager.js   | 533 +++++++++++++++++++
 26 files changed, 586 insertions(+), 586 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/platforms/windows8.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows8.spec.js b/cordova-lib/spec-plugman/platforms/windows8.spec.js
index 3d0215a..444c987 100644
--- a/cordova-lib/spec-plugman/platforms/windows8.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows8.spec.js
@@ -165,13 +165,13 @@ beforeEach(function () {
                     var source = copyArray(valid_source);
                     var s = spyOn(common, 'copyFile');
                     windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
-                    expect(s).toHaveBeenCalledWith(dummyplugin, 'src/windows8/dummer.js', cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'), false);
+                    expect(s).toHaveBeenCalledWith(dummyplugin, 'src/windows/dummer.js', cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'), false);
                 });
                 it('should throw if source-file src cannot be found', function () {
                     var source = copyArray(invalid_source);
                     expect(function () {
                         windows['source-file'].install(source[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
-                    }).toThrow('"' + path.resolve(faultyplugin, 'src/windows8/NotHere.js') + '" not found!');
+                    }).toThrow('"' + path.resolve(faultyplugin, 'src/windows/NotHere.js') + '" not found!');
                 });
                 it('should throw if source-file target already exists', function () {
                     var source = copyArray(valid_source);
@@ -243,16 +243,16 @@ beforeEach(function () {
                 var frameworks = copyArray(valid_frameworks);
 
                 it('should write to correct project files when conditions are specified', function () {
-                    var xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy1.vcxproj"][@Condition="\'$(Platform)\'==\'x64\'"]';
+                    var xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy1.vcxproj"][@Condition="\'$(Platform)\'==\'x64\'"]';
                     validateInstalledProjects('framework', frameworks[4], xpath, ['all']);
 
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy2.vcxproj"]';
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy2.vcxproj"]';
                     validateInstalledProjects('framework', frameworks[5], xpath, ['windows8']);
 
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy3.vcxproj"]';
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy3.vcxproj"]';
                     validateInstalledProjects('framework', frameworks[6], xpath, ['windows', 'windows8']);
 
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy4.vcxproj"][@Condition="\'$(Platform)\'==\'x86\'"]';
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy4.vcxproj"][@Condition="\'$(Platform)\'==\'x86\'"]';
                     validateInstalledProjects('framework', frameworks[7], xpath, ['windows', 'phone']);
                 });
             });
@@ -390,19 +390,19 @@ beforeEach(function () {
                     install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
                         .then(function () {
                             var path = 'ItemGroup/ProjectReference';
-                            var incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy1.vcxproj';
+                            var incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy1.vcxproj';
                             var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
                             validateUninstalledProjects('framework', frameworks[4], path, incText, targetConditions, ['all']);
 
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy2.vcxproj';
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy2.vcxproj';
                             targetConditions = {versions: '<8.1', target: undefined, arch: undefined};
                             validateUninstalledProjects('framework', frameworks[5], path, incText, targetConditions, ['windows8']);
 
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy3.vcxproj';
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy3.vcxproj';
                             targetConditions = {versions: undefined, target: 'win', arch: undefined};
                             validateUninstalledProjects('framework', frameworks[6], path, incText, targetConditions, ['windows', 'windows8']);
 
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy4.vcxproj';
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy4.vcxproj';
                             targetConditions = {versions: '8.1', target: 'all', arch: 'x86'};
                             validateUninstalledProjects('framework', frameworks[7], path, incText, targetConditions, ['windows', 'phone']);
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
index 1f265dd..b378b58 100644
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
@@ -178,22 +178,22 @@
             <feature id="dummyPlugin" required="true" version="1.0.0.0"/>
         </config-file>
 
-        <source-file src="src/windows8/dummer.js"/>
+        <source-file src="src/windows/dummer.js"/>
 
         <lib-file src="TestSDK1, Version=1.0" arch="x86"/>
         <lib-file src="TestSDK2, Version=1.0" versions=">=8.1"/>
         <lib-file src="TestSDK3, Version=1.0" target="phone"/>
         <lib-file src="TestSDK4, Version=1.0" target="windows" versions="8.0" arch="x86"/>
 
-        <framework src="src/windows8/dummy1.dll" arch="x64"/>
-        <framework src="src/windows8/dummy2.dll" versions=">=8.0"/>
-        <framework src="src/windows8/dummy3.dll" target="windows"/>
-        <framework src="src/windows8/dummy4.dll" target="phone" versions="8.1" arch="ARM"/>
+        <framework src="src/windows/dummy1.dll" arch="x64"/>
+        <framework src="src/windows/dummy2.dll" versions=">=8.0"/>
+        <framework src="src/windows/dummy3.dll" target="windows"/>
+        <framework src="src/windows/dummy4.dll" target="phone" versions="8.1" arch="ARM"/>
 
-        <framework src="src/windows8/dummy1.vcxproj" type="projectReference" arch="x64"/>
-        <framework src="src/windows8/dummy2.vcxproj" type="projectReference" versions="<8.1"/>
-        <framework src="src/windows8/dummy3.vcxproj" type="projectReference" target="win"/>
-        <framework src="src/windows8/dummy4.vcxproj" type="projectReference" target="all" versions="8.1" arch="x86"/>
+        <framework src="src/windows/dummy1.vcxproj" type="projectReference" arch="x64"/>
+        <framework src="src/windows/dummy2.vcxproj" type="projectReference" versions="<8.1"/>
+        <framework src="src/windows/dummy3.vcxproj" type="projectReference" target="win"/>
+        <framework src="src/windows/dummy4.vcxproj" type="projectReference" target="all" versions="8.1" arch="x86"/>
 
         <js-module src="www/dummyplugin.js" name="Dummy">
             <clobbers target="dummy" />

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummer.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummer.js b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummer.js
new file mode 100644
index 0000000..48388bc
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummer.js
@@ -0,0 +1 @@
+./org.test.plugins.dummyplugin/src/windows8/dummer.js

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy1.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy1.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy1.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy1.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy1.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy1.vcxproj
new file mode 100644
index 0000000..c454905
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy1.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{ef7dd979-6f12-4bdf-8754-9468ce799c4d}</ProjectGuid>
+        <ProjectName>dummy1</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy2.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy2.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy2.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy2.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy2.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy2.vcxproj
new file mode 100644
index 0000000..8edd706
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy2.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{6a760eea-8c27-442e-b98b-a487964ded42}</ProjectGuid>
+        <ProjectName>dummy2</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy3.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy3.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy3.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy3.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy3.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy3.vcxproj
new file mode 100644
index 0000000..600167c
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy3.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{5318c3c8-0921-4870-b4ad-8cce06c88238}</ProjectGuid>
+        <ProjectName>dummy3</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy4.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy4.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy4.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy4.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy4.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy4.vcxproj
new file mode 100644
index 0000000..d7acf04
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows/dummy4.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{8e430a1b-094b-4c27-8b76-fdd7021dbfe9}</ProjectGuid>
+        <ProjectName>dummy4</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummer.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummer.js b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummer.js
deleted file mode 100644
index 48388bc..0000000
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummer.js
+++ /dev/null
@@ -1 +0,0 @@
-./org.test.plugins.dummyplugin/src/windows8/dummer.js

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.dll
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj
deleted file mode 100644
index c454905..0000000
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup Label="Globals">
-        <ProjectGuid>{ef7dd979-6f12-4bdf-8754-9468ce799c4d}</ProjectGuid>
-        <ProjectName>dummy1</ProjectName>
-    </PropertyGroup>
-</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.dll
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj
deleted file mode 100644
index 8edd706..0000000
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup Label="Globals">
-        <ProjectGuid>{6a760eea-8c27-442e-b98b-a487964ded42}</ProjectGuid>
-        <ProjectName>dummy2</ProjectName>
-    </PropertyGroup>
-</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.dll
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj
deleted file mode 100644
index 600167c..0000000
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup Label="Globals">
-        <ProjectGuid>{5318c3c8-0921-4870-b4ad-8cce06c88238}</ProjectGuid>
-        <ProjectName>dummy3</ProjectName>
-    </PropertyGroup>
-</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.dll
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj
deleted file mode 100644
index d7acf04..0000000
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup Label="Globals">
-        <ProjectGuid>{8e430a1b-094b-4c27-8b76-fdd7021dbfe9}</ProjectGuid>
-        <ProjectName>dummy4</ProjectName>
-    </PropertyGroup>
-</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
index 1b38414..8ff99c4 100644
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
@@ -135,17 +135,17 @@
     <platform name="windows">
         <config-file target="config.xml" parent="/*">
             <feature name="org.test.plugins.faultyplugin">
-                <param name="windows8-package" value="org.test.plugins.faultyplugin"/>
+                <param name="windows-package" value="org.test.plugins.faultyplugin"/>
             </feature>
         </config-file>
 
-        <source-file src="src/windows8/faultyPlugin.js" />
+        <source-file src="src/windows/faultyPlugin.js" />
 
         <lib-file src="TestSDK1, Version=1.0" arch="x85"/>
         <lib-file src="TestSDK2, Version=1.0" versions="8.0a"/>
         <lib-file src="TestSDK3, Version=1.0" target="daphne"/>
 
         <!-- does not exist -->
-        <source-file src="src/windows8/NotHere.js" />
+        <source-file src="src/windows/NotHere.js" />
     </platform>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows/faultyPlugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows/faultyPlugin.js b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows/faultyPlugin.js
new file mode 100644
index 0000000..784b850
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows/faultyPlugin.js
@@ -0,0 +1 @@
+./org.test.plugins.faultyplugin/src/windows8/faultyPlugin.js

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows8/faultyPlugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows8/faultyPlugin.js b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows8/faultyPlugin.js
deleted file mode 100644
index 784b850..0000000
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/src/windows8/faultyPlugin.js
+++ /dev/null
@@ -1 +0,0 @@
-./org.test.plugins.faultyplugin/src/windows8/faultyPlugin.js

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/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 07186cb..7b5b061 100644
--- a/cordova-lib/src/plugman/platforms/windows.js
+++ b/cordova-lib/src/plugman/platforms/windows.js
@@ -26,7 +26,7 @@ var common = require('./common'),
     path = require('path'),
     fs   = require('fs'),
     glob = require('glob'),
-    jsprojManager = require('../../util/windows/jsproj'),
+    jsprojManager = require('../../util/windows/jsprojManager'),
     events = require('../../events'),
     xml_helpers = require('../../util/xml-helpers');
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/src/util/windows/jsproj.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsproj.js b/cordova-lib/src/util/windows/jsproj.js
deleted file mode 100644
index 57642ba..0000000
--- a/cordova-lib/src/util/windows/jsproj.js
+++ /dev/null
@@ -1,533 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-/* jshint quotmark:false, unused:false */
-
-/*
- Helper for dealing with Windows Store JS app .jsproj files
- */
-
-
-var util = require('util'),
-    xml_helpers = require('../../util/xml-helpers'),
-    et = require('elementtree'),
-    fs = require('fs'),
-    glob = require('glob'),
-    shell = require('shelljs'),
-    events = require('../../events'),
-    path = require('path'),
-    semver = require('semver');
-
-var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  // .csproj
-var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";  // .vcxproj
-
-// Match a JavaScript Project
-var JsProjectRegEx = /(Project\("\{262852C6-CD72-467D-83FE-5EEB1973A190}"\)\s*=\s*"[^"]+",\s*"[^"]+",\s*"\{[0-9a-f\-]+}"[^\r\n]*[\r\n]*)/gi;
-
-// Chars in a string that need to be escaped when used in a RegExp
-var RegExpEscRegExp = /([.?*+\^$\[\]\\(){}|\-])/g;
-
-function jsprojManager(location) {
-    this.isUniversalWindowsApp = path.extname(location).toLowerCase() === ".projitems";
-    this.projects = [];
-    this.master = this.isUniversalWindowsApp ? new proj(location) : new jsproj(location);
-    this.projectFolder = path.dirname(location);
-
-}
-
-jsprojManager.prototype = {
-    _projects: null,
-
-    write: function () {
-        this.master.write();
-        if (this._projects) {
-            var that = this;
-            this._projects.forEach(function (project) {
-                if (project !== that.master && project.touched) {
-                    project.write();
-                }
-            });
-        }
-    },
-
-    addSDKRef: function (incText, targetConditions) {
-        events.emit('verbose', 'jsprojManager.addSDKRef(incText: ' + incText + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
-
-        var item = createReferenceElement('ItemGroup/SDKReference', incText, targetConditions);
-        this._getMatchingProjects(targetConditions).forEach(function (project) {
-            project.appendToRoot(item);
-        });
-    },
-
-    removeSDKRef: function (incText, targetConditions) {
-        events.emit('verbose', 'jsprojManager.removeSDKRef(incText: ' + incText + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
-
-        this._getMatchingProjects(targetConditions).forEach(function (project) {
-            project.removeReferenceElementItemGroup('ItemGroup/SDKReference', incText, targetConditions);
-        });
-    },
-
-    addReference: function (relPath, targetConditions) {
-        events.emit('verbose', 'jsprojManager.addReference(incText: ' + relPath + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
-
-        // add hint path with full path
-        var hint_path = new et.Element('HintPath');
-        hint_path.text = relPath;
-        var children = [hint_path];
-
-        var extName = path.extname(relPath);
-        if (extName === ".winmd") {
-            var mdFileTag = new et.Element("IsWinMDFile");
-            mdFileTag.text = "true";
-            children.push(mdFileTag);
-        }
-
-        var item = createReferenceElement('ItemGroup/Reference', path.basename(relPath, extName), targetConditions, children);
-        this._getMatchingProjects(targetConditions).forEach(function (project) {
-            project.appendToRoot(item);
-        });
-
-    },
-
-    removeReference: function (relPath, targetConditions) {
-        events.emit('verbose', 'jsprojManager.removeReference(incText: ' + relPath + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
-
-        var extName = path.extname(relPath);
-        var includeText = path.basename(relPath, extName);
-
-        this._getMatchingProjects(targetConditions).forEach(function (project) {
-            project.removeReferenceElementItemGroup('ItemGroup/Reference', includeText, targetConditions);
-        });
-    },
-
-    addSourceFile: function (relative_path) {
-        events.emit('verbose', 'jsprojManager.addSourceFile(relative_path: ' + relative_path + ')');
-        this.master.addSourceFile(relative_path);
-    },
-
-    removeSourceFile: function (relative_path) {
-        events.emit('verbose', 'jsprojManager.removeSourceFile(incText: ' + relative_path + ')');
-        this.master.removeSourceFile(relative_path);
-    },
-
-    addProjectReference: function (relative_path, targetConditions) {
-        events.emit('verbose', 'jsprojManager.addProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
-
-        relative_path = relative_path.split('/').join('\\');
-
-        var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
-
-        // find the guid + name of the referenced project
-        var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
-        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
-
-        // get the project type
-        var projectTypeGuid = getProjectTypeGuid(relative_path);
-        if (!projectTypeGuid) {
-            throw new Error("unrecognized project type");
-        }
-
-        var preInsertText = "\tProjectSection(ProjectDependencies) = postProject\r\n" +
-            "\t\t" + projectGuid + "=" + projectGuid + "\r\n" +
-            "\tEndProjectSection\r\n";
-        var postInsertText = '\r\nProject("' + projectTypeGuid + '") = "' +
-            projName + '", "' + relative_path + '", ' +
-            '"' + projectGuid + '"\r\nEndProject';
-
-        var matchingProjects = this._getMatchingProjects(targetConditions);
-        if (matchingProjects.length === 0) {
-            // No projects meet the specified target and version criteria, so nothing to do.
-            return;
-        }
-
-        // Will we be writing into the .projitems file rather than individual .jsproj files?
-        var useProjItems = this.isUniversalWindowsApp && matchingProjects.length === 1 && matchingProjects[0] === this.master;
-
-        // There may be multiple solution files (for different VS versions) - process them all
-        getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
-            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
-
-            if (useProjItems) {
-                // Insert a project dependency into every jsproj in the solution.
-                var jsProjectFound = false;
-                solText = solText.replace(JsProjectRegEx, function (match) {
-                    jsProjectFound = true;
-                    return match + preInsertText;
-                });
-
-                if (!jsProjectFound) {
-                    throw new Error("no jsproj found in solution");
-                }
-            } else {
-                // Insert a project dependency only for projects that match specified target and version
-                matchingProjects.forEach(function (project) {
-                    solText = solText.replace(getJsProjRegExForProject(path.basename(project.location)), function (match) {
-                        return match + preInsertText;
-                    });
-                });
-            }
-
-            // Add the project after existing projects. Note that this fairly simplistic check should be fine, since the last
-            // EndProject in the file should actually be an EndProject (and not an EndProjectSection, for example).
-            var pos = solText.lastIndexOf("EndProject");
-            if (pos === -1) {
-                throw new Error("no EndProject found in solution");
-            }
-            pos += 10; // Move pos to the end of EndProject text
-            solText = solText.slice(0, pos) + postInsertText + solText.slice(pos);
-
-            fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
-        });
-
-        // Add the ItemGroup/ProjectReference to each matching cordova project :
-        // <ItemGroup><ProjectReference Include="blahblah.csproj"/></ItemGroup>
-        var item = createReferenceElement('ItemGroup/ProjectReference', relative_path, targetConditions);
-        matchingProjects.forEach(function (project) {
-            project.appendToRoot(item);
-        });
-    },
-
-    removeProjectReference: function (relative_path, targetConditions) {
-        events.emit('verbose', 'jsprojManager.removeProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
-
-        // find the guid + name of the referenced project
-        var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
-        var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
-        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
-
-        // get the project type
-        var projectTypeGuid = getProjectTypeGuid(relative_path);
-        if (!projectTypeGuid) {
-            throw new Error("unrecognized project type");
-        }
-
-        var preInsertTextRegExp = getProjectReferencePreInsertRegExp(projectGuid);
-        var postInsertTextRegExp = getProjectReferencePostInsertRegExp(projName, projectGuid, relative_path, projectTypeGuid);
-
-        // There may be multiple solutions (for different VS versions) - process them all
-        getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
-            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
-
-            // To be safe (to handle subtle changes in formatting, for example), use a RegExp to find and remove
-            // preInsertText and postInsertText
-
-            solText = solText.replace(preInsertTextRegExp, function () {
-                return "";
-            });
-
-            solText = solText.replace(postInsertTextRegExp, function () {
-                return "";
-            });
-
-            fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
-        });
-
-        this._getMatchingProjects(targetConditions).forEach(function (project) {
-            project.removeReferenceElementItemGroup('ItemGroup/ProjectReference', relative_path, targetConditions);
-        });
-    },
-
-    _getMatchingProjects: function (targetConditions) {
-        // If specified, target can be 'all' (default), 'phone' or 'windows'. Ultimately should probably allow a comma
-        // separated list, but not needed now.
-        var target = getTarget(targetConditions);
-        var versions = getVersions(targetConditions);
-
-        if (target || versions) {
-            var matchingProjects = this.projects.filter(function (project) {
-                return (!target || target === project.target) && (!versions || semver.satisfies(project.version, versions, /* loose */ true));
-            });
-
-            if (matchingProjects.length < this.projects.length) {
-                return matchingProjects;
-            }
-        }
-
-        // All projects match. If this is a universal project, return the projitems file. Otherwise return our single
-        // project.
-        return [this.master];
-    },
-
-    get projects() {
-        var projects = this._projects;
-        if (!projects) {
-            projects = [];
-            this._projects = projects;
-
-            if (this.isUniversalWindowsApp) {
-                var projectPath = this.projectFolder;
-                var projectFiles = glob.sync('*.jsproj', {cwd: projectPath});
-                projectFiles.forEach(function (projectFile) {
-                    projects.push(new jsproj(path.join(projectPath, projectFile)));
-                });
-            } else {
-                this.projects.push(this.master);
-            }
-        }
-
-        return projects;
-    }
-};
-
-function getProjectReferencePreInsertRegExp(projectGuid) {
-    projectGuid = escapeRegExpString(projectGuid);
-    return new RegExp("\\s*ProjectSection\\(ProjectDependencies\\)\\s*=\\s*postProject\\s*" + projectGuid + "\\s*=\\s*" + projectGuid + "\\s*EndProjectSection", "gi");
-}
-
-function getProjectReferencePostInsertRegExp(projName, projectGuid, relative_path, projectTypeGuid) {
-    projName = escapeRegExpString(projName);
-    projectGuid = escapeRegExpString(projectGuid);
-    relative_path = escapeRegExpString(relative_path);
-    projectTypeGuid = escapeRegExpString(projectTypeGuid);
-    return new RegExp('\\s*Project\\("' + projectTypeGuid + '"\\)\\s*=\\s*"' + projName + '"\\s*,\\s*"' + relative_path + '"\\s*,\\s*"' + projectGuid + '"\\s*EndProject', 'gi');
-}
-
-function getSolutionPaths(projectFolder) {
-    return shell.ls(path.join(projectFolder, "*.sln")); // TODO:error handling
-}
-
-function escapeRegExpString(regExpString) {
-    return regExpString.replace(RegExpEscRegExp, "\\$1");
-}
-
-function getJsProjRegExForProject(projectFile) {
-    projectFile = escapeRegExpString(projectFile);
-    return new RegExp('(Project\\("\\{262852C6-CD72-467D-83FE-5EEB1973A190}"\\)\\s*=\\s*"[^"]+",\\s*"' + projectFile + '",\\s*"\\{[0-9a-f\\-]+}"[^\\r\\n]*[\\r\\n]*)', 'gi');
-}
-
-function getProjectTypeGuid(projectPath) {
-    switch (path.extname(projectPath)) {
-        case ".vcxproj":
-            return WinCplusplusProjectTypeGUID;
-
-        case ".csproj":
-            return WinCSharpProjectTypeGUID;
-    }
-    return null;
-}
-
-function createReferenceElement(path, incText, targetConditions, children) {
-    path = path.split('/');
-    path.reverse();
-
-    var lastElement = null;
-    path.forEach(function (elementName) {
-        var element = new et.Element(elementName);
-        if (lastElement) {
-            element.append(lastElement);
-        } else {
-            element.attrib.Include = incText;
-
-            var condition = createConditionAttrib(targetConditions);
-            if (condition) {
-                element.attrib.Condition = condition;
-            }
-
-            if (children) {
-                children.forEach(function (child) {
-                    element.append(child);
-                });
-            }
-        }
-        lastElement = element;
-    });
-
-    return lastElement;
-}
-
-function getTarget(targetConditions) {
-    var target = targetConditions.target;
-    if (target) {
-        target = target.toLowerCase().trim();
-        if (target === "all") {
-            target = null;
-        } else if (target === "win") {
-            // Allow "win" as alternative to "windows"
-            target = "windows";
-        } else if (target !== 'phone' && target !== 'windows') {
-            throw new Error('Invalid lib-file target attribute (must be "all", "phone", "windows" or "win"): ' + target);
-        }
-    }
-    return target;
-}
-
-function getVersions(targetConditions) {
-    var versions = targetConditions.versions;
-    if (versions && !semver.validRange(versions, /* loose */ true)) {
-        throw new Error('Invalid lib-file versions attribute (must be a valid a valid node semantic version range): ' + versions);
-    }
-    return versions;
-}
-
-
-/* proj */
-
-function proj(location) {
-    // Class to handle simple project xml operations
-    if (!location) {
-        throw new Error('Project file location can\'t be null or empty');
-    }
-    this.location = location;
-    this.xml = xml_helpers.parseElementtreeSync(location);
-}
-
-proj.prototype = {
-    write: function () {
-        fs.writeFileSync(this.location, this.xml.write({indent: 4}), 'utf-8');
-    },
-
-    appendToRoot: function (element) {
-        this.touched = true;
-        this.xml.getroot().append(element);
-    },
-
-    removeReferenceElementItemGroup: function (path, incText, targetConditions) {
-        var xpath = path + '[@Include="' + incText + '"]';
-        var condition = createConditionAttrib(targetConditions);
-        if (condition) {
-            xpath += '[@Condition="' + condition + '"]';
-        }
-        xpath += '/..';
-
-        var itemGroup = this.xml.find(xpath);
-        if (itemGroup) {
-            this.touched = true;
-            this.xml.getroot().remove(0, itemGroup);
-        }
-    },
-
-    addSourceFile: function (relative_path) {
-        // we allow multiple paths to be passed at once as array so that
-        // we don't create separate ItemGroup for each source file, CB-6874
-        if (!(relative_path instanceof Array)) {
-            relative_path = [relative_path];
-        }
-
-        // make ItemGroup to hold file.
-        var item = new et.Element('ItemGroup');
-
-        relative_path.forEach(function (filePath) {
-            filePath = filePath.split('/').join('\\');
-
-            var content = new et.Element('Content');
-            content.attrib.Include = filePath;
-            item.append(content);
-        });
-
-        this.appendToRoot(item);
-    },
-
-    removeSourceFile: function (relative_path) {
-        var isRegexp = relative_path instanceof RegExp;
-        if (!isRegexp) {
-            // path.normalize(relative_path);// ??
-            relative_path = relative_path.split('/').join('\\');
-        }
-
-        var root = this.xml.getroot();
-        var that = this;
-        // iterate through all ItemGroup/Content elements and remove all items matched
-        this.xml.findall('ItemGroup').forEach(function (group) {
-            // matched files in current ItemGroup
-            var filesToRemove = group.findall('Content').filter(function (item) {
-                if (!item.attrib.Include) {
-                    return false;
-                }
-                return isRegexp ? item.attrib.Include.match(relative_path) : item.attrib.Include === relative_path;
-            });
-
-            // nothing to remove, skip..
-            if (filesToRemove.length < 1) {
-                return;
-            }
-
-            filesToRemove.forEach(function (file) {
-                // remove file reference
-                group.remove(0, file);
-            });
-            // remove ItemGroup if empty
-            if (group.findall('*').length < 1) {
-                that.touched = true;
-                root.remove(0, group);
-            }
-        });
-    }
-};
-
-
-/* jsproj */
-
-function jsproj(location) {
-    function targetPlatformIdentifierToDevice(jsprojPlatform) {
-        var index = ["Windows", "WindowsPhoneApp"].indexOf(jsprojPlatform);
-        if (index < 0) {
-            throw new Error("Unknown TargetPlatformIdentifier '" + jsprojPlatform + "' in project file '" + location + "'");
-        }
-        return ["windows", "phone"][index];
-    }
-
-    function validateVersion(version) {
-        version = version.split('.');
-        while (version.length < 3) {
-            version.push("0");
-        }
-        return version.join(".");
-    }
-
-    // Class to handle a jsproj file
-    proj.call(this, location);
-
-    var propertyGroup = this.xml.find('PropertyGroup[TargetPlatformIdentifier]');
-    if (!propertyGroup) {
-        throw new Error("Unable to find PropertyGroup/TargetPlatformIdentifier in project file '" + this.location + "'");
-    }
-
-    var jsprojPlatform = propertyGroup.find('TargetPlatformIdentifier').text;
-    this.target = targetPlatformIdentifierToDevice(jsprojPlatform);
-
-    var version = propertyGroup.find('TargetPlatformVersion');
-    if (!version) {
-        throw new Error("Unable to find PropertyGroup/TargetPlatformVersion in project file '" + this.location + "'");
-    }
-    this.version = validateVersion(version.text);
-}
-
-util.inherits(jsproj, proj);
-
-jsproj.prototype.target = null;
-jsproj.prototype.version = null;
-
-/* Common support functions */
-
-function createConditionAttrib(targetConditions) {
-    var arch = targetConditions.arch;
-    if (arch) {
-        if (arch === "arm") {
-            // Specifcally allow "arm" as alternative to "ARM"
-            arch = "ARM";
-        } else if (arch !== "x86" && arch !== "x64" && arch !== "ARM") {
-            throw new Error('Invalid lib-file arch attribute (must be "x86", "x64" or "ARM"): ' + arch);
-        }
-        return "'$(Platform)'=='" + arch + "'";
-    }
-    return null;
-}
-
-
-module.exports = jsprojManager;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/48852eef/cordova-lib/src/util/windows/jsprojManager.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsprojManager.js b/cordova-lib/src/util/windows/jsprojManager.js
new file mode 100644
index 0000000..57642ba
--- /dev/null
+++ b/cordova-lib/src/util/windows/jsprojManager.js
@@ -0,0 +1,533 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+/* jshint quotmark:false, unused:false */
+
+/*
+ Helper for dealing with Windows Store JS app .jsproj files
+ */
+
+
+var util = require('util'),
+    xml_helpers = require('../../util/xml-helpers'),
+    et = require('elementtree'),
+    fs = require('fs'),
+    glob = require('glob'),
+    shell = require('shelljs'),
+    events = require('../../events'),
+    path = require('path'),
+    semver = require('semver');
+
+var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  // .csproj
+var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";  // .vcxproj
+
+// Match a JavaScript Project
+var JsProjectRegEx = /(Project\("\{262852C6-CD72-467D-83FE-5EEB1973A190}"\)\s*=\s*"[^"]+",\s*"[^"]+",\s*"\{[0-9a-f\-]+}"[^\r\n]*[\r\n]*)/gi;
+
+// Chars in a string that need to be escaped when used in a RegExp
+var RegExpEscRegExp = /([.?*+\^$\[\]\\(){}|\-])/g;
+
+function jsprojManager(location) {
+    this.isUniversalWindowsApp = path.extname(location).toLowerCase() === ".projitems";
+    this.projects = [];
+    this.master = this.isUniversalWindowsApp ? new proj(location) : new jsproj(location);
+    this.projectFolder = path.dirname(location);
+
+}
+
+jsprojManager.prototype = {
+    _projects: null,
+
+    write: function () {
+        this.master.write();
+        if (this._projects) {
+            var that = this;
+            this._projects.forEach(function (project) {
+                if (project !== that.master && project.touched) {
+                    project.write();
+                }
+            });
+        }
+    },
+
+    addSDKRef: function (incText, targetConditions) {
+        events.emit('verbose', 'jsprojManager.addSDKRef(incText: ' + incText + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
+
+        var item = createReferenceElement('ItemGroup/SDKReference', incText, targetConditions);
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.appendToRoot(item);
+        });
+    },
+
+    removeSDKRef: function (incText, targetConditions) {
+        events.emit('verbose', 'jsprojManager.removeSDKRef(incText: ' + incText + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
+
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.removeReferenceElementItemGroup('ItemGroup/SDKReference', incText, targetConditions);
+        });
+    },
+
+    addReference: function (relPath, targetConditions) {
+        events.emit('verbose', 'jsprojManager.addReference(incText: ' + relPath + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
+
+        // add hint path with full path
+        var hint_path = new et.Element('HintPath');
+        hint_path.text = relPath;
+        var children = [hint_path];
+
+        var extName = path.extname(relPath);
+        if (extName === ".winmd") {
+            var mdFileTag = new et.Element("IsWinMDFile");
+            mdFileTag.text = "true";
+            children.push(mdFileTag);
+        }
+
+        var item = createReferenceElement('ItemGroup/Reference', path.basename(relPath, extName), targetConditions, children);
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.appendToRoot(item);
+        });
+
+    },
+
+    removeReference: function (relPath, targetConditions) {
+        events.emit('verbose', 'jsprojManager.removeReference(incText: ' + relPath + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
+
+        var extName = path.extname(relPath);
+        var includeText = path.basename(relPath, extName);
+
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.removeReferenceElementItemGroup('ItemGroup/Reference', includeText, targetConditions);
+        });
+    },
+
+    addSourceFile: function (relative_path) {
+        events.emit('verbose', 'jsprojManager.addSourceFile(relative_path: ' + relative_path + ')');
+        this.master.addSourceFile(relative_path);
+    },
+
+    removeSourceFile: function (relative_path) {
+        events.emit('verbose', 'jsprojManager.removeSourceFile(incText: ' + relative_path + ')');
+        this.master.removeSourceFile(relative_path);
+    },
+
+    addProjectReference: function (relative_path, targetConditions) {
+        events.emit('verbose', 'jsprojManager.addProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
+
+        relative_path = relative_path.split('/').join('\\');
+
+        var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
+
+        // find the guid + name of the referenced project
+        var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
+        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
+
+        // get the project type
+        var projectTypeGuid = getProjectTypeGuid(relative_path);
+        if (!projectTypeGuid) {
+            throw new Error("unrecognized project type");
+        }
+
+        var preInsertText = "\tProjectSection(ProjectDependencies) = postProject\r\n" +
+            "\t\t" + projectGuid + "=" + projectGuid + "\r\n" +
+            "\tEndProjectSection\r\n";
+        var postInsertText = '\r\nProject("' + projectTypeGuid + '") = "' +
+            projName + '", "' + relative_path + '", ' +
+            '"' + projectGuid + '"\r\nEndProject';
+
+        var matchingProjects = this._getMatchingProjects(targetConditions);
+        if (matchingProjects.length === 0) {
+            // No projects meet the specified target and version criteria, so nothing to do.
+            return;
+        }
+
+        // Will we be writing into the .projitems file rather than individual .jsproj files?
+        var useProjItems = this.isUniversalWindowsApp && matchingProjects.length === 1 && matchingProjects[0] === this.master;
+
+        // There may be multiple solution files (for different VS versions) - process them all
+        getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
+            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
+
+            if (useProjItems) {
+                // Insert a project dependency into every jsproj in the solution.
+                var jsProjectFound = false;
+                solText = solText.replace(JsProjectRegEx, function (match) {
+                    jsProjectFound = true;
+                    return match + preInsertText;
+                });
+
+                if (!jsProjectFound) {
+                    throw new Error("no jsproj found in solution");
+                }
+            } else {
+                // Insert a project dependency only for projects that match specified target and version
+                matchingProjects.forEach(function (project) {
+                    solText = solText.replace(getJsProjRegExForProject(path.basename(project.location)), function (match) {
+                        return match + preInsertText;
+                    });
+                });
+            }
+
+            // Add the project after existing projects. Note that this fairly simplistic check should be fine, since the last
+            // EndProject in the file should actually be an EndProject (and not an EndProjectSection, for example).
+            var pos = solText.lastIndexOf("EndProject");
+            if (pos === -1) {
+                throw new Error("no EndProject found in solution");
+            }
+            pos += 10; // Move pos to the end of EndProject text
+            solText = solText.slice(0, pos) + postInsertText + solText.slice(pos);
+
+            fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
+        });
+
+        // Add the ItemGroup/ProjectReference to each matching cordova project :
+        // <ItemGroup><ProjectReference Include="blahblah.csproj"/></ItemGroup>
+        var item = createReferenceElement('ItemGroup/ProjectReference', relative_path, targetConditions);
+        matchingProjects.forEach(function (project) {
+            project.appendToRoot(item);
+        });
+    },
+
+    removeProjectReference: function (relative_path, targetConditions) {
+        events.emit('verbose', 'jsprojManager.removeProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
+
+        // find the guid + name of the referenced project
+        var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
+        var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
+        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
+
+        // get the project type
+        var projectTypeGuid = getProjectTypeGuid(relative_path);
+        if (!projectTypeGuid) {
+            throw new Error("unrecognized project type");
+        }
+
+        var preInsertTextRegExp = getProjectReferencePreInsertRegExp(projectGuid);
+        var postInsertTextRegExp = getProjectReferencePostInsertRegExp(projName, projectGuid, relative_path, projectTypeGuid);
+
+        // There may be multiple solutions (for different VS versions) - process them all
+        getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
+            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
+
+            // To be safe (to handle subtle changes in formatting, for example), use a RegExp to find and remove
+            // preInsertText and postInsertText
+
+            solText = solText.replace(preInsertTextRegExp, function () {
+                return "";
+            });
+
+            solText = solText.replace(postInsertTextRegExp, function () {
+                return "";
+            });
+
+            fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
+        });
+
+        this._getMatchingProjects(targetConditions).forEach(function (project) {
+            project.removeReferenceElementItemGroup('ItemGroup/ProjectReference', relative_path, targetConditions);
+        });
+    },
+
+    _getMatchingProjects: function (targetConditions) {
+        // If specified, target can be 'all' (default), 'phone' or 'windows'. Ultimately should probably allow a comma
+        // separated list, but not needed now.
+        var target = getTarget(targetConditions);
+        var versions = getVersions(targetConditions);
+
+        if (target || versions) {
+            var matchingProjects = this.projects.filter(function (project) {
+                return (!target || target === project.target) && (!versions || semver.satisfies(project.version, versions, /* loose */ true));
+            });
+
+            if (matchingProjects.length < this.projects.length) {
+                return matchingProjects;
+            }
+        }
+
+        // All projects match. If this is a universal project, return the projitems file. Otherwise return our single
+        // project.
+        return [this.master];
+    },
+
+    get projects() {
+        var projects = this._projects;
+        if (!projects) {
+            projects = [];
+            this._projects = projects;
+
+            if (this.isUniversalWindowsApp) {
+                var projectPath = this.projectFolder;
+                var projectFiles = glob.sync('*.jsproj', {cwd: projectPath});
+                projectFiles.forEach(function (projectFile) {
+                    projects.push(new jsproj(path.join(projectPath, projectFile)));
+                });
+            } else {
+                this.projects.push(this.master);
+            }
+        }
+
+        return projects;
+    }
+};
+
+function getProjectReferencePreInsertRegExp(projectGuid) {
+    projectGuid = escapeRegExpString(projectGuid);
+    return new RegExp("\\s*ProjectSection\\(ProjectDependencies\\)\\s*=\\s*postProject\\s*" + projectGuid + "\\s*=\\s*" + projectGuid + "\\s*EndProjectSection", "gi");
+}
+
+function getProjectReferencePostInsertRegExp(projName, projectGuid, relative_path, projectTypeGuid) {
+    projName = escapeRegExpString(projName);
+    projectGuid = escapeRegExpString(projectGuid);
+    relative_path = escapeRegExpString(relative_path);
+    projectTypeGuid = escapeRegExpString(projectTypeGuid);
+    return new RegExp('\\s*Project\\("' + projectTypeGuid + '"\\)\\s*=\\s*"' + projName + '"\\s*,\\s*"' + relative_path + '"\\s*,\\s*"' + projectGuid + '"\\s*EndProject', 'gi');
+}
+
+function getSolutionPaths(projectFolder) {
+    return shell.ls(path.join(projectFolder, "*.sln")); // TODO:error handling
+}
+
+function escapeRegExpString(regExpString) {
+    return regExpString.replace(RegExpEscRegExp, "\\$1");
+}
+
+function getJsProjRegExForProject(projectFile) {
+    projectFile = escapeRegExpString(projectFile);
+    return new RegExp('(Project\\("\\{262852C6-CD72-467D-83FE-5EEB1973A190}"\\)\\s*=\\s*"[^"]+",\\s*"' + projectFile + '",\\s*"\\{[0-9a-f\\-]+}"[^\\r\\n]*[\\r\\n]*)', 'gi');
+}
+
+function getProjectTypeGuid(projectPath) {
+    switch (path.extname(projectPath)) {
+        case ".vcxproj":
+            return WinCplusplusProjectTypeGUID;
+
+        case ".csproj":
+            return WinCSharpProjectTypeGUID;
+    }
+    return null;
+}
+
+function createReferenceElement(path, incText, targetConditions, children) {
+    path = path.split('/');
+    path.reverse();
+
+    var lastElement = null;
+    path.forEach(function (elementName) {
+        var element = new et.Element(elementName);
+        if (lastElement) {
+            element.append(lastElement);
+        } else {
+            element.attrib.Include = incText;
+
+            var condition = createConditionAttrib(targetConditions);
+            if (condition) {
+                element.attrib.Condition = condition;
+            }
+
+            if (children) {
+                children.forEach(function (child) {
+                    element.append(child);
+                });
+            }
+        }
+        lastElement = element;
+    });
+
+    return lastElement;
+}
+
+function getTarget(targetConditions) {
+    var target = targetConditions.target;
+    if (target) {
+        target = target.toLowerCase().trim();
+        if (target === "all") {
+            target = null;
+        } else if (target === "win") {
+            // Allow "win" as alternative to "windows"
+            target = "windows";
+        } else if (target !== 'phone' && target !== 'windows') {
+            throw new Error('Invalid lib-file target attribute (must be "all", "phone", "windows" or "win"): ' + target);
+        }
+    }
+    return target;
+}
+
+function getVersions(targetConditions) {
+    var versions = targetConditions.versions;
+    if (versions && !semver.validRange(versions, /* loose */ true)) {
+        throw new Error('Invalid lib-file versions attribute (must be a valid a valid node semantic version range): ' + versions);
+    }
+    return versions;
+}
+
+
+/* proj */
+
+function proj(location) {
+    // Class to handle simple project xml operations
+    if (!location) {
+        throw new Error('Project file location can\'t be null or empty');
+    }
+    this.location = location;
+    this.xml = xml_helpers.parseElementtreeSync(location);
+}
+
+proj.prototype = {
+    write: function () {
+        fs.writeFileSync(this.location, this.xml.write({indent: 4}), 'utf-8');
+    },
+
+    appendToRoot: function (element) {
+        this.touched = true;
+        this.xml.getroot().append(element);
+    },
+
+    removeReferenceElementItemGroup: function (path, incText, targetConditions) {
+        var xpath = path + '[@Include="' + incText + '"]';
+        var condition = createConditionAttrib(targetConditions);
+        if (condition) {
+            xpath += '[@Condition="' + condition + '"]';
+        }
+        xpath += '/..';
+
+        var itemGroup = this.xml.find(xpath);
+        if (itemGroup) {
+            this.touched = true;
+            this.xml.getroot().remove(0, itemGroup);
+        }
+    },
+
+    addSourceFile: function (relative_path) {
+        // we allow multiple paths to be passed at once as array so that
+        // we don't create separate ItemGroup for each source file, CB-6874
+        if (!(relative_path instanceof Array)) {
+            relative_path = [relative_path];
+        }
+
+        // make ItemGroup to hold file.
+        var item = new et.Element('ItemGroup');
+
+        relative_path.forEach(function (filePath) {
+            filePath = filePath.split('/').join('\\');
+
+            var content = new et.Element('Content');
+            content.attrib.Include = filePath;
+            item.append(content);
+        });
+
+        this.appendToRoot(item);
+    },
+
+    removeSourceFile: function (relative_path) {
+        var isRegexp = relative_path instanceof RegExp;
+        if (!isRegexp) {
+            // path.normalize(relative_path);// ??
+            relative_path = relative_path.split('/').join('\\');
+        }
+
+        var root = this.xml.getroot();
+        var that = this;
+        // iterate through all ItemGroup/Content elements and remove all items matched
+        this.xml.findall('ItemGroup').forEach(function (group) {
+            // matched files in current ItemGroup
+            var filesToRemove = group.findall('Content').filter(function (item) {
+                if (!item.attrib.Include) {
+                    return false;
+                }
+                return isRegexp ? item.attrib.Include.match(relative_path) : item.attrib.Include === relative_path;
+            });
+
+            // nothing to remove, skip..
+            if (filesToRemove.length < 1) {
+                return;
+            }
+
+            filesToRemove.forEach(function (file) {
+                // remove file reference
+                group.remove(0, file);
+            });
+            // remove ItemGroup if empty
+            if (group.findall('*').length < 1) {
+                that.touched = true;
+                root.remove(0, group);
+            }
+        });
+    }
+};
+
+
+/* jsproj */
+
+function jsproj(location) {
+    function targetPlatformIdentifierToDevice(jsprojPlatform) {
+        var index = ["Windows", "WindowsPhoneApp"].indexOf(jsprojPlatform);
+        if (index < 0) {
+            throw new Error("Unknown TargetPlatformIdentifier '" + jsprojPlatform + "' in project file '" + location + "'");
+        }
+        return ["windows", "phone"][index];
+    }
+
+    function validateVersion(version) {
+        version = version.split('.');
+        while (version.length < 3) {
+            version.push("0");
+        }
+        return version.join(".");
+    }
+
+    // Class to handle a jsproj file
+    proj.call(this, location);
+
+    var propertyGroup = this.xml.find('PropertyGroup[TargetPlatformIdentifier]');
+    if (!propertyGroup) {
+        throw new Error("Unable to find PropertyGroup/TargetPlatformIdentifier in project file '" + this.location + "'");
+    }
+
+    var jsprojPlatform = propertyGroup.find('TargetPlatformIdentifier').text;
+    this.target = targetPlatformIdentifierToDevice(jsprojPlatform);
+
+    var version = propertyGroup.find('TargetPlatformVersion');
+    if (!version) {
+        throw new Error("Unable to find PropertyGroup/TargetPlatformVersion in project file '" + this.location + "'");
+    }
+    this.version = validateVersion(version.text);
+}
+
+util.inherits(jsproj, proj);
+
+jsproj.prototype.target = null;
+jsproj.prototype.version = null;
+
+/* Common support functions */
+
+function createConditionAttrib(targetConditions) {
+    var arch = targetConditions.arch;
+    if (arch) {
+        if (arch === "arm") {
+            // Specifcally allow "arm" as alternative to "ARM"
+            arch = "ARM";
+        } else if (arch !== "x86" && arch !== "x64" && arch !== "ARM") {
+            throw new Error('Invalid lib-file arch attribute (must be "x86", "x64" or "ARM"): ' + arch);
+        }
+        return "'$(Platform)'=='" + arch + "'";
+    }
+    return null;
+}
+
+
+module.exports = jsprojManager;


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


[10/12] cordova-lib git commit: CB-8420 Make `cordova plugin add FOO` use version from config.xml (close #162)

Posted by st...@apache.org.
CB-8420 Make `cordova plugin add FOO` use version from config.xml (close #162)


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/629b8867
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/629b8867
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/629b8867

Branch: refs/heads/CB-8416
Commit: 629b8867cd44a4d89b5dadd17e1b33f8cbf8b120
Parents: 36194fa
Author: Omar Mefire <om...@microsoft.com>
Authored: Fri Feb 6 18:03:46 2015 -0800
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Feb 11 15:44:03 2015 -0500

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 18 ++----------------
 cordova-lib/src/cordova/plugin.js   | 23 +++++++++++++++++++++++
 cordova-lib/src/cordova/util.js     | 18 +++++++++++++++++-
 3 files changed, 42 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/629b8867/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 214dd61..a1eee41 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -17,7 +17,6 @@
     under the License.
 */
 
-var url = require('url');
 var config            = require('./config'),
     cordova           = require('./cordova'),
     cordova_util      = require('./util'),
@@ -103,7 +102,7 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                 }
                 if (version) {
                     var maybeDir = cordova_util.fixRelativePath(version);
-                    if (isDirectory(maybeDir)) {
+                    if (cordova_util.isDirectory(maybeDir)) {
                         return getPlatformDetailsFromDir(maybeDir, platform);
                     }
                 }
@@ -175,25 +174,12 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
     });
 }
 
-function isDirectory(dir) {
-    try {
-	return fs.lstatSync(dir).isDirectory();
-    } catch(e) {
-	return false;
-    }
-}
-
-function isUrl(value) {
-    var u = value && url.parse(value);
-    return !!(u && u.protocol && u.protocol.length > 1); // Account for windows c:/ paths
-}
-
 // Downloads via npm or via git clone (tries both)
 // Returns a Promise
 function downloadPlatform(projectRoot, platform, version, opts) {
     var target = version ? (platform + '@' + version) : platform;
     return Q().then(function() {
-        if (isUrl(version)) {
+        if (cordova_util.isUrl(version)) {
             events.emit('log', 'git cloning: ' + version);
             return lazy_load.git_clone(version);
         }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/629b8867/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index b044a2f..7f34ddd 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -91,6 +91,8 @@ module.exports = function plugin(command, targets, opts) {
                 return Q.reject(new CordovaError('No plugin specified. Please specify a plugin to add. See `'+cordova_util.binname+' plugin search`.'));
             }
 
+            var xml = cordova_util.projectConfig(projectRoot);
+            var cfg = new ConfigParser(xml);
             var config_json = config.read(projectRoot);
             var searchPath = config_json.plugin_search_path || [];
             if (typeof opts.searchpath == 'string') {
@@ -114,6 +116,22 @@ module.exports = function plugin(command, targets, opts) {
                             target = target.substring(0, target.length - 1);
                         }
 
+                        var parts = target.split('@');
+                        var id = parts[0];
+                        var version = parts[1];
+
+                        // If no version is specified, retrieve the version from config.xml
+                        if(!version && !cordova_util.isUrl(id) && !cordova_util.isDirectory(id)){
+                            events.emit('verbose', 'no version specified, retrieving version from config.xml');
+                            var ver = getVersionFromConfigFile(id, cfg);
+
+                            if( cordova_util.isUrl(ver) || cordova_util.isDirectory(ver) ){
+                                target = ver;
+                            } else {
+                                target = ver ? (id + '@' + ver) : target;
+                            }
+                        }
+
                         // Fetch the plugin first.
                         events.emit('verbose', 'Calling plugman.fetch on plugin "' + target + '"');
                         return plugman.raw.fetch(target, pluginsDir, { searchpath: searchPath, noregistry: opts.noregistry, link: opts.link, pluginInfoProvider: pluginInfoProvider});
@@ -230,6 +248,11 @@ module.exports = function plugin(command, targets, opts) {
     }
 };
 
+function getVersionFromConfigFile(plugin, cfg){
+    var feature = cfg.getFeature(plugin);
+    return feature && feature.params.version; 
+}
+
 function list(projectRoot, hooksRunner) {
     var pluginsList = [];
     return hooksRunner.fire('before_plugin_ls')

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/629b8867/cordova-lib/src/cordova/util.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/util.js b/cordova-lib/src/cordova/util.js
index 700f77a..4382b66 100644
--- a/cordova-lib/src/cordova/util.js
+++ b/cordova-lib/src/cordova/util.js
@@ -21,7 +21,8 @@
 var fs            = require('fs'),
     path          = require('path'),
     CordovaError  = require('../CordovaError'),
-    shell         = require('shelljs');
+    shell         = require('shelljs'),
+    url           = require('url');
 
 // Global configuration paths
 var global_config_path = process.env['CORDOVA_HOME'];
@@ -52,6 +53,13 @@ exports.preProcessOptions = preProcessOptions;
 exports.addModuleProperty = addModuleProperty;
 exports.getOrigWorkingDirectory = getOrigWorkingDirectory;
 exports.fixRelativePath = fixRelativePath;
+exports.isDirectory = isDirectory;
+exports.isUrl = isUrl;
+
+function isUrl(value) {
+    var u = value && url.parse(value);
+    return !!(u && u.protocol && u.protocol.length > 1); // Account for windows c:/ paths
+}
 
 function isRootDir(dir) {
     if (fs.existsSync(path.join(dir, 'www'))) {
@@ -228,6 +236,14 @@ function preProcessOptions (inputOptions) {
     return result;
 }
 
+function isDirectory(dir) {
+    try {
+	return fs.lstatSync(dir).isDirectory();
+    } catch(e) {
+	return false;
+    }
+}
+
 // opt_wrap is a boolean: True means that a callback-based wrapper for the promise-based function
 // should be created.
 function addModuleProperty(module, symbol, modulePath, opt_wrap, opt_obj) {


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


[07/12] cordova-lib git commit: CB-8239 Fix `cordova platform add PATH` when PATH is relative and CWD != project root

Posted by st...@apache.org.
CB-8239 Fix `cordova platform add PATH` when PATH is relative and CWD != project root


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/36194fa6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/36194fa6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/36194fa6

Branch: refs/heads/CB-8416
Commit: 36194fa6e7e0480bc4b8e390cc9b742116dbe420
Parents: b7eabab
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Feb 9 15:40:30 2015 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Feb 9 15:40:30 2015 -0500

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/36194fa6/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 76ca330..214dd61 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -101,8 +101,11 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                     events.emit('verbose', 'No version supplied. Retrieving version from config.xml...');
                     version = getVersionFromConfigFile(platform, cfg);
                 }
-                if (version && isDirectory(version)) {
-                    return getPlatformDetailsFromDir(version, platform);
+                if (version) {
+                    var maybeDir = cordova_util.fixRelativePath(version);
+                    if (isDirectory(maybeDir)) {
+                        return getPlatformDetailsFromDir(maybeDir, platform);
+                    }
                 }
                 return downloadPlatform(projectRoot, platform, version, opts);
             }).then(function(platDetails) {


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


[02/12] cordova-lib git commit: CB-8123 Plugin references can target specific windows platforms.

Posted by st...@apache.org.
CB-8123 Plugin references can target specific windows platforms.

Adds support for `target`, `versions` and `arch` attributes on `<lib-file>` and `<framework>` elements in the windows platform of plugin.xml. This allows plugin authors to target different references to different target platforms.

Also adds support for `src` attribute as an alias for the `Include` attribute on the `<lib-file>` element (since `src` is documented, but `Include` is used by existing plugins).

Adds some tests to cover the new attributes. Updates existing plugin tests for windows8 platform to also test windows platform (left in windows8 tests to help verify backward compatibility with old windows8 platform).

As part of this change, refactored `jsproj` to `jsprojManager` to reflect the fact that, with the windows platform, this class now manages multiple jsproj files.

Note that I plan to rename some windows8 files and folders to windows, and jsproj.js to jsprojManager.js in a subsequent commit.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/8b6f7b9b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/8b6f7b9b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/8b6f7b9b

Branch: refs/heads/CB-8416
Commit: 8b6f7b9b443fe6b35e070bd1ad8ff81df53f559f
Parents: 89795f2
Author: Tim Barham <ti...@microsoft.com>
Authored: Wed Jan 28 11:15:39 2015 -0800
Committer: Tim Barham <ti...@microsoft.com>
Committed: Wed Jan 28 11:15:39 2015 -0800

----------------------------------------------------------------------
 .../spec-plugman/platforms/windows8.spec.js     | 483 +++++++++++++----
 .../org.test.plugins.dummyplugin/plugin.xml     |  20 +-
 .../src/windows8/dummy1.dll                     |   0
 .../src/windows8/dummy1.vcxproj                 |   7 +
 .../src/windows8/dummy2.dll                     |   0
 .../src/windows8/dummy2.vcxproj                 |   7 +
 .../src/windows8/dummy3.dll                     |   0
 .../src/windows8/dummy3.vcxproj                 |   7 +
 .../src/windows8/dummy4.dll                     |   0
 .../src/windows8/dummy4.vcxproj                 |   7 +
 .../org.test.plugins.faultyplugin/plugin.xml    |   8 +-
 .../projects/windows/CordovaApp.Phone.jsproj    |  99 ++++
 .../projects/windows/CordovaApp.Windows.jsproj  |  99 ++++
 .../windows/CordovaApp.Windows80.jsproj         |  93 ++++
 .../projects/windows/CordovaApp.projitems       |  32 ++
 .../projects/windows/CordovaApp.shproj          |  30 ++
 .../projects/windows/CordovaApp.sln             | 134 +++++
 .../projects/windows/CordovaApp.vs2012.sln      |  64 +++
 .../windows/CordovaApp_TemporaryKey.pfx         | Bin 0 -> 2544 bytes
 .../spec-plugman/projects/windows/VERSION       |   1 +
 .../spec-plugman/projects/windows/config.xml    |  14 +
 .../projects/windows/package.phone.appxmanifest |  57 ++
 .../windows/package.windows.appxmanifest        |  58 ++
 .../windows/package.windows80.appxmanifest      |  50 ++
 cordova-lib/src/PluginInfo.js                   |   9 +-
 cordova-lib/src/plugman/platforms/windows.js    |  52 +-
 cordova-lib/src/util/windows/jsproj.js          | 528 +++++++++++++------
 27 files changed, 1575 insertions(+), 284 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/platforms/windows8.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows8.spec.js b/cordova-lib/spec-plugman/platforms/windows8.spec.js
index 22eae93..3d0215a 100644
--- a/cordova-lib/spec-plugman/platforms/windows8.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows8.spec.js
@@ -1,138 +1,413 @@
 /**
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-*/
-var windows8 = require('../../src/plugman/platforms/windows'),
-    common  = require('../../src/plugman/platforms/common'),
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+var windows = require('../../src/plugman/platforms/windows'),
+    common = require('../../src/plugman/platforms/common'),
     install = require('../../src/plugman/install'),
-    path    = require('path'),
-    fs      = require('fs'),
-    shell   = require('shelljs'),
-    et      = require('elementtree'),
-    os      = require('osenv'),
-    temp    = path.join(os.tmpdir(), 'plugman'),
-    plugins_dir = path.join(temp, 'cordova', 'plugins'),
+    path = require('path'),
+    fs = require('fs'),
+    shell = require('shelljs'),
+    et = require('elementtree'),
+    os = require('osenv'),
+    cordovaProjectDir = path.join(os.tmpdir(), 'plugman'),
+    cordovaProjectWindowsPlatformDir = path.join(cordovaProjectDir, 'platforms', 'windows'),
+    cordovaProjectPluginsDir = path.join(cordovaProjectDir, 'plugins'),
     xml_helpers = require('../../src/util/xml-helpers'),
-    plugins_module = require('../../src/plugman/util/plugins'),
     dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
-    faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin'),
-    windows8_project = path.join(__dirname, '..', 'projects', 'windows8');
+    faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin');
 
 var PluginInfo = require('../../src/PluginInfo');
 
 var dummyPluginInfo = new PluginInfo(dummyplugin);
 var dummy_id = dummyPluginInfo.id;
-var valid_source = dummyPluginInfo.getSourceFiles('windows8');
+var valid_source = dummyPluginInfo.getSourceFiles('windows');
+var valid_libfiles = dummyPluginInfo.getLibFiles('windows');
+var valid_frameworks = dummyPluginInfo.getFrameworks('windows');
 
 var faultyPluginInfo = new PluginInfo(faultyplugin);
 var faulty_id = faultyPluginInfo.id;
-var invalid_source = faultyPluginInfo.getSourceFiles('windows8');
-
-shell.mkdir('-p', temp);
-shell.cp('-rf', path.join(windows8_project, '*'), temp);
-var proj_files = windows8.parseProjectFile(temp);
-shell.rm('-rf', temp);
+var invalid_source = faultyPluginInfo.getSourceFiles('windows');
+var invalid_libfiles = faultyPluginInfo.getLibFiles('windows');
 
 function copyArray(arr) {
     return Array.prototype.slice.call(arr, 0);
 }
 
-describe('windows8 project handler', function() {
+beforeEach(function () {
+    this.addMatchers({
+        toContainXmlPath: function (xpath) {
+            var xml = this.actual;
+            var notText = this.isNot ? 'not ' : '';
+            this.message = function () {
+                return 'Expected xml \'' + et.tostring(xml) + '\' ' + notText + 'to contain elements matching \'' + xpath + '\'.';
+            };
 
-    beforeEach(function() {
-        shell.mkdir('-p', temp);
-        shell.mkdir('-p', plugins_dir);
-    });
-    afterEach(function() {
-        shell.rm('-rf', temp);
-    });
+            return xml.find(xpath) != null;
+        }    });
+});
+
+['windows', 'windows8'].forEach(function (platform) {
+    var windows_project = path.join(__dirname, '..', 'projects', platform);
 
-    describe('www_dir method', function() {
-        it('should return cordova-windows8 project www location using www_dir', function() {
-            expect(windows8.www_dir(path.sep)).toEqual(path.sep + 'www');
+    shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+    shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
+    var proj_files = windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
+    shell.rm('-rf', cordovaProjectDir);
+
+    var platformProjects = {
+        windows: {
+            all: 'CordovaApp.projitems',
+            phone: 'CordovaApp.Phone.jsproj',
+            windows: 'CordovaApp.Windows.jsproj',
+            windows8: 'CordovaApp.Windows80.jsproj'
+        }, windows8: {
+            all: 'TestApp.jsproj',
+            windows8: 'TestApp.jsproj'
+        }
+    }[platform];
+
+    describe(platform + ' project handler', function () {
+        beforeEach(function () {
+            shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+            shell.mkdir('-p', cordovaProjectPluginsDir);
         });
-    });
-    describe('package_name method', function() {
-        it('should return a windows8 project\'s proper package name', function() {
-            expect(windows8.package_name(windows8_project)).toEqual("CordovaApp");
+        afterEach(function () {
+            shell.rm('-rf', cordovaProjectDir);
         });
-    });
 
-    describe('parseProjectFile method', function() {
-        it('should throw if project is not an windows8 project', function() {
-            expect(function() {
-                windows8.parseProjectFile(temp);
-            }).toThrow(windows8.InvalidProjectPathError);
+        describe('www_dir method', function () {
+            it('should return cordova-windows project www location using www_dir', function () {
+                expect(windows.www_dir(path.sep)).toEqual(path.sep + 'www');
+            });
         });
-    });
-
-    describe('installation', function() {
-        beforeEach(function() {
-            shell.mkdir('-p', temp);
+        describe('package_name method', function () {
+            it('should return a windows project\'s proper package name', function () {
+                expect(windows.package_name(windows_project)).toEqual("CordovaApp");
+            });
         });
-        afterEach(function() {
-            shell.rm('-rf', temp);
+
+        describe('parseProjectFile method', function () {
+            it('should throw if project is not an windows project', function () {
+                expect(function () {
+                    windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
+                }).toThrow(windows.InvalidProjectPathError);
+            });
         });
-        describe('of <source-file> elements', function() {
-            beforeEach(function() {
-                shell.cp('-rf', path.join(windows8_project, '*'), temp);
+
+        describe('installation', function () {
+            beforeEach(function () {
+                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
             });
-            it('should copy stuff from one location to another by calling common.copyFile', function() {
-                var source = copyArray(valid_source);
-                var s = spyOn(common, 'copyFile');
-                windows8['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
-                expect(s).toHaveBeenCalledWith(dummyplugin, 'src/windows8/dummer.js', temp, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'), false);
+            afterEach(function () {
+                shell.rm('-rf', cordovaProjectDir);
             });
-            it('should throw if source-file src cannot be found', function() {
-                var source = copyArray(invalid_source);
-                expect(function() {
-                    windows8['source-file'].install(source[1], faultyplugin, temp, faulty_id, null, proj_files);
-                }).toThrow('"' + path.resolve(faultyplugin, 'src/windows8/NotHere.js') + '" not found!');
+
+            function validateInstalledProjects(tag, elementToInstall, xpath, supportedPlatforms) {
+                jasmine.getEnv().currentSpec.removeAllSpies();
+
+                var projects = copyArray(proj_files.projects);
+                if (platform === 'windows') {
+                    projects.push(proj_files.master);
+                }
+
+                var appendToRootFake = function (itemGroup) {
+                    expect(itemGroup).toContainXmlPath(xpath);
+                };
+
+                var projectsAddedToSpies = [];
+                var projectsNotAddedToSpies = [];
+
+                var projectsAddedTo = [];
+                supportedPlatforms.forEach(function (platform) {
+                    var platformProject = platformProjects[platform];
+                    if (platformProject) {
+                        projectsAddedTo.push(platformProjects[platform]);
+                    }
+                });
+
+                projects.forEach(function (project) {
+                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
+                        projectsAddedToSpies.push(spyOn(project, 'appendToRoot').andCallFake(appendToRootFake));
+                    } else {
+                        projectsNotAddedToSpies.push(spyOn(project, 'appendToRoot'));
+                    }
+                });
+
+                windows[tag].install(elementToInstall, dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+
+                projectsAddedToSpies.forEach(function (spy) {
+                    expect(spy).toHaveBeenCalled();
+                });
+
+                projectsNotAddedToSpies.forEach(function (spy) {
+                    expect(spy).not.toHaveBeenCalled();
+                });
+            }
+
+            describe('of <source-file> elements', function () {
+                it('should copy stuff from one location to another by calling common.copyFile', function () {
+                    var source = copyArray(valid_source);
+                    var s = spyOn(common, 'copyFile');
+                    windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+                    expect(s).toHaveBeenCalledWith(dummyplugin, 'src/windows8/dummer.js', cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'), false);
+                });
+                it('should throw if source-file src cannot be found', function () {
+                    var source = copyArray(invalid_source);
+                    expect(function () {
+                        windows['source-file'].install(source[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('"' + path.resolve(faultyplugin, 'src/windows8/NotHere.js') + '" not found!');
+                });
+                it('should throw if source-file target already exists', function () {
+                    var source = copyArray(valid_source);
+                    var target = path.join(cordovaProjectWindowsPlatformDir, 'plugins', dummy_id, 'dummer.js');
+                    shell.mkdir('-p', path.dirname(target));
+                    fs.writeFileSync(target, 'some bs', 'utf-8');
+                    expect(function () {
+                        windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+                    }).toThrow('"' + target + '" already exists!');
+                });
             });
-            it('should throw if source-file target already exists', function() {
-                var source = copyArray(valid_source);
-                var target = path.join(temp, 'plugins', dummy_id, 'dummer.js');
-                shell.mkdir('-p', path.dirname(target));
-                fs.writeFileSync(target, 'some bs', 'utf-8');
-                expect(function() {
-                    windows8['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
-                }).toThrow('"' + target + '" already exists!');
+
+            describe('of <lib-file> elements', function () {
+                var libfiles = copyArray(valid_libfiles);
+                var invalidLibFiles = copyArray(invalid_libfiles);
+
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should write to correct project files when conditions are specified', function () {
+                    var xpath = 'SDKReference[@Include="TestSDK1, Version=1.0"][@Condition="\'$(Platform)\'==\'x86\'"]';
+                    validateInstalledProjects('lib-file', libfiles[0], xpath, ['all']);
+
+                    xpath = 'SDKReference[@Include="TestSDK2, Version=1.0"]';
+                    validateInstalledProjects('lib-file', libfiles[1], xpath, ['windows', 'phone']);
+
+                    xpath = 'SDKReference[@Include="TestSDK3, Version=1.0"]';
+                    validateInstalledProjects('lib-file', libfiles[2], xpath, ['phone']);
+
+                    xpath = 'SDKReference[@Include="TestSDK4, Version=1.0"]';
+                    validateInstalledProjects('lib-file', libfiles[3], xpath, ['windows8']);
+                });
+
+                it('should throw if conditions are invalid', function () {
+                    expect(function () {
+                        windows['lib-file'].install(invalidLibFiles[0], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('Invalid lib-file arch attribute (must be "x86", "x64" or "ARM"): x85');
+
+                    expect(function () {
+                        windows['lib-file'].install(invalidLibFiles[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('Invalid lib-file versions attribute (must be a valid a valid node semantic version range): 8.0a');
+
+                    expect(function () {
+                        windows['lib-file'].install(invalidLibFiles[2], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('Invalid lib-file target attribute (must be "all", "phone", "windows" or "win"): daphne');
+                });
             });
-        });
-    });
 
-    describe('uninstallation', function() {
-        beforeEach(function() {
-            shell.mkdir('-p', temp);
-            shell.mkdir('-p', plugins_dir);
-            shell.cp('-rf', path.join(windows8_project, '*'), temp);
-        });
-        afterEach(function() {
-            shell.rm('-rf', temp);
+            describe('of <framework> elements', function () {
+                var frameworks = copyArray(valid_frameworks);
+
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should write to correct project files when conditions are specified', function () {
+                    var xpath = 'Reference[@Include="dummy1"][@Condition="\'$(Platform)\'==\'x64\'"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[0], xpath, ['all']);
+
+                    xpath = 'Reference[@Include="dummy2"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[1], xpath, ['all']);
+
+                    xpath = 'Reference[@Include="dummy3"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[2], xpath, ['windows', 'windows8']);
+
+                    xpath = 'Reference[@Include="dummy4"][@Condition="\'$(Platform)\'==\'ARM\'"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[3], xpath, ['phone']);
+                });
+            });
+
+            describe('of <framework> elements of type \'projectReference\'', function () {
+                var frameworks = copyArray(valid_frameworks);
+
+                it('should write to correct project files when conditions are specified', function () {
+                    var xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy1.vcxproj"][@Condition="\'$(Platform)\'==\'x64\'"]';
+                    validateInstalledProjects('framework', frameworks[4], xpath, ['all']);
+
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy2.vcxproj"]';
+                    validateInstalledProjects('framework', frameworks[5], xpath, ['windows8']);
+
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy3.vcxproj"]';
+                    validateInstalledProjects('framework', frameworks[6], xpath, ['windows', 'windows8']);
+
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows8\\dummy4.vcxproj"][@Condition="\'$(Platform)\'==\'x86\'"]';
+                    validateInstalledProjects('framework', frameworks[7], xpath, ['windows', 'phone']);
+                });
+            });
         });
-        describe('of <source-file> elements', function() {
-            it('should remove stuff by calling common.removeFile', function(done) {
-                var s = spyOn(common, 'removeFile');
-                install('windows8', temp, dummyplugin, plugins_dir, {})
-                .then(function() {
-                    var source = copyArray(valid_source);
-                    windows8['source-file'].uninstall(source[0], temp, dummy_id, null, proj_files);
-                    expect(s).toHaveBeenCalledWith(temp, path.join('plugins',  'org.test.plugins.dummyplugin', 'dummer.js'));
-                    done();
+
+        describe('uninstallation', function () {
+            beforeEach(function () {
+                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+                shell.mkdir('-p', cordovaProjectPluginsDir);
+                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
+            });
+            afterEach(function () {
+                shell.rm('-rf', cordovaProjectDir);
+            });
+
+            function validateUninstalledProjects(tag, elementToUninstall, xmlPath, incText, targetConditions, supportedPlatforms) {
+                jasmine.getEnv().currentSpec.removeAllSpies();
+
+                var projects = copyArray(proj_files.projects);
+                if (platform === 'windows') {
+                    projects.push(proj_files.master);
+                }
+
+                var projectsAddedToSpies = [];
+                var projectsNotAddedToSpies = [];
+
+                var projectsAddedTo = [];
+                supportedPlatforms.forEach(function (platform) {
+                    var platformProject = platformProjects[platform];
+                    if (platformProject) {
+                        projectsAddedTo.push(platformProjects[platform]);
+                    }
+                });
+
+                projects.forEach(function (project) {
+                    var spy = spyOn(project, 'removeReferenceElementItemGroup');
+                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
+                        projectsAddedToSpies.push(spy);
+                    } else {
+                        projectsNotAddedToSpies.push(spy);
+                    }
+                });
+
+                windows[tag].uninstall(elementToUninstall, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+
+                projectsAddedToSpies.forEach(function (spy) {
+                    expect(spy).toHaveBeenCalledWith(xmlPath, incText, targetConditions);
+                });
+
+                projectsNotAddedToSpies.forEach(function (spy) {
+                    expect(spy).not.toHaveBeenCalled();
+                });
+            }
+
+            describe('of <source-file> elements', function () {
+                it('should remove stuff by calling common.removeFile', function (done) {
+                    var s = spyOn(common, 'removeFile');
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var source = copyArray(valid_source);
+                            windows['source-file'].uninstall(source[0], cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+                            expect(s).toHaveBeenCalledWith(cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'));
+                            done();
+                        });
+                });
+            });
+
+            describe('of <lib-file> elements', function () {
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should remove from correct project files when conditions specified', function (done) {
+                    var libfiles = copyArray(valid_libfiles);
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var path = 'ItemGroup/SDKReference';
+                            var incText = 'TestSDK1, Version=1.0';
+                            var targetConditions = {versions: undefined, target: undefined, arch: 'x86'};
+                            validateUninstalledProjects('lib-file', libfiles[0], path, incText, targetConditions, ['all']);
+
+                            incText = 'TestSDK2, Version=1.0';
+                            targetConditions = {versions: '>=8.1', target: undefined, arch: undefined};
+                            validateUninstalledProjects('lib-file', libfiles[1], path, incText, targetConditions, ['windows', 'phone']);
+
+                            incText = 'TestSDK3, Version=1.0';
+                            targetConditions = {versions: undefined, target: 'phone', arch: undefined};
+                            validateUninstalledProjects('lib-file', libfiles[2], path, incText, targetConditions, ['phone']);
+
+                            incText = 'TestSDK4, Version=1.0';
+                            targetConditions = {versions: '8.0', target: 'windows', arch: 'x86'};
+                            validateUninstalledProjects('lib-file', libfiles[3], path, incText, targetConditions, ['windows8']);
+
+                            done();
+                        });
+                });
+            });
+
+            describe('of <framework> elements', function () {
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should remove from correct project files when conditions specified', function (done) {
+                    var frameworks = copyArray(valid_frameworks);
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var path = 'ItemGroup/Reference';
+                            var incText = 'dummy1';
+                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
+                            validateUninstalledProjects('framework', frameworks[0], path, incText, targetConditions, ['all']);
+
+                            incText = 'dummy2';
+                            targetConditions = {versions: '>=8.0', target: undefined, arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[1], path, incText, targetConditions, ['all']);
+
+                            incText = 'dummy3';
+                            targetConditions = {versions: undefined, target: 'windows', arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[2], path, incText, targetConditions, ['windows', 'windows8']);
+
+                            incText = 'dummy4';
+                            targetConditions = {versions: '8.1', target: 'phone', arch: 'ARM'};
+                            validateUninstalledProjects('framework', frameworks[3], path, incText, targetConditions, ['phone']);
+
+                            done();
+                        });
+                });
+            });
+
+            describe('of <framework> elements of type \'projectReference\'', function () {
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should remove from correct project files when conditions specified', function (done) {
+                    var frameworks = copyArray(valid_frameworks);
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var path = 'ItemGroup/ProjectReference';
+                            var incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy1.vcxproj';
+                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
+                            validateUninstalledProjects('framework', frameworks[4], path, incText, targetConditions, ['all']);
+
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy2.vcxproj';
+                            targetConditions = {versions: '<8.1', target: undefined, arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[5], path, incText, targetConditions, ['windows8']);
+
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy3.vcxproj';
+                            targetConditions = {versions: undefined, target: 'win', arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[6], path, incText, targetConditions, ['windows', 'windows8']);
+
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows8\\dummy4.vcxproj';
+                            targetConditions = {versions: '8.1', target: 'all', arch: 'x86'};
+                            validateUninstalledProjects('framework', frameworks[7], path, incText, targetConditions, ['windows', 'phone']);
+
+                            done();
+                        });
                 });
             });
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
index 0d7d94b..1f265dd 100644
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
@@ -172,13 +172,29 @@
         <source-file src="src/tizen/dummer.js"/>
     </platform>
 
-    <!-- windows8 -->
-    <platform name="windows8">
+    <!-- windows -->
+    <platform name="windows">
         <config-file target="config.xml" parent="/*">
             <feature id="dummyPlugin" required="true" version="1.0.0.0"/>
         </config-file>
 
         <source-file src="src/windows8/dummer.js"/>
+
+        <lib-file src="TestSDK1, Version=1.0" arch="x86"/>
+        <lib-file src="TestSDK2, Version=1.0" versions=">=8.1"/>
+        <lib-file src="TestSDK3, Version=1.0" target="phone"/>
+        <lib-file src="TestSDK4, Version=1.0" target="windows" versions="8.0" arch="x86"/>
+
+        <framework src="src/windows8/dummy1.dll" arch="x64"/>
+        <framework src="src/windows8/dummy2.dll" versions=">=8.0"/>
+        <framework src="src/windows8/dummy3.dll" target="windows"/>
+        <framework src="src/windows8/dummy4.dll" target="phone" versions="8.1" arch="ARM"/>
+
+        <framework src="src/windows8/dummy1.vcxproj" type="projectReference" arch="x64"/>
+        <framework src="src/windows8/dummy2.vcxproj" type="projectReference" versions="<8.1"/>
+        <framework src="src/windows8/dummy3.vcxproj" type="projectReference" target="win"/>
+        <framework src="src/windows8/dummy4.vcxproj" type="projectReference" target="all" versions="8.1" arch="x86"/>
+
         <js-module src="www/dummyplugin.js" name="Dummy">
             <clobbers target="dummy" />
         </js-module>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj
new file mode 100644
index 0000000..c454905
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy1.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{ef7dd979-6f12-4bdf-8754-9468ce799c4d}</ProjectGuid>
+        <ProjectName>dummy1</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj
new file mode 100644
index 0000000..8edd706
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy2.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{6a760eea-8c27-442e-b98b-a487964ded42}</ProjectGuid>
+        <ProjectName>dummy2</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj
new file mode 100644
index 0000000..600167c
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy3.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{5318c3c8-0921-4870-b4ad-8cce06c88238}</ProjectGuid>
+        <ProjectName>dummy3</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.dll
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.dll b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.dll
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj
new file mode 100644
index 0000000..d7acf04
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/windows8/dummy4.vcxproj
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup Label="Globals">
+        <ProjectGuid>{8e430a1b-094b-4c27-8b76-fdd7021dbfe9}</ProjectGuid>
+        <ProjectName>dummy4</ProjectName>
+    </PropertyGroup>
+</Project>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
index 08079f2..1b38414 100644
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.faultyplugin/plugin.xml
@@ -131,8 +131,8 @@
         <source-file src="src/wp8/NotHere.cs" />
     </platform>
 
-    <!-- wp8 -->
-    <platform name="windows8">
+    <!-- windows -->
+    <platform name="windows">
         <config-file target="config.xml" parent="/*">
             <feature name="org.test.plugins.faultyplugin">
                 <param name="windows8-package" value="org.test.plugins.faultyplugin"/>
@@ -141,6 +141,10 @@
 
         <source-file src="src/windows8/faultyPlugin.js" />
 
+        <lib-file src="TestSDK1, Version=1.0" arch="x85"/>
+        <lib-file src="TestSDK2, Version=1.0" versions="8.0a"/>
+        <lib-file src="TestSDK3, Version=1.0" target="daphne"/>
+
         <!-- does not exist -->
         <source-file src="src/windows8/NotHere.js" />
     </platform>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Phone.jsproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.Phone.jsproj b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Phone.jsproj
new file mode 100644
index 0000000..43e4fe2
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Phone.jsproj
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <OutputPath>build\phone\$(Configuration)\$(Platform)\</OutputPath>
+    <IntermediateOutputPath>build\phone\bld\</IntermediateOutputPath>
+  </PropertyGroup>
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|AnyCPU">
+      <Configuration>Debug</Configuration>
+      <Platform>AnyCPU</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x86">
+      <Configuration>Debug</Configuration>
+      <Platform>x86</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|AnyCPU">
+      <Configuration>Release</Configuration>
+      <Platform>AnyCPU</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x86">
+      <Configuration>Release</Configuration>
+      <Platform>x86</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>31b67a35-9503-4213-857e-f44eb42ae549</ProjectGuid>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0'">
+    <VisualStudioVersion>12.0</VisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
+  <PropertyGroup Label="Configuration">
+    <TargetPlatformIdentifier>WindowsPhoneApp</TargetPlatformIdentifier>
+    <TargetPlatformVersion>8.1</TargetPlatformVersion>
+    <RequiredPlatformVersion>8.1</RequiredPlatformVersion>
+    <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).props" />
+  <PropertyGroup>
+    <DefaultLanguage>en-US</DefaultLanguage>
+  </PropertyGroup>
+  <ItemGroup>
+    <AppxManifest Include="package.phone.appxmanifest">
+      <SubType>Designer</SubType>
+    </AppxManifest>
+    <Content Include="images\*.png" Exclude="images\*.scale-180.*" />
+  </ItemGroup>
+  <ItemGroup>
+    <SDKReference Include="Microsoft.Phone.WinJS.2.1, Version=1.0" />
+  </ItemGroup>
+  <Import Project="CordovaApp.projitems" Label="Shared" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
+  <!-- To modify your build process, add your task inside one of the targets below then uncomment
+       that target and the DisableFastUpToDateCheck PropertyGroup. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  <PropertyGroup>
+    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
+  </PropertyGroup>
+  -->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows.jsproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows.jsproj b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows.jsproj
new file mode 100644
index 0000000..6905ba6
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows.jsproj
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <OutputPath>build\windows\$(Configuration)\$(Platform)\</OutputPath>
+  <IntermediateOutputPath>build\windows\bld\</IntermediateOutputPath>
+  </PropertyGroup>
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|AnyCPU">
+      <Configuration>Debug</Configuration>
+      <Platform>AnyCPU</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x86">
+      <Configuration>Debug</Configuration>
+      <Platform>x86</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|AnyCPU">
+      <Configuration>Release</Configuration>
+      <Platform>AnyCPU</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x86">
+      <Configuration>Release</Configuration>
+      <Platform>x86</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>58950fb6-2f93-4963-b9cd-637f83f3efbf</ProjectGuid>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0'">
+    <VisualStudioVersion>12.0</VisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).props" />
+  <PropertyGroup>
+    <TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
+    <TargetPlatformVersion>8.1</TargetPlatformVersion>
+    <RequiredPlatformVersion>8.1</RequiredPlatformVersion>
+    <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <PackageCertificateKeyFile>CordovaApp_TemporaryKey.pfx</PackageCertificateKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <AppxManifest Include="package.windows.appxmanifest">
+      <SubType>Designer</SubType>
+    </AppxManifest>
+    <Content Include="images\*.png" Exclude="images\*.scale-240.*" />
+    <None Include="CordovaApp_TemporaryKey.pfx" />
+  </ItemGroup>
+  <ItemGroup>
+    <SDKReference Include="Microsoft.WinJS.2.0, Version=1.0" />
+  </ItemGroup>
+  <Import Project="CordovaApp.projitems" Label="Shared" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
+  <!-- To modify your build process, add your task inside one of the targets below then uncomment
+       that target and the DisableFastUpToDateCheck PropertyGroup. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  <PropertyGroup>
+    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
+  </PropertyGroup>
+  -->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows80.jsproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows80.jsproj b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows80.jsproj
new file mode 100644
index 0000000..34d1985
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.Windows80.jsproj
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <OutputPath>build\windows80\$(Configuration)\$(Platform)\</OutputPath>
+    <IntermediateOutputPath>build\windows80\bld\</IntermediateOutputPath>
+  </PropertyGroup>
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|AnyCPU">
+      <Configuration>Debug</Configuration>
+      <Platform>AnyCPU</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x86">
+      <Configuration>Debug</Configuration>
+      <Platform>x86</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|AnyCPU">
+      <Configuration>Release</Configuration>
+      <Platform>AnyCPU</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x86">
+      <Configuration>Release</Configuration>
+      <Platform>x86</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>efffab2f-bfc5-4eda-b545-45ef4995f55a</ProjectGuid>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0'">
+    <VisualStudioVersion>11.0</VisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).props" />
+  <PropertyGroup>
+    <TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
+    <TargetPlatformVersion>8.0</TargetPlatformVersion>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <PackageCertificateKeyFile>CordovaApp_TemporaryKey.pfx</PackageCertificateKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <AppxManifest Include="package.windows80.appxmanifest">
+      <SubType>Designer</SubType>
+    </AppxManifest>
+    <Content Include="images\*.png" Exclude="images\*.scale-240.*" />
+    <None Include="CordovaApp_TemporaryKey.pfx" />
+  </ItemGroup>
+  <ItemGroup>
+    <SDKReference Include="Microsoft.WinJS.1.0, Version=1.0" />
+  </ItemGroup>
+  <Import Project="CordovaApp.projitems" Label="Shared" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
+  <PropertyGroup>
+    <BuildFromCordovaTooling>false</BuildFromCordovaTooling>
+    <PreBuildEvent Condition="$(BuildFromCordovaTooling) != true">
+      cd /d $(MSBuildThisFileDirectory)
+      node -e "require('./cordova/lib/prepare.js').applyPlatformConfig()"
+    </PreBuildEvent>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp.projitems
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.projitems b/cordova-lib/spec-plugman/projects/windows/CordovaApp.projitems
new file mode 100644
index 0000000..972a1a4
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.projitems
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
+    <HasSharedItems>true</HasSharedItems>
+    <SharedGUID>9ebdb27f-d75b-4d8c-b53f-7be4a1fe89f9</SharedGUID>
+  </PropertyGroup>
+  <ItemGroup>
+    <Content Include="$(MSBuildThisFileDirectory)www\**" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="$(MSBuildThisFileDirectory)config.xml" />
+  </ItemGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp.shproj
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.shproj b/cordova-lib/spec-plugman/projects/windows/CordovaApp.shproj
new file mode 100644
index 0000000..08b59df
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.shproj
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{9ebdb27f-d75b-4d8c-b53f-7be4a1fe89f9}</ProjectGuid>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
+  <PropertyGroup />
+  <Import Project="CordovaApp.projitems" Label="Shared" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.CodeSharing.JavaScript.targets" />
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp.sln
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.sln b/cordova-lib/spec-plugman/projects/windows/CordovaApp.sln
new file mode 100644
index 0000000..71caade
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.sln
@@ -0,0 +1,134 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+VisualStudioVersion = 12.0.30324.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CordovaApp", "CordovaApp", "{3A47E08D-7EA5-4F3F-AA6D-1D4A41F26944}"
+EndProject
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CordovaApp", "CordovaApp.shproj", "{9EBDB27F-D75B-4D8C-B53F-7BE4A1FE89F9}"
+EndProject
+Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "CordovaApp.Windows8.0", "CordovaApp.Windows80.jsproj", "{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}"
+EndProject
+Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "CordovaApp.Windows", "CordovaApp.Windows.jsproj", "{58950FB6-2F93-4963-B9CD-637F83F3EFBF}"
+EndProject
+Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "CordovaApp.Phone", "CordovaApp.Phone.jsproj", "{31B67A35-9503-4213-857E-F44EB42AE549}"
+EndProject
+Global
+	GlobalSection(SharedMSBuildProjectFiles) = preSolution
+		CordovaApp.projitems*{58950fb6-2f93-4963-b9cd-637f83f3efbf}*SharedItemsImports = 5
+		CordovaApp.projitems*{efffab2f-bfc5-4eda-b545-45ef4995f55a}*SharedItemsImports = 5
+		CordovaApp.projitems*{9ebdb27f-d75b-4d8c-b53f-7be4a1fe89f9}*SharedItemsImports = 13
+		CordovaApp.projitems*{31b67a35-9503-4213-857e-f44eb42ae549}*SharedItemsImports = 5
+	EndGlobalSection
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|ARM = Debug|ARM
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|ARM = Release|ARM
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|ARM.ActiveCfg = Debug|ARM
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|ARM.Build.0 = Debug|ARM
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|ARM.Deploy.0 = Debug|ARM
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|x64.ActiveCfg = Debug|x64
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|x64.Build.0 = Debug|x64
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|x64.Deploy.0 = Debug|x64
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|x86.ActiveCfg = Debug|x86
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|x86.Build.0 = Debug|x86
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Debug|x86.Deploy.0 = Debug|x86
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|Any CPU.Build.0 = Release|Any CPU
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|ARM.ActiveCfg = Release|ARM
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|ARM.Build.0 = Release|ARM
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|ARM.Deploy.0 = Release|ARM
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|x64.ActiveCfg = Release|x64
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|x64.Build.0 = Release|x64
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|x64.Deploy.0 = Release|x64
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|x86.ActiveCfg = Release|x86
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|x86.Build.0 = Release|x86
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF}.Release|x86.Deploy.0 = Release|x86
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|ARM.ActiveCfg = Debug|ARM
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|ARM.Build.0 = Debug|ARM
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|ARM.Deploy.0 = Debug|ARM
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|x64.ActiveCfg = Debug|x64
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|x64.Build.0 = Debug|x64
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|x64.Deploy.0 = Debug|x64
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|x86.ActiveCfg = Debug|x86
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|x86.Build.0 = Debug|x86
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Debug|x86.Deploy.0 = Debug|x86
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|Any CPU.Build.0 = Release|Any CPU
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|ARM.ActiveCfg = Release|ARM
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|ARM.Build.0 = Release|ARM
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|ARM.Deploy.0 = Release|ARM
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|x64.ActiveCfg = Release|x64
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|x64.Build.0 = Release|x64
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|x64.Deploy.0 = Release|x64
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|x86.ActiveCfg = Release|x86
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|x86.Build.0 = Release|x86
+		{31B67A35-9503-4213-857E-F44EB42AE549}.Release|x86.Deploy.0 = Release|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.ActiveCfg = Debug|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.Build.0 = Debug|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.Deploy.0 = Debug|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.ActiveCfg = Debug|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.Build.0 = Debug|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.Deploy.0 = Debug|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.ActiveCfg = Debug|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.Build.0 = Debug|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.Deploy.0 = Debug|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.ActiveCfg = Release|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.Build.0 = Release|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.Deploy.0 = Release|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.ActiveCfg = Release|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.Build.0 = Release|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.Deploy.0 = Release|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.ActiveCfg = Release|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.Build.0 = Release|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.Deploy.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{9EBDB27F-D75B-4D8C-B53F-7BE4A1FE89F9} = {3A47E08D-7EA5-4F3F-AA6D-1D4A41F26944}
+		{58950FB6-2F93-4963-B9CD-637F83F3EFBF} = {3A47E08D-7EA5-4F3F-AA6D-1D4A41F26944}
+		{31B67A35-9503-4213-857E-F44EB42AE549} = {3A47E08D-7EA5-4F3F-AA6D-1D4A41F26944}
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A} = {3A47E08D-7EA5-4F3F-AA6D-1D4A41F26944}
+	EndGlobalSection
+EndGlobal

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp.vs2012.sln
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp.vs2012.sln b/cordova-lib/spec-plugman/projects/windows/CordovaApp.vs2012.sln
new file mode 100644
index 0000000..b08ca94
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/CordovaApp.vs2012.sln
@@ -0,0 +1,64 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "CordovaApp.Windows8.0", "CordovaApp.Windows80.jsproj", "{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|AnyCPU = Debug|AnyCPU
+		Debug|ARM = Debug|ARM
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|AnyCPU = Release|AnyCPU
+		Release|ARM = Release|ARM
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|AnyCPU.Build.0 = Debug|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|AnyCPU.Deploy.0 = Debug|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.ActiveCfg = Debug|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.Build.0 = Debug|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.Deploy.0 = Debug|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.ActiveCfg = Debug|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.Build.0 = Debug|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.Deploy.0 = Debug|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.ActiveCfg = Debug|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.Build.0 = Debug|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.Deploy.0 = Debug|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|AnyCPU.ActiveCfg = Release|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|AnyCPU.Build.0 = Release|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|AnyCPU.Deploy.0 = Release|Any CPU
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.ActiveCfg = Release|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.Build.0 = Release|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.Deploy.0 = Release|ARM
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.ActiveCfg = Release|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.Build.0 = Release|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.Deploy.0 = Release|x64
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.ActiveCfg = Release|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.Build.0 = Release|x86
+		{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.Deploy.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/CordovaApp_TemporaryKey.pfx
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/CordovaApp_TemporaryKey.pfx b/cordova-lib/spec-plugman/projects/windows/CordovaApp_TemporaryKey.pfx
new file mode 100644
index 0000000..90d7ab2
Binary files /dev/null and b/cordova-lib/spec-plugman/projects/windows/CordovaApp_TemporaryKey.pfx differ

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/VERSION
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/VERSION b/cordova-lib/spec-plugman/projects/windows/VERSION
new file mode 100644
index 0000000..a76ccff
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/VERSION
@@ -0,0 +1 @@
+3.7.1

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/config.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/config.xml b/cordova-lib/spec-plugman/projects/windows/config.xml
new file mode 100644
index 0000000..621d9c9
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/config.xml
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='utf-8'?>
+<widget id="io.cordova.cordovaapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+    <preference name="windows-target-version" value="8.0" />
+    <preference name="windows-phone-target-version" value="8.1" />
+    <name>CordovaApp</name>
+    <description>
+        A sample Apache Cordova application that responds to the deviceready event.
+    </description>
+    <author email="dev@cordova.apache.org" href="http://cordova.io">
+        Apache Cordova Team
+    </author>
+    <content src="index.html" />
+    <access origin="*" />
+</widget>

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/package.phone.appxmanifest
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/package.phone.appxmanifest b/cordova-lib/spec-plugman/projects/windows/package.phone.appxmanifest
new file mode 100644
index 0000000..c8644d4
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/package.phone.appxmanifest
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
+  <Identity Name="d409db80-9793-11e4-8ffa-f71ca5ee087f" Version="1.0.0.0" Publisher="CN=$username$" />
+  <mp:PhoneIdentity PhoneProductId="d409db80-9793-11e4-8ffa-f71ca5ee087f" PhonePublisherId="db093ed5-53b1-45f7-af72-751e8f36ab80" />
+  <Properties>
+    <DisplayName>CordovaApp</DisplayName>
+    <PublisherDisplayName>$username$</PublisherDisplayName>
+    <Logo>images\StoreLogo.png</Logo>
+  </Properties>
+  <Prerequisites>
+    <OSMinVersion>6.3.1</OSMinVersion>
+    <OSMaxVersionTested>6.3.1</OSMaxVersionTested>
+  </Prerequisites>
+  <Resources>
+    <Resource Language="x-generate" />
+  </Resources>
+  <Applications>
+    <Application Id="io.cordova.cordovaapp" StartPage="www/index.html">
+      <m3:VisualElements DisplayName="CordovaApp"
+                         Square150x150Logo="images\Square150x150Logo.png"
+                         Square44x44Logo="images\Square44x44Logo.png"
+                         Description="CordovaApp"
+                         ForegroundText="light"
+                         BackgroundColor="transparent">
+        <m3:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png"
+                        Square71x71Logo="images\Square71x71Logo.png">
+          <m3:ShowNameOnTiles>
+            <m3:ShowOn Tile="square150x150Logo" />
+            <m3:ShowOn Tile="wide310x150Logo" />
+          </m3:ShowNameOnTiles>
+        </m3:DefaultTile>
+        <m3:SplashScreen Image="images\SplashScreenPhone.png" />
+      </m3:VisualElements>
+    </Application>
+  </Applications>
+  <Capabilities>
+    <Capability Name="internetClientServer" />
+  </Capabilities>
+</Package>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/package.windows.appxmanifest
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/package.windows.appxmanifest b/cordova-lib/spec-plugman/projects/windows/package.windows.appxmanifest
new file mode 100644
index 0000000..782980e
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/package.windows.appxmanifest
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
+  <Identity Name="d409db80-9793-11e4-8ffa-f71ca5ee087f" Version="1.0.0.0" Publisher="CN=$username$" />
+  <Properties>
+    <DisplayName>CordovaApp</DisplayName>
+    <PublisherDisplayName>$username$</PublisherDisplayName>
+    <Logo>images\StoreLogo.png</Logo>
+  </Properties>
+  <Prerequisites>
+    <OSMinVersion>6.3.0</OSMinVersion>
+    <OSMaxVersionTested>6.3.0</OSMaxVersionTested>
+  </Prerequisites>
+  <Resources>
+    <Resource Language="x-generate" />
+  </Resources>
+  <Applications>
+    <Application Id="io.cordova.cordovaapp" StartPage="www/index.html">
+      <m2:VisualElements DisplayName="CordovaApp"
+                         Description="CordovaApp"
+                         ForegroundText="light"
+                         BackgroundColor="#464646"
+                         Square150x150Logo="images\Square150x150Logo.png"
+                         Square30x30Logo="images\Square30x30Logo.png">
+        <m2:DefaultTile Square70x70Logo="images\Square70x70Logo.png"
+                        Square310x310Logo="images\Square310x310Logo.png"
+                        Wide310x150Logo="images\Wide310x150Logo.png">
+          <m2:ShowNameOnTiles>
+            <m2:ShowOn Tile="square150x150Logo" />
+            <m2:ShowOn Tile="wide310x150Logo" />
+            <m2:ShowOn Tile="square310x310Logo" />
+          </m2:ShowNameOnTiles>
+        </m2:DefaultTile>
+        <m2:SplashScreen Image="images\SplashScreen.png" />
+      </m2:VisualElements>
+    </Application>
+  </Applications>
+  <Capabilities>
+    <Capability Name="internetClient" />
+  </Capabilities>
+</Package>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/spec-plugman/projects/windows/package.windows80.appxmanifest
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/projects/windows/package.windows80.appxmanifest b/cordova-lib/spec-plugman/projects/windows/package.windows80.appxmanifest
new file mode 100644
index 0000000..af9b9d9
--- /dev/null
+++ b/cordova-lib/spec-plugman/projects/windows/package.windows80.appxmanifest
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
+  <Identity Name="d409db80-9793-11e4-8ffa-f71ca5ee087f" Version="1.0.0.0" Publisher="CN=$username$" />
+  <Properties>
+    <DisplayName>CordovaApp</DisplayName>
+    <PublisherDisplayName>$username$</PublisherDisplayName>
+    <Logo>images\storelogo.png</Logo>
+  </Properties>
+  <Prerequisites>
+    <OSMinVersion>6.2.1</OSMinVersion>
+    <OSMaxVersionTested>6.2.1</OSMaxVersionTested>
+  </Prerequisites>
+  <Resources>
+    <Resource Language="x-generate" />
+  </Resources>
+  <Applications>
+    <Application Id="io.cordova.cordovaapp" StartPage="www/index.html">
+      <VisualElements DisplayName="CordovaApp"
+                      Logo="images\Square150x150Logo.png" 
+                      SmallLogo="images\Square30x30Logo.png"
+                      Description="CordovaApp" 
+                      ForegroundText="light" 
+                      BackgroundColor="#464646">
+        <DefaultTile ShowName="allLogos" WideLogo="images\Wide310x150Logo.png"/>
+        <SplashScreen Image="images\splashscreen.png" />
+      </VisualElements>
+    </Application>
+  </Applications>
+  <Capabilities>
+    <Capability Name="internetClient" />
+  </Capabilities>
+</Package>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8b6f7b9b/cordova-lib/src/PluginInfo.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/PluginInfo.js b/cordova-lib/src/PluginInfo.js
index 8375d74..a9c06b6 100644
--- a/cordova-lib/src/PluginInfo.js
+++ b/cordova-lib/src/PluginInfo.js
@@ -205,7 +205,9 @@ function PluginInfo(dirname) {
             return {
                 src: tag.attrib.src,
                 arch: tag.attrib.arch,
-                Include: tag.attrib.Include
+                Include: tag.attrib.Include,
+                versions: tag.attrib.versions,
+                target: tag.attrib.target
             };
         });
         return libFiles;
@@ -273,7 +275,10 @@ function PluginInfo(dirname) {
                 parent: el.attrib.parent,
                 custom: isStrTrue(el.attrib.custom),
                 src: el.attrib.src,
-                weak: isStrTrue(el.attrib.weak)
+                weak: isStrTrue(el.attrib.weak),
+                versions: el.attrib.versions,
+                target: el.attrib.target,
+                arch: el.attrib.arch
             };
             return ret;
         });


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


[04/12] cordova-lib git commit: CB-8123 Rename further windows platform related files.

Posted by st...@apache.org.
CB-8123 Rename further windows platform related files.

Renames `windows8.spec.js` to `windows.spec.js`.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/22a214f2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/22a214f2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/22a214f2

Branch: refs/heads/CB-8416
Commit: 22a214f217014b8c2df0348025d734cdf03580a7
Parents: 48852ee
Author: Tim Barham <ti...@microsoft.com>
Authored: Wed Jan 28 11:31:48 2015 -0800
Committer: Tim Barham <ti...@microsoft.com>
Committed: Wed Jan 28 11:31:48 2015 -0800

----------------------------------------------------------------------
 .../spec-plugman/platforms/windows.spec.js      | 415 +++++++++++++++++++
 .../spec-plugman/platforms/windows8.spec.js     | 415 -------------------
 2 files changed, 415 insertions(+), 415 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/22a214f2/cordova-lib/spec-plugman/platforms/windows.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows.spec.js b/cordova-lib/spec-plugman/platforms/windows.spec.js
new file mode 100644
index 0000000..444c987
--- /dev/null
+++ b/cordova-lib/spec-plugman/platforms/windows.spec.js
@@ -0,0 +1,415 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+var windows = require('../../src/plugman/platforms/windows'),
+    common = require('../../src/plugman/platforms/common'),
+    install = require('../../src/plugman/install'),
+    path = require('path'),
+    fs = require('fs'),
+    shell = require('shelljs'),
+    et = require('elementtree'),
+    os = require('osenv'),
+    cordovaProjectDir = path.join(os.tmpdir(), 'plugman'),
+    cordovaProjectWindowsPlatformDir = path.join(cordovaProjectDir, 'platforms', 'windows'),
+    cordovaProjectPluginsDir = path.join(cordovaProjectDir, 'plugins'),
+    xml_helpers = require('../../src/util/xml-helpers'),
+    dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
+    faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin');
+
+var PluginInfo = require('../../src/PluginInfo');
+
+var dummyPluginInfo = new PluginInfo(dummyplugin);
+var dummy_id = dummyPluginInfo.id;
+var valid_source = dummyPluginInfo.getSourceFiles('windows');
+var valid_libfiles = dummyPluginInfo.getLibFiles('windows');
+var valid_frameworks = dummyPluginInfo.getFrameworks('windows');
+
+var faultyPluginInfo = new PluginInfo(faultyplugin);
+var faulty_id = faultyPluginInfo.id;
+var invalid_source = faultyPluginInfo.getSourceFiles('windows');
+var invalid_libfiles = faultyPluginInfo.getLibFiles('windows');
+
+function copyArray(arr) {
+    return Array.prototype.slice.call(arr, 0);
+}
+
+beforeEach(function () {
+    this.addMatchers({
+        toContainXmlPath: function (xpath) {
+            var xml = this.actual;
+            var notText = this.isNot ? 'not ' : '';
+            this.message = function () {
+                return 'Expected xml \'' + et.tostring(xml) + '\' ' + notText + 'to contain elements matching \'' + xpath + '\'.';
+            };
+
+            return xml.find(xpath) != null;
+        }    });
+});
+
+['windows', 'windows8'].forEach(function (platform) {
+    var windows_project = path.join(__dirname, '..', 'projects', platform);
+
+    shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+    shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
+    var proj_files = windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
+    shell.rm('-rf', cordovaProjectDir);
+
+    var platformProjects = {
+        windows: {
+            all: 'CordovaApp.projitems',
+            phone: 'CordovaApp.Phone.jsproj',
+            windows: 'CordovaApp.Windows.jsproj',
+            windows8: 'CordovaApp.Windows80.jsproj'
+        }, windows8: {
+            all: 'TestApp.jsproj',
+            windows8: 'TestApp.jsproj'
+        }
+    }[platform];
+
+    describe(platform + ' project handler', function () {
+        beforeEach(function () {
+            shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+            shell.mkdir('-p', cordovaProjectPluginsDir);
+        });
+        afterEach(function () {
+            shell.rm('-rf', cordovaProjectDir);
+        });
+
+        describe('www_dir method', function () {
+            it('should return cordova-windows project www location using www_dir', function () {
+                expect(windows.www_dir(path.sep)).toEqual(path.sep + 'www');
+            });
+        });
+        describe('package_name method', function () {
+            it('should return a windows project\'s proper package name', function () {
+                expect(windows.package_name(windows_project)).toEqual("CordovaApp");
+            });
+        });
+
+        describe('parseProjectFile method', function () {
+            it('should throw if project is not an windows project', function () {
+                expect(function () {
+                    windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
+                }).toThrow(windows.InvalidProjectPathError);
+            });
+        });
+
+        describe('installation', function () {
+            beforeEach(function () {
+                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
+            });
+            afterEach(function () {
+                shell.rm('-rf', cordovaProjectDir);
+            });
+
+            function validateInstalledProjects(tag, elementToInstall, xpath, supportedPlatforms) {
+                jasmine.getEnv().currentSpec.removeAllSpies();
+
+                var projects = copyArray(proj_files.projects);
+                if (platform === 'windows') {
+                    projects.push(proj_files.master);
+                }
+
+                var appendToRootFake = function (itemGroup) {
+                    expect(itemGroup).toContainXmlPath(xpath);
+                };
+
+                var projectsAddedToSpies = [];
+                var projectsNotAddedToSpies = [];
+
+                var projectsAddedTo = [];
+                supportedPlatforms.forEach(function (platform) {
+                    var platformProject = platformProjects[platform];
+                    if (platformProject) {
+                        projectsAddedTo.push(platformProjects[platform]);
+                    }
+                });
+
+                projects.forEach(function (project) {
+                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
+                        projectsAddedToSpies.push(spyOn(project, 'appendToRoot').andCallFake(appendToRootFake));
+                    } else {
+                        projectsNotAddedToSpies.push(spyOn(project, 'appendToRoot'));
+                    }
+                });
+
+                windows[tag].install(elementToInstall, dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+
+                projectsAddedToSpies.forEach(function (spy) {
+                    expect(spy).toHaveBeenCalled();
+                });
+
+                projectsNotAddedToSpies.forEach(function (spy) {
+                    expect(spy).not.toHaveBeenCalled();
+                });
+            }
+
+            describe('of <source-file> elements', function () {
+                it('should copy stuff from one location to another by calling common.copyFile', function () {
+                    var source = copyArray(valid_source);
+                    var s = spyOn(common, 'copyFile');
+                    windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+                    expect(s).toHaveBeenCalledWith(dummyplugin, 'src/windows/dummer.js', cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'), false);
+                });
+                it('should throw if source-file src cannot be found', function () {
+                    var source = copyArray(invalid_source);
+                    expect(function () {
+                        windows['source-file'].install(source[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('"' + path.resolve(faultyplugin, 'src/windows/NotHere.js') + '" not found!');
+                });
+                it('should throw if source-file target already exists', function () {
+                    var source = copyArray(valid_source);
+                    var target = path.join(cordovaProjectWindowsPlatformDir, 'plugins', dummy_id, 'dummer.js');
+                    shell.mkdir('-p', path.dirname(target));
+                    fs.writeFileSync(target, 'some bs', 'utf-8');
+                    expect(function () {
+                        windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+                    }).toThrow('"' + target + '" already exists!');
+                });
+            });
+
+            describe('of <lib-file> elements', function () {
+                var libfiles = copyArray(valid_libfiles);
+                var invalidLibFiles = copyArray(invalid_libfiles);
+
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should write to correct project files when conditions are specified', function () {
+                    var xpath = 'SDKReference[@Include="TestSDK1, Version=1.0"][@Condition="\'$(Platform)\'==\'x86\'"]';
+                    validateInstalledProjects('lib-file', libfiles[0], xpath, ['all']);
+
+                    xpath = 'SDKReference[@Include="TestSDK2, Version=1.0"]';
+                    validateInstalledProjects('lib-file', libfiles[1], xpath, ['windows', 'phone']);
+
+                    xpath = 'SDKReference[@Include="TestSDK3, Version=1.0"]';
+                    validateInstalledProjects('lib-file', libfiles[2], xpath, ['phone']);
+
+                    xpath = 'SDKReference[@Include="TestSDK4, Version=1.0"]';
+                    validateInstalledProjects('lib-file', libfiles[3], xpath, ['windows8']);
+                });
+
+                it('should throw if conditions are invalid', function () {
+                    expect(function () {
+                        windows['lib-file'].install(invalidLibFiles[0], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('Invalid lib-file arch attribute (must be "x86", "x64" or "ARM"): x85');
+
+                    expect(function () {
+                        windows['lib-file'].install(invalidLibFiles[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('Invalid lib-file versions attribute (must be a valid a valid node semantic version range): 8.0a');
+
+                    expect(function () {
+                        windows['lib-file'].install(invalidLibFiles[2], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
+                    }).toThrow('Invalid lib-file target attribute (must be "all", "phone", "windows" or "win"): daphne');
+                });
+            });
+
+            describe('of <framework> elements', function () {
+                var frameworks = copyArray(valid_frameworks);
+
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should write to correct project files when conditions are specified', function () {
+                    var xpath = 'Reference[@Include="dummy1"][@Condition="\'$(Platform)\'==\'x64\'"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[0], xpath, ['all']);
+
+                    xpath = 'Reference[@Include="dummy2"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[1], xpath, ['all']);
+
+                    xpath = 'Reference[@Include="dummy3"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[2], xpath, ['windows', 'windows8']);
+
+                    xpath = 'Reference[@Include="dummy4"][@Condition="\'$(Platform)\'==\'ARM\'"]/HintPath';
+                    validateInstalledProjects('framework', frameworks[3], xpath, ['phone']);
+                });
+            });
+
+            describe('of <framework> elements of type \'projectReference\'', function () {
+                var frameworks = copyArray(valid_frameworks);
+
+                it('should write to correct project files when conditions are specified', function () {
+                    var xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy1.vcxproj"][@Condition="\'$(Platform)\'==\'x64\'"]';
+                    validateInstalledProjects('framework', frameworks[4], xpath, ['all']);
+
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy2.vcxproj"]';
+                    validateInstalledProjects('framework', frameworks[5], xpath, ['windows8']);
+
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy3.vcxproj"]';
+                    validateInstalledProjects('framework', frameworks[6], xpath, ['windows', 'windows8']);
+
+                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy4.vcxproj"][@Condition="\'$(Platform)\'==\'x86\'"]';
+                    validateInstalledProjects('framework', frameworks[7], xpath, ['windows', 'phone']);
+                });
+            });
+        });
+
+        describe('uninstallation', function () {
+            beforeEach(function () {
+                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
+                shell.mkdir('-p', cordovaProjectPluginsDir);
+                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
+            });
+            afterEach(function () {
+                shell.rm('-rf', cordovaProjectDir);
+            });
+
+            function validateUninstalledProjects(tag, elementToUninstall, xmlPath, incText, targetConditions, supportedPlatforms) {
+                jasmine.getEnv().currentSpec.removeAllSpies();
+
+                var projects = copyArray(proj_files.projects);
+                if (platform === 'windows') {
+                    projects.push(proj_files.master);
+                }
+
+                var projectsAddedToSpies = [];
+                var projectsNotAddedToSpies = [];
+
+                var projectsAddedTo = [];
+                supportedPlatforms.forEach(function (platform) {
+                    var platformProject = platformProjects[platform];
+                    if (platformProject) {
+                        projectsAddedTo.push(platformProjects[platform]);
+                    }
+                });
+
+                projects.forEach(function (project) {
+                    var spy = spyOn(project, 'removeReferenceElementItemGroup');
+                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
+                        projectsAddedToSpies.push(spy);
+                    } else {
+                        projectsNotAddedToSpies.push(spy);
+                    }
+                });
+
+                windows[tag].uninstall(elementToUninstall, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+
+                projectsAddedToSpies.forEach(function (spy) {
+                    expect(spy).toHaveBeenCalledWith(xmlPath, incText, targetConditions);
+                });
+
+                projectsNotAddedToSpies.forEach(function (spy) {
+                    expect(spy).not.toHaveBeenCalled();
+                });
+            }
+
+            describe('of <source-file> elements', function () {
+                it('should remove stuff by calling common.removeFile', function (done) {
+                    var s = spyOn(common, 'removeFile');
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var source = copyArray(valid_source);
+                            windows['source-file'].uninstall(source[0], cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
+                            expect(s).toHaveBeenCalledWith(cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'));
+                            done();
+                        });
+                });
+            });
+
+            describe('of <lib-file> elements', function () {
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should remove from correct project files when conditions specified', function (done) {
+                    var libfiles = copyArray(valid_libfiles);
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var path = 'ItemGroup/SDKReference';
+                            var incText = 'TestSDK1, Version=1.0';
+                            var targetConditions = {versions: undefined, target: undefined, arch: 'x86'};
+                            validateUninstalledProjects('lib-file', libfiles[0], path, incText, targetConditions, ['all']);
+
+                            incText = 'TestSDK2, Version=1.0';
+                            targetConditions = {versions: '>=8.1', target: undefined, arch: undefined};
+                            validateUninstalledProjects('lib-file', libfiles[1], path, incText, targetConditions, ['windows', 'phone']);
+
+                            incText = 'TestSDK3, Version=1.0';
+                            targetConditions = {versions: undefined, target: 'phone', arch: undefined};
+                            validateUninstalledProjects('lib-file', libfiles[2], path, incText, targetConditions, ['phone']);
+
+                            incText = 'TestSDK4, Version=1.0';
+                            targetConditions = {versions: '8.0', target: 'windows', arch: 'x86'};
+                            validateUninstalledProjects('lib-file', libfiles[3], path, incText, targetConditions, ['windows8']);
+
+                            done();
+                        });
+                });
+            });
+
+            describe('of <framework> elements', function () {
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should remove from correct project files when conditions specified', function (done) {
+                    var frameworks = copyArray(valid_frameworks);
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var path = 'ItemGroup/Reference';
+                            var incText = 'dummy1';
+                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
+                            validateUninstalledProjects('framework', frameworks[0], path, incText, targetConditions, ['all']);
+
+                            incText = 'dummy2';
+                            targetConditions = {versions: '>=8.0', target: undefined, arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[1], path, incText, targetConditions, ['all']);
+
+                            incText = 'dummy3';
+                            targetConditions = {versions: undefined, target: 'windows', arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[2], path, incText, targetConditions, ['windows', 'windows8']);
+
+                            incText = 'dummy4';
+                            targetConditions = {versions: '8.1', target: 'phone', arch: 'ARM'};
+                            validateUninstalledProjects('framework', frameworks[3], path, incText, targetConditions, ['phone']);
+
+                            done();
+                        });
+                });
+            });
+
+            describe('of <framework> elements of type \'projectReference\'', function () {
+                // This could be separated into individual specs, but that results in a lot of copying and deleting the
+                // project files, which is not needed.
+                it('should remove from correct project files when conditions specified', function (done) {
+                    var frameworks = copyArray(valid_frameworks);
+
+                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
+                        .then(function () {
+                            var path = 'ItemGroup/ProjectReference';
+                            var incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy1.vcxproj';
+                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
+                            validateUninstalledProjects('framework', frameworks[4], path, incText, targetConditions, ['all']);
+
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy2.vcxproj';
+                            targetConditions = {versions: '<8.1', target: undefined, arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[5], path, incText, targetConditions, ['windows8']);
+
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy3.vcxproj';
+                            targetConditions = {versions: undefined, target: 'win', arch: undefined};
+                            validateUninstalledProjects('framework', frameworks[6], path, incText, targetConditions, ['windows', 'windows8']);
+
+                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy4.vcxproj';
+                            targetConditions = {versions: '8.1', target: 'all', arch: 'x86'};
+                            validateUninstalledProjects('framework', frameworks[7], path, incText, targetConditions, ['windows', 'phone']);
+
+                            done();
+                        });
+                });
+            });
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/22a214f2/cordova-lib/spec-plugman/platforms/windows8.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows8.spec.js b/cordova-lib/spec-plugman/platforms/windows8.spec.js
deleted file mode 100644
index 444c987..0000000
--- a/cordova-lib/spec-plugman/platforms/windows8.spec.js
+++ /dev/null
@@ -1,415 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-var windows = require('../../src/plugman/platforms/windows'),
-    common = require('../../src/plugman/platforms/common'),
-    install = require('../../src/plugman/install'),
-    path = require('path'),
-    fs = require('fs'),
-    shell = require('shelljs'),
-    et = require('elementtree'),
-    os = require('osenv'),
-    cordovaProjectDir = path.join(os.tmpdir(), 'plugman'),
-    cordovaProjectWindowsPlatformDir = path.join(cordovaProjectDir, 'platforms', 'windows'),
-    cordovaProjectPluginsDir = path.join(cordovaProjectDir, 'plugins'),
-    xml_helpers = require('../../src/util/xml-helpers'),
-    dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
-    faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin');
-
-var PluginInfo = require('../../src/PluginInfo');
-
-var dummyPluginInfo = new PluginInfo(dummyplugin);
-var dummy_id = dummyPluginInfo.id;
-var valid_source = dummyPluginInfo.getSourceFiles('windows');
-var valid_libfiles = dummyPluginInfo.getLibFiles('windows');
-var valid_frameworks = dummyPluginInfo.getFrameworks('windows');
-
-var faultyPluginInfo = new PluginInfo(faultyplugin);
-var faulty_id = faultyPluginInfo.id;
-var invalid_source = faultyPluginInfo.getSourceFiles('windows');
-var invalid_libfiles = faultyPluginInfo.getLibFiles('windows');
-
-function copyArray(arr) {
-    return Array.prototype.slice.call(arr, 0);
-}
-
-beforeEach(function () {
-    this.addMatchers({
-        toContainXmlPath: function (xpath) {
-            var xml = this.actual;
-            var notText = this.isNot ? 'not ' : '';
-            this.message = function () {
-                return 'Expected xml \'' + et.tostring(xml) + '\' ' + notText + 'to contain elements matching \'' + xpath + '\'.';
-            };
-
-            return xml.find(xpath) != null;
-        }    });
-});
-
-['windows', 'windows8'].forEach(function (platform) {
-    var windows_project = path.join(__dirname, '..', 'projects', platform);
-
-    shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
-    shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
-    var proj_files = windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
-    shell.rm('-rf', cordovaProjectDir);
-
-    var platformProjects = {
-        windows: {
-            all: 'CordovaApp.projitems',
-            phone: 'CordovaApp.Phone.jsproj',
-            windows: 'CordovaApp.Windows.jsproj',
-            windows8: 'CordovaApp.Windows80.jsproj'
-        }, windows8: {
-            all: 'TestApp.jsproj',
-            windows8: 'TestApp.jsproj'
-        }
-    }[platform];
-
-    describe(platform + ' project handler', function () {
-        beforeEach(function () {
-            shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
-            shell.mkdir('-p', cordovaProjectPluginsDir);
-        });
-        afterEach(function () {
-            shell.rm('-rf', cordovaProjectDir);
-        });
-
-        describe('www_dir method', function () {
-            it('should return cordova-windows project www location using www_dir', function () {
-                expect(windows.www_dir(path.sep)).toEqual(path.sep + 'www');
-            });
-        });
-        describe('package_name method', function () {
-            it('should return a windows project\'s proper package name', function () {
-                expect(windows.package_name(windows_project)).toEqual("CordovaApp");
-            });
-        });
-
-        describe('parseProjectFile method', function () {
-            it('should throw if project is not an windows project', function () {
-                expect(function () {
-                    windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
-                }).toThrow(windows.InvalidProjectPathError);
-            });
-        });
-
-        describe('installation', function () {
-            beforeEach(function () {
-                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
-                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
-            });
-            afterEach(function () {
-                shell.rm('-rf', cordovaProjectDir);
-            });
-
-            function validateInstalledProjects(tag, elementToInstall, xpath, supportedPlatforms) {
-                jasmine.getEnv().currentSpec.removeAllSpies();
-
-                var projects = copyArray(proj_files.projects);
-                if (platform === 'windows') {
-                    projects.push(proj_files.master);
-                }
-
-                var appendToRootFake = function (itemGroup) {
-                    expect(itemGroup).toContainXmlPath(xpath);
-                };
-
-                var projectsAddedToSpies = [];
-                var projectsNotAddedToSpies = [];
-
-                var projectsAddedTo = [];
-                supportedPlatforms.forEach(function (platform) {
-                    var platformProject = platformProjects[platform];
-                    if (platformProject) {
-                        projectsAddedTo.push(platformProjects[platform]);
-                    }
-                });
-
-                projects.forEach(function (project) {
-                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
-                        projectsAddedToSpies.push(spyOn(project, 'appendToRoot').andCallFake(appendToRootFake));
-                    } else {
-                        projectsNotAddedToSpies.push(spyOn(project, 'appendToRoot'));
-                    }
-                });
-
-                windows[tag].install(elementToInstall, dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
-
-                projectsAddedToSpies.forEach(function (spy) {
-                    expect(spy).toHaveBeenCalled();
-                });
-
-                projectsNotAddedToSpies.forEach(function (spy) {
-                    expect(spy).not.toHaveBeenCalled();
-                });
-            }
-
-            describe('of <source-file> elements', function () {
-                it('should copy stuff from one location to another by calling common.copyFile', function () {
-                    var source = copyArray(valid_source);
-                    var s = spyOn(common, 'copyFile');
-                    windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
-                    expect(s).toHaveBeenCalledWith(dummyplugin, 'src/windows/dummer.js', cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'), false);
-                });
-                it('should throw if source-file src cannot be found', function () {
-                    var source = copyArray(invalid_source);
-                    expect(function () {
-                        windows['source-file'].install(source[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
-                    }).toThrow('"' + path.resolve(faultyplugin, 'src/windows/NotHere.js') + '" not found!');
-                });
-                it('should throw if source-file target already exists', function () {
-                    var source = copyArray(valid_source);
-                    var target = path.join(cordovaProjectWindowsPlatformDir, 'plugins', dummy_id, 'dummer.js');
-                    shell.mkdir('-p', path.dirname(target));
-                    fs.writeFileSync(target, 'some bs', 'utf-8');
-                    expect(function () {
-                        windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
-                    }).toThrow('"' + target + '" already exists!');
-                });
-            });
-
-            describe('of <lib-file> elements', function () {
-                var libfiles = copyArray(valid_libfiles);
-                var invalidLibFiles = copyArray(invalid_libfiles);
-
-                // This could be separated into individual specs, but that results in a lot of copying and deleting the
-                // project files, which is not needed.
-                it('should write to correct project files when conditions are specified', function () {
-                    var xpath = 'SDKReference[@Include="TestSDK1, Version=1.0"][@Condition="\'$(Platform)\'==\'x86\'"]';
-                    validateInstalledProjects('lib-file', libfiles[0], xpath, ['all']);
-
-                    xpath = 'SDKReference[@Include="TestSDK2, Version=1.0"]';
-                    validateInstalledProjects('lib-file', libfiles[1], xpath, ['windows', 'phone']);
-
-                    xpath = 'SDKReference[@Include="TestSDK3, Version=1.0"]';
-                    validateInstalledProjects('lib-file', libfiles[2], xpath, ['phone']);
-
-                    xpath = 'SDKReference[@Include="TestSDK4, Version=1.0"]';
-                    validateInstalledProjects('lib-file', libfiles[3], xpath, ['windows8']);
-                });
-
-                it('should throw if conditions are invalid', function () {
-                    expect(function () {
-                        windows['lib-file'].install(invalidLibFiles[0], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
-                    }).toThrow('Invalid lib-file arch attribute (must be "x86", "x64" or "ARM"): x85');
-
-                    expect(function () {
-                        windows['lib-file'].install(invalidLibFiles[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
-                    }).toThrow('Invalid lib-file versions attribute (must be a valid a valid node semantic version range): 8.0a');
-
-                    expect(function () {
-                        windows['lib-file'].install(invalidLibFiles[2], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
-                    }).toThrow('Invalid lib-file target attribute (must be "all", "phone", "windows" or "win"): daphne');
-                });
-            });
-
-            describe('of <framework> elements', function () {
-                var frameworks = copyArray(valid_frameworks);
-
-                // This could be separated into individual specs, but that results in a lot of copying and deleting the
-                // project files, which is not needed.
-                it('should write to correct project files when conditions are specified', function () {
-                    var xpath = 'Reference[@Include="dummy1"][@Condition="\'$(Platform)\'==\'x64\'"]/HintPath';
-                    validateInstalledProjects('framework', frameworks[0], xpath, ['all']);
-
-                    xpath = 'Reference[@Include="dummy2"]/HintPath';
-                    validateInstalledProjects('framework', frameworks[1], xpath, ['all']);
-
-                    xpath = 'Reference[@Include="dummy3"]/HintPath';
-                    validateInstalledProjects('framework', frameworks[2], xpath, ['windows', 'windows8']);
-
-                    xpath = 'Reference[@Include="dummy4"][@Condition="\'$(Platform)\'==\'ARM\'"]/HintPath';
-                    validateInstalledProjects('framework', frameworks[3], xpath, ['phone']);
-                });
-            });
-
-            describe('of <framework> elements of type \'projectReference\'', function () {
-                var frameworks = copyArray(valid_frameworks);
-
-                it('should write to correct project files when conditions are specified', function () {
-                    var xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy1.vcxproj"][@Condition="\'$(Platform)\'==\'x64\'"]';
-                    validateInstalledProjects('framework', frameworks[4], xpath, ['all']);
-
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy2.vcxproj"]';
-                    validateInstalledProjects('framework', frameworks[5], xpath, ['windows8']);
-
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy3.vcxproj"]';
-                    validateInstalledProjects('framework', frameworks[6], xpath, ['windows', 'windows8']);
-
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy4.vcxproj"][@Condition="\'$(Platform)\'==\'x86\'"]';
-                    validateInstalledProjects('framework', frameworks[7], xpath, ['windows', 'phone']);
-                });
-            });
-        });
-
-        describe('uninstallation', function () {
-            beforeEach(function () {
-                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
-                shell.mkdir('-p', cordovaProjectPluginsDir);
-                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
-            });
-            afterEach(function () {
-                shell.rm('-rf', cordovaProjectDir);
-            });
-
-            function validateUninstalledProjects(tag, elementToUninstall, xmlPath, incText, targetConditions, supportedPlatforms) {
-                jasmine.getEnv().currentSpec.removeAllSpies();
-
-                var projects = copyArray(proj_files.projects);
-                if (platform === 'windows') {
-                    projects.push(proj_files.master);
-                }
-
-                var projectsAddedToSpies = [];
-                var projectsNotAddedToSpies = [];
-
-                var projectsAddedTo = [];
-                supportedPlatforms.forEach(function (platform) {
-                    var platformProject = platformProjects[platform];
-                    if (platformProject) {
-                        projectsAddedTo.push(platformProjects[platform]);
-                    }
-                });
-
-                projects.forEach(function (project) {
-                    var spy = spyOn(project, 'removeReferenceElementItemGroup');
-                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
-                        projectsAddedToSpies.push(spy);
-                    } else {
-                        projectsNotAddedToSpies.push(spy);
-                    }
-                });
-
-                windows[tag].uninstall(elementToUninstall, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
-
-                projectsAddedToSpies.forEach(function (spy) {
-                    expect(spy).toHaveBeenCalledWith(xmlPath, incText, targetConditions);
-                });
-
-                projectsNotAddedToSpies.forEach(function (spy) {
-                    expect(spy).not.toHaveBeenCalled();
-                });
-            }
-
-            describe('of <source-file> elements', function () {
-                it('should remove stuff by calling common.removeFile', function (done) {
-                    var s = spyOn(common, 'removeFile');
-
-                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
-                        .then(function () {
-                            var source = copyArray(valid_source);
-                            windows['source-file'].uninstall(source[0], cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
-                            expect(s).toHaveBeenCalledWith(cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'));
-                            done();
-                        });
-                });
-            });
-
-            describe('of <lib-file> elements', function () {
-                // This could be separated into individual specs, but that results in a lot of copying and deleting the
-                // project files, which is not needed.
-                it('should remove from correct project files when conditions specified', function (done) {
-                    var libfiles = copyArray(valid_libfiles);
-
-                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
-                        .then(function () {
-                            var path = 'ItemGroup/SDKReference';
-                            var incText = 'TestSDK1, Version=1.0';
-                            var targetConditions = {versions: undefined, target: undefined, arch: 'x86'};
-                            validateUninstalledProjects('lib-file', libfiles[0], path, incText, targetConditions, ['all']);
-
-                            incText = 'TestSDK2, Version=1.0';
-                            targetConditions = {versions: '>=8.1', target: undefined, arch: undefined};
-                            validateUninstalledProjects('lib-file', libfiles[1], path, incText, targetConditions, ['windows', 'phone']);
-
-                            incText = 'TestSDK3, Version=1.0';
-                            targetConditions = {versions: undefined, target: 'phone', arch: undefined};
-                            validateUninstalledProjects('lib-file', libfiles[2], path, incText, targetConditions, ['phone']);
-
-                            incText = 'TestSDK4, Version=1.0';
-                            targetConditions = {versions: '8.0', target: 'windows', arch: 'x86'};
-                            validateUninstalledProjects('lib-file', libfiles[3], path, incText, targetConditions, ['windows8']);
-
-                            done();
-                        });
-                });
-            });
-
-            describe('of <framework> elements', function () {
-                // This could be separated into individual specs, but that results in a lot of copying and deleting the
-                // project files, which is not needed.
-                it('should remove from correct project files when conditions specified', function (done) {
-                    var frameworks = copyArray(valid_frameworks);
-
-                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
-                        .then(function () {
-                            var path = 'ItemGroup/Reference';
-                            var incText = 'dummy1';
-                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
-                            validateUninstalledProjects('framework', frameworks[0], path, incText, targetConditions, ['all']);
-
-                            incText = 'dummy2';
-                            targetConditions = {versions: '>=8.0', target: undefined, arch: undefined};
-                            validateUninstalledProjects('framework', frameworks[1], path, incText, targetConditions, ['all']);
-
-                            incText = 'dummy3';
-                            targetConditions = {versions: undefined, target: 'windows', arch: undefined};
-                            validateUninstalledProjects('framework', frameworks[2], path, incText, targetConditions, ['windows', 'windows8']);
-
-                            incText = 'dummy4';
-                            targetConditions = {versions: '8.1', target: 'phone', arch: 'ARM'};
-                            validateUninstalledProjects('framework', frameworks[3], path, incText, targetConditions, ['phone']);
-
-                            done();
-                        });
-                });
-            });
-
-            describe('of <framework> elements of type \'projectReference\'', function () {
-                // This could be separated into individual specs, but that results in a lot of copying and deleting the
-                // project files, which is not needed.
-                it('should remove from correct project files when conditions specified', function (done) {
-                    var frameworks = copyArray(valid_frameworks);
-
-                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
-                        .then(function () {
-                            var path = 'ItemGroup/ProjectReference';
-                            var incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy1.vcxproj';
-                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
-                            validateUninstalledProjects('framework', frameworks[4], path, incText, targetConditions, ['all']);
-
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy2.vcxproj';
-                            targetConditions = {versions: '<8.1', target: undefined, arch: undefined};
-                            validateUninstalledProjects('framework', frameworks[5], path, incText, targetConditions, ['windows8']);
-
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy3.vcxproj';
-                            targetConditions = {versions: undefined, target: 'win', arch: undefined};
-                            validateUninstalledProjects('framework', frameworks[6], path, incText, targetConditions, ['windows', 'windows8']);
-
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy4.vcxproj';
-                            targetConditions = {versions: '8.1', target: 'all', arch: 'x86'};
-                            validateUninstalledProjects('framework', frameworks[7], path, incText, targetConditions, ['windows', 'phone']);
-
-                            done();
-                        });
-                });
-            });
-        });
-    });
-});


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


[05/12] cordova-lib git commit: CB-8123 Fix path handling so tests work on any platform.

Posted by st...@apache.org.
CB-8123 Fix path handling so tests work on any platform.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/f1c5d8fb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/f1c5d8fb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/f1c5d8fb

Branch: refs/heads/CB-8416
Commit: f1c5d8fb409233f775a2fff4aea449670acce59a
Parents: 22a214f
Author: Tim Barham <tb...@TB-MAC.local>
Authored: Wed Feb 4 18:30:25 2015 +1000
Committer: Tim Barham <tb...@TB-MAC.local>
Committed: Wed Feb 4 18:30:25 2015 +1000

----------------------------------------------------------------------
 .../spec-plugman/platforms/windows.spec.js      | 31 ++++++++++++--------
 cordova-lib/src/util/windows/jsprojManager.js   | 23 +++++++++++----
 2 files changed, 35 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f1c5d8fb/cordova-lib/spec-plugman/platforms/windows.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/windows.spec.js b/cordova-lib/spec-plugman/platforms/windows.spec.js
index 444c987..f64bc3b 100644
--- a/cordova-lib/spec-plugman/platforms/windows.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows.spec.js
@@ -243,16 +243,16 @@ beforeEach(function () {
                 var frameworks = copyArray(valid_frameworks);
 
                 it('should write to correct project files when conditions are specified', function () {
-                    var xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy1.vcxproj"][@Condition="\'$(Platform)\'==\'x64\'"]';
+                    var xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy1.vcxproj') + '"][@Condition="\'$(Platform)\'==\'x64\'"]';
                     validateInstalledProjects('framework', frameworks[4], xpath, ['all']);
 
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy2.vcxproj"]';
+                    xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy2.vcxproj') + '"]';
                     validateInstalledProjects('framework', frameworks[5], xpath, ['windows8']);
 
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy3.vcxproj"]';
+                    xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy3.vcxproj') + '"]';
                     validateInstalledProjects('framework', frameworks[6], xpath, ['windows', 'windows8']);
 
-                    xpath = 'ProjectReference[@Include="' + dummyplugin + '\\src\\windows\\dummy4.vcxproj"][@Condition="\'$(Platform)\'==\'x86\'"]';
+                    xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy4.vcxproj') + '"][@Condition="\'$(Platform)\'==\'x86\'"]';
                     validateInstalledProjects('framework', frameworks[7], xpath, ['windows', 'phone']);
                 });
             });
@@ -389,22 +389,22 @@ beforeEach(function () {
 
                     install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
                         .then(function () {
-                            var path = 'ItemGroup/ProjectReference';
-                            var incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy1.vcxproj';
+                            var xmlPath = 'ItemGroup/ProjectReference';
+                            var incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy1.vcxproj');
                             var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
-                            validateUninstalledProjects('framework', frameworks[4], path, incText, targetConditions, ['all']);
+                            validateUninstalledProjects('framework', frameworks[4], xmlPath, incText, targetConditions, ['all']);
 
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy2.vcxproj';
+                            incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy2.vcxproj');
                             targetConditions = {versions: '<8.1', target: undefined, arch: undefined};
-                            validateUninstalledProjects('framework', frameworks[5], path, incText, targetConditions, ['windows8']);
+                            validateUninstalledProjects('framework', frameworks[5], xmlPath, incText, targetConditions, ['windows8']);
 
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy3.vcxproj';
+                            incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy3.vcxproj');
                             targetConditions = {versions: undefined, target: 'win', arch: undefined};
-                            validateUninstalledProjects('framework', frameworks[6], path, incText, targetConditions, ['windows', 'windows8']);
+                            validateUninstalledProjects('framework', frameworks[6], xmlPath, incText, targetConditions, ['windows', 'windows8']);
 
-                            incText = cordovaProjectPluginsDir + "\\" + dummy_id + '\\src\\windows\\dummy4.vcxproj';
+                            incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy4.vcxproj');
                             targetConditions = {versions: '8.1', target: 'all', arch: 'x86'};
-                            validateUninstalledProjects('framework', frameworks[7], path, incText, targetConditions, ['windows', 'phone']);
+                            validateUninstalledProjects('framework', frameworks[7], xmlPath, incText, targetConditions, ['windows', 'phone']);
 
                             done();
                         });
@@ -413,3 +413,8 @@ beforeEach(function () {
         });
     });
 });
+
+function windowsJoin() {
+    // Paths that are written to project files will be in Windows format, regardless of the current OS.
+    return path.join.apply(path, arguments).split('/').join('\\');
+}

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f1c5d8fb/cordova-lib/src/util/windows/jsprojManager.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsprojManager.js b/cordova-lib/src/util/windows/jsprojManager.js
index 57642ba..1b2671e 100644
--- a/cordova-lib/src/util/windows/jsprojManager.js
+++ b/cordova-lib/src/util/windows/jsprojManager.js
@@ -129,7 +129,10 @@ jsprojManager.prototype = {
     addProjectReference: function (relative_path, targetConditions) {
         events.emit('verbose', 'jsprojManager.addProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
-        relative_path = relative_path.split('/').join('\\');
+        // relative_path is the actual path to the file in the current OS, where-as inserted_path is what we write in
+        // the project file, and is always in Windows format.
+        relative_path = path.normalize(relative_path);
+        var inserted_path = relative_path.split('/').join('\\');
 
         var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
 
@@ -147,7 +150,7 @@ jsprojManager.prototype = {
             "\t\t" + projectGuid + "=" + projectGuid + "\r\n" +
             "\tEndProjectSection\r\n";
         var postInsertText = '\r\nProject("' + projectTypeGuid + '") = "' +
-            projName + '", "' + relative_path + '", ' +
+            projName + '", "' + inserted_path + '", ' +
             '"' + projectGuid + '"\r\nEndProject';
 
         var matchingProjects = this._getMatchingProjects(targetConditions);
@@ -197,7 +200,7 @@ jsprojManager.prototype = {
 
         // Add the ItemGroup/ProjectReference to each matching cordova project :
         // <ItemGroup><ProjectReference Include="blahblah.csproj"/></ItemGroup>
-        var item = createReferenceElement('ItemGroup/ProjectReference', relative_path, targetConditions);
+        var item = createReferenceElement('ItemGroup/ProjectReference', inserted_path, targetConditions);
         matchingProjects.forEach(function (project) {
             project.appendToRoot(item);
         });
@@ -206,6 +209,11 @@ jsprojManager.prototype = {
     removeProjectReference: function (relative_path, targetConditions) {
         events.emit('verbose', 'jsprojManager.removeProjectReference(incText: ' + relative_path + ', targetConditions: ' + JSON.stringify(targetConditions) + ')');
 
+        // relative_path is the actual path to the file in the current OS, where-as inserted_path is what we write in
+        // the project file, and is always in Windows format.
+        relative_path = path.normalize(relative_path);
+        var inserted_path = relative_path.split('/').join('\\');
+
         // find the guid + name of the referenced project
         var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
         var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
@@ -218,7 +226,7 @@ jsprojManager.prototype = {
         }
 
         var preInsertTextRegExp = getProjectReferencePreInsertRegExp(projectGuid);
-        var postInsertTextRegExp = getProjectReferencePostInsertRegExp(projName, projectGuid, relative_path, projectTypeGuid);
+        var postInsertTextRegExp = getProjectReferencePostInsertRegExp(projName, projectGuid, inserted_path, projectTypeGuid);
 
         // There may be multiple solutions (for different VS versions) - process them all
         getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
@@ -239,7 +247,7 @@ jsprojManager.prototype = {
         });
 
         this._getMatchingProjects(targetConditions).forEach(function (project) {
-            project.removeReferenceElementItemGroup('ItemGroup/ProjectReference', relative_path, targetConditions);
+            project.removeReferenceElementItemGroup('ItemGroup/ProjectReference', inserted_path, targetConditions);
         });
     },
 
@@ -423,6 +431,8 @@ proj.prototype = {
         var item = new et.Element('ItemGroup');
 
         relative_path.forEach(function (filePath) {
+            // filePath is never used to find the actual file - it determines what we write to the project file, and so
+            // should always be in Windows format.
             filePath = filePath.split('/').join('\\');
 
             var content = new et.Element('Content');
@@ -436,7 +446,8 @@ proj.prototype = {
     removeSourceFile: function (relative_path) {
         var isRegexp = relative_path instanceof RegExp;
         if (!isRegexp) {
-            // path.normalize(relative_path);// ??
+            // relative_path is never used to find the actual file - it determines what we write to the project file,
+            // and so should always be in Windows format.
             relative_path = relative_path.split('/').join('\\');
         }
 


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


[12/12] cordova-lib git commit: Merge branch 'master' into CB-8416

Posted by st...@apache.org.
Merge branch 'master' into CB-8416


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/f37d6a6f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/f37d6a6f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/f37d6a6f

Branch: refs/heads/CB-8416
Commit: f37d6a6f1149fdc554d9e7e2179c2a7f028ef9ca
Parents: e539aa5 37567da
Author: Steve Gill <st...@gmail.com>
Authored: Thu Feb 12 16:53:50 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Thu Feb 12 16:53:50 2015 -0800

----------------------------------------------------------------------
 .../spec-plugman/platforms/windows.spec.js      | 419 ++++++++++++++
 .../spec-plugman/platforms/windows8.spec.js     | 137 -----
 .../org.test.plugins.dummyplugin/plugin.xml     |  22 +-
 .../src/windows/dummer.js                       |   1 +
 .../src/windows/dummy1.dll                      |   0
 .../src/windows/dummy1.vcxproj                  |   7 +
 .../src/windows/dummy2.dll                      |   0
 .../src/windows/dummy2.vcxproj                  |   7 +
 .../src/windows/dummy3.dll                      |   0
 .../src/windows/dummy3.vcxproj                  |   7 +
 .../src/windows/dummy4.dll                      |   0
 .../src/windows/dummy4.vcxproj                  |   7 +
 .../src/windows8/dummer.js                      |   1 -
 .../org.test.plugins.faultyplugin/plugin.xml    |  14 +-
 .../src/windows/faultyPlugin.js                 |   1 +
 .../src/windows8/faultyPlugin.js                |   1 -
 .../projects/windows/CordovaApp.Phone.jsproj    |  99 ++++
 .../projects/windows/CordovaApp.Windows.jsproj  |  99 ++++
 .../windows/CordovaApp.Windows80.jsproj         |  93 ++++
 .../projects/windows/CordovaApp.projitems       |  32 ++
 .../projects/windows/CordovaApp.shproj          |  30 +
 .../projects/windows/CordovaApp.sln             | 134 +++++
 .../projects/windows/CordovaApp.vs2012.sln      |  64 +++
 .../windows/CordovaApp_TemporaryKey.pfx         | Bin 0 -> 2544 bytes
 .../spec-plugman/projects/windows/VERSION       |   1 +
 .../spec-plugman/projects/windows/config.xml    |  14 +
 .../projects/windows/package.phone.appxmanifest |  57 ++
 .../windows/package.windows.appxmanifest        |  58 ++
 .../windows/package.windows80.appxmanifest      |  50 ++
 cordova-lib/src/PluginInfo.js                   |   9 +-
 cordova-lib/src/cordova/platform.js             |  56 +-
 cordova-lib/src/cordova/plugin.js               |  23 +
 cordova-lib/src/cordova/util.js                 |  18 +-
 cordova-lib/src/plugman/platforms/windows.js    |  52 +-
 cordova-lib/src/util/windows/jsproj.js          | 309 -----------
 cordova-lib/src/util/windows/jsprojManager.js   | 544 +++++++++++++++++++
 36 files changed, 1866 insertions(+), 500 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f37d6a6f/cordova-lib/src/PluginInfo.js
----------------------------------------------------------------------


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


[08/12] cordova-lib git commit: Merge branch 'master' into CB-8123-temp

Posted by st...@apache.org.
Merge branch 'master' into CB-8123-temp

Conflicts:
	cordova-lib/spec-plugman/platforms/windows8.spec.js


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/d98343e3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/d98343e3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/d98343e3

Branch: refs/heads/CB-8416
Commit: d98343e34bb70d2262ef212726947e9c511a1808
Parents: f1c5d8f 36194fa
Author: Tim Barham <ti...@microsoft.com>
Authored: Tue Feb 10 09:28:53 2015 +1000
Committer: Tim Barham <ti...@microsoft.com>
Committed: Tue Feb 10 09:28:53 2015 +1000

----------------------------------------------------------------------
 cordova-lib/.jshintignore                       |   2 +
 cordova-lib/package.json                        |   2 +-
 cordova-lib/spec-plugman/.jshintrc              |  11 +
 cordova-lib/spec-plugman/add_platform.spec.js   |  16 +-
 cordova-lib/spec-plugman/common.js              |   2 +-
 cordova-lib/spec-plugman/fetch.spec.js          |  26 +-
 .../spec-plugman/install-browserify.spec.js     |  37 +--
 cordova-lib/spec-plugman/install.spec.js        |  32 +--
 cordova-lib/spec-plugman/platform.spec.js       |   8 +-
 .../platforms/amazon-fireos.spec.js             |   2 +
 .../spec-plugman/platforms/android.spec.js      | 240 +++++++++----------
 .../spec-plugman/platforms/blackberry10.spec.js |  10 +-
 .../spec-plugman/platforms/common.spec.js       |  21 +-
 cordova-lib/spec-plugman/platforms/ios.spec.js  |  80 +++++--
 .../spec-plugman/platforms/tizen.spec.js        |  15 +-
 .../spec-plugman/platforms/windows.spec.js      |   3 +-
 cordova-lib/spec-plugman/platforms/wp8.spec.js  |  10 +-
 .../org.test.plugins.dummyplugin/extra.gradle   |   1 +
 .../plugin-lib/AndroidManifest.xml              |   5 +
 .../plugin-lib/libFile                          |   1 +
 .../plugin-lib/project.properties               |   1 +
 .../org.test.plugins.dummyplugin/plugin.xml     |   3 +
 cordova-lib/spec-plugman/prepare.spec.js        |   9 +-
 .../projects/android_install/local.properties   |   1 +
 .../projects/android_one/project.properties     |   4 +
 .../projects/android_uninstall/local.properties |   1 +
 .../SampleApp.xcodeproj/project.pbxproj         |  44 ++--
 .../SampleApp.xcodeproj/project.pbxproj         |  44 ++--
 .../spec-plugman/registry/registry.spec.js      |   4 +-
 .../spec-plugman/uninstall-browserify.spec.js   |  33 +--
 cordova-lib/spec-plugman/uninstall.spec.js      |  47 ++--
 .../spec-plugman/util/action-stack.spec.js      |   3 +-
 .../spec-plugman/util/config-changes.spec.js    |  10 +-
 cordova-lib/spec-plugman/util/csproj.spec.js    |  13 +-
 .../spec-plugman/util/dependencies.spec.js      |  20 +-
 cordova-lib/spec-plugman/util/plugins.spec.js   |   6 +-
 .../spec-plugman/util/xml-helpers.spec.js       |  34 +--
 cordova-lib/spec-plugman/wrappers.spec.js       |   5 +-
 cordova-lib/src/cordova/compile.js              |   6 +-
 cordova-lib/src/cordova/platform.js             |  48 +++-
 cordova-lib/src/cordova/platformsConfig.json    |   2 +-
 cordova-lib/src/plugman/install.js              |  16 +-
 cordova-lib/src/plugman/platforms/android.js    |  70 ++++--
 cordova-lib/src/plugman/platforms/ios.js        |  21 +-
 cordova-lib/src/plugman/prepare.js              |   2 +-
 cordova-lib/src/plugman/util/action-stack.js    |  14 +-
 cordova-lib/src/plugman/util/android-project.js | 150 +++++-------
 47 files changed, 583 insertions(+), 552 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d98343e3/cordova-lib/spec-plugman/platforms/windows.spec.js
----------------------------------------------------------------------
diff --cc cordova-lib/spec-plugman/platforms/windows.spec.js
index f64bc3b,0000000..583586f
mode 100644,000000..100644
--- a/cordova-lib/spec-plugman/platforms/windows.spec.js
+++ b/cordova-lib/spec-plugman/platforms/windows.spec.js
@@@ -1,420 -1,0 +1,419 @@@
 +/**
 + Licensed to the Apache Software Foundation (ASF) under one
 + or more contributor license agreements.  See the NOTICE file
 + distributed with this work for additional information
 + regarding copyright ownership.  The ASF licenses this file
 + to you under the Apache License, Version 2.0 (the
 + "License"); you may not use this file except in compliance
 + with the License.  You may obtain a copy of the License at
 +
 + http://www.apache.org/licenses/LICENSE-2.0
 +
 + Unless required by applicable law or agreed to in writing,
 + software distributed under the License is distributed on an
 + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + KIND, either express or implied.  See the License for the
 + specific language governing permissions and limitations
 + under the License.
 + */
 +var windows = require('../../src/plugman/platforms/windows'),
 +    common = require('../../src/plugman/platforms/common'),
 +    install = require('../../src/plugman/install'),
 +    path = require('path'),
 +    fs = require('fs'),
 +    shell = require('shelljs'),
 +    et = require('elementtree'),
 +    os = require('osenv'),
 +    cordovaProjectDir = path.join(os.tmpdir(), 'plugman'),
 +    cordovaProjectWindowsPlatformDir = path.join(cordovaProjectDir, 'platforms', 'windows'),
 +    cordovaProjectPluginsDir = path.join(cordovaProjectDir, 'plugins'),
-     xml_helpers = require('../../src/util/xml-helpers'),
 +    dummyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.dummyplugin'),
 +    faultyplugin = path.join(__dirname, '..', 'plugins', 'org.test.plugins.faultyplugin');
 +
 +var PluginInfo = require('../../src/PluginInfo');
 +
 +var dummyPluginInfo = new PluginInfo(dummyplugin);
 +var dummy_id = dummyPluginInfo.id;
 +var valid_source = dummyPluginInfo.getSourceFiles('windows');
 +var valid_libfiles = dummyPluginInfo.getLibFiles('windows');
 +var valid_frameworks = dummyPluginInfo.getFrameworks('windows');
 +
 +var faultyPluginInfo = new PluginInfo(faultyplugin);
 +var faulty_id = faultyPluginInfo.id;
 +var invalid_source = faultyPluginInfo.getSourceFiles('windows');
 +var invalid_libfiles = faultyPluginInfo.getLibFiles('windows');
 +
 +function copyArray(arr) {
 +    return Array.prototype.slice.call(arr, 0);
 +}
 +
 +beforeEach(function () {
 +    this.addMatchers({
 +        toContainXmlPath: function (xpath) {
 +            var xml = this.actual;
 +            var notText = this.isNot ? 'not ' : '';
 +            this.message = function () {
 +                return 'Expected xml \'' + et.tostring(xml) + '\' ' + notText + 'to contain elements matching \'' + xpath + '\'.';
 +            };
 +
 +            return xml.find(xpath) != null;
 +        }    });
 +});
 +
 +['windows', 'windows8'].forEach(function (platform) {
 +    var windows_project = path.join(__dirname, '..', 'projects', platform);
 +
 +    shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
 +    shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
 +    var proj_files = windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
 +    shell.rm('-rf', cordovaProjectDir);
 +
 +    var platformProjects = {
 +        windows: {
 +            all: 'CordovaApp.projitems',
 +            phone: 'CordovaApp.Phone.jsproj',
 +            windows: 'CordovaApp.Windows.jsproj',
 +            windows8: 'CordovaApp.Windows80.jsproj'
 +        }, windows8: {
 +            all: 'TestApp.jsproj',
 +            windows8: 'TestApp.jsproj'
 +        }
 +    }[platform];
 +
 +    describe(platform + ' project handler', function () {
 +        beforeEach(function () {
 +            shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
 +            shell.mkdir('-p', cordovaProjectPluginsDir);
 +        });
 +        afterEach(function () {
 +            shell.rm('-rf', cordovaProjectDir);
 +        });
 +
 +        describe('www_dir method', function () {
 +            it('should return cordova-windows project www location using www_dir', function () {
 +                expect(windows.www_dir(path.sep)).toEqual(path.sep + 'www');
 +            });
 +        });
 +        describe('package_name method', function () {
 +            it('should return a windows project\'s proper package name', function () {
-                 expect(windows.package_name(windows_project)).toEqual("CordovaApp");
++                expect(windows.package_name(windows_project)).toEqual('CordovaApp');
 +            });
 +        });
 +
 +        describe('parseProjectFile method', function () {
 +            it('should throw if project is not an windows project', function () {
 +                expect(function () {
 +                    windows.parseProjectFile(cordovaProjectWindowsPlatformDir);
 +                }).toThrow(windows.InvalidProjectPathError);
 +            });
 +        });
 +
 +        describe('installation', function () {
 +            beforeEach(function () {
 +                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
 +                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
 +            });
 +            afterEach(function () {
 +                shell.rm('-rf', cordovaProjectDir);
 +            });
 +
 +            function validateInstalledProjects(tag, elementToInstall, xpath, supportedPlatforms) {
 +                jasmine.getEnv().currentSpec.removeAllSpies();
 +
 +                var projects = copyArray(proj_files.projects);
 +                if (platform === 'windows') {
 +                    projects.push(proj_files.master);
 +                }
 +
 +                var appendToRootFake = function (itemGroup) {
 +                    expect(itemGroup).toContainXmlPath(xpath);
 +                };
 +
 +                var projectsAddedToSpies = [];
 +                var projectsNotAddedToSpies = [];
 +
 +                var projectsAddedTo = [];
 +                supportedPlatforms.forEach(function (platform) {
 +                    var platformProject = platformProjects[platform];
 +                    if (platformProject) {
 +                        projectsAddedTo.push(platformProjects[platform]);
 +                    }
 +                });
 +
 +                projects.forEach(function (project) {
 +                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
 +                        projectsAddedToSpies.push(spyOn(project, 'appendToRoot').andCallFake(appendToRootFake));
 +                    } else {
 +                        projectsNotAddedToSpies.push(spyOn(project, 'appendToRoot'));
 +                    }
 +                });
 +
 +                windows[tag].install(elementToInstall, dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
 +
 +                projectsAddedToSpies.forEach(function (spy) {
 +                    expect(spy).toHaveBeenCalled();
 +                });
 +
 +                projectsNotAddedToSpies.forEach(function (spy) {
 +                    expect(spy).not.toHaveBeenCalled();
 +                });
 +            }
 +
 +            describe('of <source-file> elements', function () {
 +                it('should copy stuff from one location to another by calling common.copyFile', function () {
 +                    var source = copyArray(valid_source);
 +                    var s = spyOn(common, 'copyFile');
 +                    windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
 +                    expect(s).toHaveBeenCalledWith(dummyplugin, 'src/windows/dummer.js', cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'), false);
 +                });
 +                it('should throw if source-file src cannot be found', function () {
 +                    var source = copyArray(invalid_source);
 +                    expect(function () {
 +                        windows['source-file'].install(source[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
 +                    }).toThrow('"' + path.resolve(faultyplugin, 'src/windows/NotHere.js') + '" not found!');
 +                });
 +                it('should throw if source-file target already exists', function () {
 +                    var source = copyArray(valid_source);
 +                    var target = path.join(cordovaProjectWindowsPlatformDir, 'plugins', dummy_id, 'dummer.js');
 +                    shell.mkdir('-p', path.dirname(target));
 +                    fs.writeFileSync(target, 'some bs', 'utf-8');
 +                    expect(function () {
 +                        windows['source-file'].install(source[0], dummyplugin, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
 +                    }).toThrow('"' + target + '" already exists!');
 +                });
 +            });
 +
 +            describe('of <lib-file> elements', function () {
 +                var libfiles = copyArray(valid_libfiles);
 +                var invalidLibFiles = copyArray(invalid_libfiles);
 +
 +                // This could be separated into individual specs, but that results in a lot of copying and deleting the
 +                // project files, which is not needed.
 +                it('should write to correct project files when conditions are specified', function () {
 +                    var xpath = 'SDKReference[@Include="TestSDK1, Version=1.0"][@Condition="\'$(Platform)\'==\'x86\'"]';
 +                    validateInstalledProjects('lib-file', libfiles[0], xpath, ['all']);
 +
 +                    xpath = 'SDKReference[@Include="TestSDK2, Version=1.0"]';
 +                    validateInstalledProjects('lib-file', libfiles[1], xpath, ['windows', 'phone']);
 +
 +                    xpath = 'SDKReference[@Include="TestSDK3, Version=1.0"]';
 +                    validateInstalledProjects('lib-file', libfiles[2], xpath, ['phone']);
 +
 +                    xpath = 'SDKReference[@Include="TestSDK4, Version=1.0"]';
 +                    validateInstalledProjects('lib-file', libfiles[3], xpath, ['windows8']);
 +                });
 +
 +                it('should throw if conditions are invalid', function () {
 +                    expect(function () {
 +                        windows['lib-file'].install(invalidLibFiles[0], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
 +                    }).toThrow('Invalid lib-file arch attribute (must be "x86", "x64" or "ARM"): x85');
 +
 +                    expect(function () {
 +                        windows['lib-file'].install(invalidLibFiles[1], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
 +                    }).toThrow('Invalid lib-file versions attribute (must be a valid a valid node semantic version range): 8.0a');
 +
 +                    expect(function () {
 +                        windows['lib-file'].install(invalidLibFiles[2], faultyplugin, cordovaProjectWindowsPlatformDir, faulty_id, null, proj_files);
 +                    }).toThrow('Invalid lib-file target attribute (must be "all", "phone", "windows" or "win"): daphne');
 +                });
 +            });
 +
 +            describe('of <framework> elements', function () {
 +                var frameworks = copyArray(valid_frameworks);
 +
 +                // This could be separated into individual specs, but that results in a lot of copying and deleting the
 +                // project files, which is not needed.
 +                it('should write to correct project files when conditions are specified', function () {
 +                    var xpath = 'Reference[@Include="dummy1"][@Condition="\'$(Platform)\'==\'x64\'"]/HintPath';
 +                    validateInstalledProjects('framework', frameworks[0], xpath, ['all']);
 +
 +                    xpath = 'Reference[@Include="dummy2"]/HintPath';
 +                    validateInstalledProjects('framework', frameworks[1], xpath, ['all']);
 +
 +                    xpath = 'Reference[@Include="dummy3"]/HintPath';
 +                    validateInstalledProjects('framework', frameworks[2], xpath, ['windows', 'windows8']);
 +
 +                    xpath = 'Reference[@Include="dummy4"][@Condition="\'$(Platform)\'==\'ARM\'"]/HintPath';
 +                    validateInstalledProjects('framework', frameworks[3], xpath, ['phone']);
 +                });
 +            });
 +
 +            describe('of <framework> elements of type \'projectReference\'', function () {
 +                var frameworks = copyArray(valid_frameworks);
 +
 +                it('should write to correct project files when conditions are specified', function () {
 +                    var xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy1.vcxproj') + '"][@Condition="\'$(Platform)\'==\'x64\'"]';
 +                    validateInstalledProjects('framework', frameworks[4], xpath, ['all']);
 +
 +                    xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy2.vcxproj') + '"]';
 +                    validateInstalledProjects('framework', frameworks[5], xpath, ['windows8']);
 +
 +                    xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy3.vcxproj') + '"]';
 +                    validateInstalledProjects('framework', frameworks[6], xpath, ['windows', 'windows8']);
 +
 +                    xpath = 'ProjectReference[@Include="' + windowsJoin(dummyplugin, 'src', 'windows', 'dummy4.vcxproj') + '"][@Condition="\'$(Platform)\'==\'x86\'"]';
 +                    validateInstalledProjects('framework', frameworks[7], xpath, ['windows', 'phone']);
 +                });
 +            });
 +        });
 +
 +        describe('uninstallation', function () {
 +            beforeEach(function () {
 +                shell.mkdir('-p', cordovaProjectWindowsPlatformDir);
 +                shell.mkdir('-p', cordovaProjectPluginsDir);
 +                shell.cp('-rf', path.join(windows_project, '*'), cordovaProjectWindowsPlatformDir);
 +            });
 +            afterEach(function () {
 +                shell.rm('-rf', cordovaProjectDir);
 +            });
 +
 +            function validateUninstalledProjects(tag, elementToUninstall, xmlPath, incText, targetConditions, supportedPlatforms) {
 +                jasmine.getEnv().currentSpec.removeAllSpies();
 +
 +                var projects = copyArray(proj_files.projects);
 +                if (platform === 'windows') {
 +                    projects.push(proj_files.master);
 +                }
 +
 +                var projectsAddedToSpies = [];
 +                var projectsNotAddedToSpies = [];
 +
 +                var projectsAddedTo = [];
 +                supportedPlatforms.forEach(function (platform) {
 +                    var platformProject = platformProjects[platform];
 +                    if (platformProject) {
 +                        projectsAddedTo.push(platformProjects[platform]);
 +                    }
 +                });
 +
 +                projects.forEach(function (project) {
 +                    var spy = spyOn(project, 'removeReferenceElementItemGroup');
 +                    if (projectsAddedTo.indexOf(path.basename(project.location)) > -1) {
 +                        projectsAddedToSpies.push(spy);
 +                    } else {
 +                        projectsNotAddedToSpies.push(spy);
 +                    }
 +                });
 +
 +                windows[tag].uninstall(elementToUninstall, cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
 +
 +                projectsAddedToSpies.forEach(function (spy) {
 +                    expect(spy).toHaveBeenCalledWith(xmlPath, incText, targetConditions);
 +                });
 +
 +                projectsNotAddedToSpies.forEach(function (spy) {
 +                    expect(spy).not.toHaveBeenCalled();
 +                });
 +            }
 +
 +            describe('of <source-file> elements', function () {
 +                it('should remove stuff by calling common.removeFile', function (done) {
 +                    var s = spyOn(common, 'removeFile');
 +
 +                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
 +                        .then(function () {
 +                            var source = copyArray(valid_source);
 +                            windows['source-file'].uninstall(source[0], cordovaProjectWindowsPlatformDir, dummy_id, null, proj_files);
 +                            expect(s).toHaveBeenCalledWith(cordovaProjectWindowsPlatformDir, path.join('plugins', 'org.test.plugins.dummyplugin', 'dummer.js'));
 +                            done();
 +                        });
 +                });
 +            });
 +
 +            describe('of <lib-file> elements', function () {
 +                // This could be separated into individual specs, but that results in a lot of copying and deleting the
 +                // project files, which is not needed.
 +                it('should remove from correct project files when conditions specified', function (done) {
 +                    var libfiles = copyArray(valid_libfiles);
 +
 +                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
 +                        .then(function () {
 +                            var path = 'ItemGroup/SDKReference';
 +                            var incText = 'TestSDK1, Version=1.0';
 +                            var targetConditions = {versions: undefined, target: undefined, arch: 'x86'};
 +                            validateUninstalledProjects('lib-file', libfiles[0], path, incText, targetConditions, ['all']);
 +
 +                            incText = 'TestSDK2, Version=1.0';
 +                            targetConditions = {versions: '>=8.1', target: undefined, arch: undefined};
 +                            validateUninstalledProjects('lib-file', libfiles[1], path, incText, targetConditions, ['windows', 'phone']);
 +
 +                            incText = 'TestSDK3, Version=1.0';
 +                            targetConditions = {versions: undefined, target: 'phone', arch: undefined};
 +                            validateUninstalledProjects('lib-file', libfiles[2], path, incText, targetConditions, ['phone']);
 +
 +                            incText = 'TestSDK4, Version=1.0';
 +                            targetConditions = {versions: '8.0', target: 'windows', arch: 'x86'};
 +                            validateUninstalledProjects('lib-file', libfiles[3], path, incText, targetConditions, ['windows8']);
 +
 +                            done();
 +                        });
 +                });
 +            });
 +
 +            describe('of <framework> elements', function () {
 +                // This could be separated into individual specs, but that results in a lot of copying and deleting the
 +                // project files, which is not needed.
 +                it('should remove from correct project files when conditions specified', function (done) {
 +                    var frameworks = copyArray(valid_frameworks);
 +
 +                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
 +                        .then(function () {
 +                            var path = 'ItemGroup/Reference';
 +                            var incText = 'dummy1';
 +                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
 +                            validateUninstalledProjects('framework', frameworks[0], path, incText, targetConditions, ['all']);
 +
 +                            incText = 'dummy2';
 +                            targetConditions = {versions: '>=8.0', target: undefined, arch: undefined};
 +                            validateUninstalledProjects('framework', frameworks[1], path, incText, targetConditions, ['all']);
 +
 +                            incText = 'dummy3';
 +                            targetConditions = {versions: undefined, target: 'windows', arch: undefined};
 +                            validateUninstalledProjects('framework', frameworks[2], path, incText, targetConditions, ['windows', 'windows8']);
 +
 +                            incText = 'dummy4';
 +                            targetConditions = {versions: '8.1', target: 'phone', arch: 'ARM'};
 +                            validateUninstalledProjects('framework', frameworks[3], path, incText, targetConditions, ['phone']);
 +
 +                            done();
 +                        });
 +                });
 +            });
 +
 +            describe('of <framework> elements of type \'projectReference\'', function () {
 +                // This could be separated into individual specs, but that results in a lot of copying and deleting the
 +                // project files, which is not needed.
 +                it('should remove from correct project files when conditions specified', function (done) {
 +                    var frameworks = copyArray(valid_frameworks);
 +
 +                    install('windows', cordovaProjectWindowsPlatformDir, dummyplugin, cordovaProjectPluginsDir, {})
 +                        .then(function () {
 +                            var xmlPath = 'ItemGroup/ProjectReference';
 +                            var incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy1.vcxproj');
 +                            var targetConditions = {versions: undefined, target: undefined, arch: 'x64'};
 +                            validateUninstalledProjects('framework', frameworks[4], xmlPath, incText, targetConditions, ['all']);
 +
 +                            incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy2.vcxproj');
 +                            targetConditions = {versions: '<8.1', target: undefined, arch: undefined};
 +                            validateUninstalledProjects('framework', frameworks[5], xmlPath, incText, targetConditions, ['windows8']);
 +
 +                            incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy3.vcxproj');
 +                            targetConditions = {versions: undefined, target: 'win', arch: undefined};
 +                            validateUninstalledProjects('framework', frameworks[6], xmlPath, incText, targetConditions, ['windows', 'windows8']);
 +
 +                            incText = windowsJoin(cordovaProjectPluginsDir , dummy_id, 'src', 'windows', 'dummy4.vcxproj');
 +                            targetConditions = {versions: '8.1', target: 'all', arch: 'x86'};
 +                            validateUninstalledProjects('framework', frameworks[7], xmlPath, incText, targetConditions, ['windows', 'phone']);
 +
 +                            done();
 +                        });
 +                });
 +            });
 +        });
 +    });
 +});
 +
 +function windowsJoin() {
 +    // Paths that are written to project files will be in Windows format, regardless of the current OS.
 +    return path.join.apply(path, arguments).split('/').join('\\');
 +}

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d98343e3/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
----------------------------------------------------------------------


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


[06/12] cordova-lib git commit: CB-8227 CB8237 CB-8238 Add --save flag and autosave to 'cordova platform add', 'cordova platform remove' and 'cordova platform update'

Posted by st...@apache.org.
CB-8227 CB8237 CB-8238 Add --save flag and autosave to 'cordova platform add',
'cordova platform remove' and 'cordova platform update'


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/b7eabab1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/b7eabab1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/b7eabab1

Branch: refs/heads/CB-8416
Commit: b7eabab1d8cee081a8baf4394cf16368f2b9c934
Parents: 0ee180c
Author: Omar Mefire <om...@microsoft.com>
Authored: Thu Jan 1 21:15:21 2015 -0800
Committer: Omar Mefire <om...@microsoft.com>
Committed: Thu Feb 5 09:37:03 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 33 ++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b7eabab1/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 7df0e51..76ca330 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -70,6 +70,7 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
     var xml = cordova_util.projectConfig(projectRoot);
     var cfg = new ConfigParser(xml);
     var config_json = config.read(projectRoot);
+    var autosave =  config_json.auto_save_platforms || false;
     opts = opts || {};
     opts.searchpath = opts.searchpath || config_json.plugin_search_path;
 
@@ -90,6 +91,12 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                     version = platform;
                     platform = null;
                 }
+
+                // If --save/autosave on && no version specified, use the pinned version
+                // e.g: 'cordova platform add android --save', 'cordova platform update android --save'
+                if( (opts.save || autosave) && !version ){
+                    version = platforms[platform].version;
+                }
                 if (platform && !version && cmd == 'add') {
                     events.emit('verbose', 'No version supplied. Retrieving version from config.xml...');
                     version = getVersionFromConfigFile(platform, cfg);
@@ -100,7 +107,6 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                 return downloadPlatform(projectRoot, platform, version, opts);
             }).then(function(platDetails) {
                 platform = platDetails.platform;
-                version = platDetails.version;
                 var platformPath = path.join(projectRoot, 'platforms', platform);
                 var platformAlreadyAdded = fs.existsSync(platformPath);
 
@@ -147,6 +153,15 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                     if (cmd == 'add') {
                         return installPluginsForNewPlatform(platform, projectRoot, cfg, opts);
                     }
+                }).then(function() {
+                    if(opts.save || autosave){
+                        // Save target into config.xml, overriding already existing settings
+                        events.emit('log', '--save flag or autosave detected');
+                        events.emit('log', 'Saving ' + platform + '@' + version + ' into config.xml file ...');
+                        cfg.removeEngine(platform);
+                        cfg.addEngine(platform, version);
+                        cfg.write();
+                    }                    
                 });
             });
         });
@@ -254,6 +269,20 @@ function remove(hooksRunner, projectRoot, targets, opts) {
             if (fs.existsSync(plugins_json)) shell.rm(plugins_json);
         });
     }).then(function() {
+        var config_json = config.read(projectRoot);
+        var autosave =  config_json.auto_save_platforms || false;
+	if(opts.save || autosave){
+	    targets.forEach(function(target) {
+		var platformId = target.split('@')[0];
+		var xml = cordova_util.projectConfig(projectRoot);
+		var cfg = new ConfigParser(xml);
+		events.emit('log', 'Removing ' + target + ' from config.xml file ...');
+		cfg.removeEngine(platformId);
+		cfg.write();
+	    });
+	}
+    })
+    .then(function() {
         return hooksRunner.fire('after_platform_rm', opts);
     });
 }
@@ -464,7 +493,7 @@ function platform(command, targets, opts) {
         case 'add':
             // CB-6976 Windows Universal Apps. windows8 is now alias for windows
             var idxWindows8 = targets.indexOf('windows8');
-            if (idxWindows8 >= 0) {
+            if (idxWindows8 >=0) {
                 targets[idxWindows8] = 'windows';
             }
             return add(hooksRunner, projectRoot, targets, opts);


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


[11/12] cordova-lib git commit: Merge branch 'CB-8123-final' of https://github.com/MSOpenTech/cordova-lib

Posted by st...@apache.org.
Merge branch 'CB-8123-final' of https://github.com/MSOpenTech/cordova-lib


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/37567dab
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/37567dab
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/37567dab

Branch: refs/heads/CB-8416
Commit: 37567dab758874b56731e211d32b855e28116d99
Parents: 629b886 98d17dd
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Feb 11 16:46:30 2015 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Feb 11 16:46:30 2015 -0800

----------------------------------------------------------------------
 .../spec-plugman/platforms/windows.spec.js      | 419 ++++++++++++++
 .../spec-plugman/platforms/windows8.spec.js     | 137 -----
 .../org.test.plugins.dummyplugin/plugin.xml     |  22 +-
 .../src/windows/dummer.js                       |   1 +
 .../src/windows/dummy1.dll                      |   0
 .../src/windows/dummy1.vcxproj                  |   7 +
 .../src/windows/dummy2.dll                      |   0
 .../src/windows/dummy2.vcxproj                  |   7 +
 .../src/windows/dummy3.dll                      |   0
 .../src/windows/dummy3.vcxproj                  |   7 +
 .../src/windows/dummy4.dll                      |   0
 .../src/windows/dummy4.vcxproj                  |   7 +
 .../src/windows8/dummer.js                      |   1 -
 .../org.test.plugins.faultyplugin/plugin.xml    |  14 +-
 .../src/windows/faultyPlugin.js                 |   1 +
 .../src/windows8/faultyPlugin.js                |   1 -
 .../projects/windows/CordovaApp.Phone.jsproj    |  99 ++++
 .../projects/windows/CordovaApp.Windows.jsproj  |  99 ++++
 .../windows/CordovaApp.Windows80.jsproj         |  93 ++++
 .../projects/windows/CordovaApp.projitems       |  32 ++
 .../projects/windows/CordovaApp.shproj          |  30 +
 .../projects/windows/CordovaApp.sln             | 134 +++++
 .../projects/windows/CordovaApp.vs2012.sln      |  64 +++
 .../windows/CordovaApp_TemporaryKey.pfx         | Bin 0 -> 2544 bytes
 .../spec-plugman/projects/windows/VERSION       |   1 +
 .../spec-plugman/projects/windows/config.xml    |  14 +
 .../projects/windows/package.phone.appxmanifest |  57 ++
 .../windows/package.windows.appxmanifest        |  58 ++
 .../windows/package.windows80.appxmanifest      |  50 ++
 cordova-lib/src/PluginInfo.js                   |   9 +-
 cordova-lib/src/plugman/platforms/windows.js    |  52 +-
 cordova-lib/src/util/windows/jsproj.js          | 309 -----------
 cordova-lib/src/util/windows/jsprojManager.js   | 544 +++++++++++++++++++
 33 files changed, 1789 insertions(+), 480 deletions(-)
----------------------------------------------------------------------



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