You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/07/25 19:04:31 UTC

[1/7] cordova-windows git commit: CB-11582 Remove duplicate capabilities when writing the AppxManifest

Repository: cordova-windows
Updated Branches:
  refs/heads/4.4.x ac4cb8735 -> f8479e5da


CB-11582 Remove duplicate capabilities when writing the AppxManifest

This closes #186


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

Branch: refs/heads/4.4.x
Commit: 4a4334982e6ad89711c289291edbf22ad909678e
Parents: ac4cb87
Author: Robert Schmid <r....@outlook.com>
Authored: Thu Jul 14 14:50:56 2016 -0700
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 25 11:59:19 2016 +0300

----------------------------------------------------------------------
 spec/unit/AppxManifest.spec.js       | 14 ++++++++++++++
 template/cordova/lib/AppxManifest.js | 24 +++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/4a433498/spec/unit/AppxManifest.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/AppxManifest.spec.js b/spec/unit/AppxManifest.spec.js
index 691252a..0da7afa 100644
--- a/spec/unit/AppxManifest.spec.js
+++ b/spec/unit/AppxManifest.spec.js
@@ -25,6 +25,7 @@ var Win10AppxManifest = AppxManifest.__get__('Win10AppxManifest');
 var refineColor = AppxManifest.__get__('refineColor');
 
 var WINDOWS_MANIFEST = 'template/package.windows.appxmanifest';
+var WINDOWS_10_MANIFEST = 'template/package.windows10.appxmanifest';
 var WINDOWS_PHONE_MANIFEST = 'template/package.phone.appxmanifest';
 var CSS_COLOR_NAME = 'turquoise';
 
@@ -169,6 +170,19 @@ describe('AppxManifest', function () {
         });
     });
 
+    describe('instance write method', function () {
+        it('should not write duplicate UAP capability declarations', function () {
+            var manifest = AppxManifest.get(WINDOWS_10_MANIFEST);
+            var capabilities = manifest.doc.find('.//Capabilities');
+            capabilities.append(new et.Element('uap:Capability', { 'Name': 'enterpriseAuthentication' }));
+            capabilities.append(new et.Element('uap:Capability', { 'Name': 'enterpriseAuthentication' }));
+            
+            var xml = manifest.writeToString();
+
+            expect((xml.match(/enterpriseAuthentication/g) || []).length).toBe(1);
+        });
+    });
+
     describe('getVisualElements methods', function () {
         it('refineColor should leave CSS color name as is', function () {
             expect(refineColor(CSS_COLOR_NAME)).toEqual(CSS_COLOR_NAME);

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/4a433498/template/cordova/lib/AppxManifest.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/AppxManifest.js b/template/cordova/lib/AppxManifest.js
index 68cbf1c..db59cf1 100644
--- a/template/cordova/lib/AppxManifest.js
+++ b/template/cordova/lib/AppxManifest.js
@@ -654,10 +654,15 @@ Win10AppxManifest.prototype.setDependencies = function (dependencies) {
  *   manifest will be written to file it has been read from.
  */
 Win10AppxManifest.prototype.write = function(destPath) {
+    fs.writeFileSync(destPath || this.path, this.writeToString(), 'utf-8');
+};
+
+Win10AppxManifest.prototype.writeToString = function() {
     ensureUapPrefixedCapabilities(this.doc.find('.//Capabilities'));
+    ensureUniqueCapabilities(this.doc.find('.//Capabilities'));
     // sort Capability elements as per CB-5350 Windows8 build fails due to invalid 'Capabilities' definition
     sortCapabilities(this.doc);
-    fs.writeFileSync(destPath || this.path, this.doc.write({indent: 4}), 'utf-8');
+    return this.doc.write({indent: 4});
 };
 
 /**
@@ -673,4 +678,21 @@ function ensureUapPrefixedCapabilities(capabilities) {
     });
 }
 
+/**
+ * Cleans up duplicate capability declarations that were generated during the prepare process
+ * @param capabilities {ElementTree.Element} The appx manifest element for <capabilities>
+ */
+function ensureUniqueCapabilities(capabilities) {
+    var uniqueCapabilities = [];
+    capabilities.getchildren()
+    .forEach(function(el) {
+        var name = el.attrib.Name;
+        if (uniqueCapabilities.indexOf(name) !== -1) {
+            capabilities.remove(el);
+        } else {
+            uniqueCapabilities.push(name);
+        }
+    });
+}
+
 module.exports = AppxManifest;


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


[2/7] cordova-windows git commit: CB-11241 Return adding BOM to www back to prepare

Posted by an...@apache.org.
CB-11241 Return adding BOM to www back to prepare


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

Branch: refs/heads/4.4.x
Commit: 070a6f07af5b8f10fd8d552c2d556903945cf28f
Parents: 4a43349
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Tue Jul 19 10:02:54 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 25 11:59:20 2016 +0300

----------------------------------------------------------------------
 spec/unit/build.spec.js         | 1 -
 template/cordova/lib/build.js   | 4 ----
 template/cordova/lib/prepare.js | 7 ++++---
 3 files changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/070a6f07/spec/unit/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index 396baa2..dc48356 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -88,7 +88,6 @@ describe('run method', function() {
 
         spyOn(utils, 'isCordovaProject').andReturn(true);
         spyOn(prepare, 'applyPlatformConfig');
-        spyOn(prepare, 'addBOMSignature');
         spyOn(prepare, 'updateBuildConfig');
         spyOn(package, 'getPackage').andReturn(Q({}));
 

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/070a6f07/template/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index b69afa5..84dedd8 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -49,7 +49,6 @@ var ROOT = path.resolve(__dirname, '../..');
 // See 'help' function for args list
 module.exports.run = function run (buildOptions) {
 
-    var that = this;
     ROOT = this.root || ROOT;
 
     if (!utils.isCordovaProject(this.root)){
@@ -78,9 +77,6 @@ module.exports.run = function run (buildOptions) {
     .then(function(msbuildTools) {
         // Apply build related configs
         prepare.updateBuildConfig(buildConfig);
-        // CB-5421 Add BOM to all html, js, css files
-        // to ensure app can pass Windows Store Certification
-        prepare.addBOMSignature(that.locations.www);
 
         if (buildConfig.publisherId) {
             updateManifestWithPublisher(msbuildTools, buildConfig);

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/070a6f07/template/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/prepare.js b/template/cordova/lib/prepare.js
index 2a3b676..2d3a9c9 100644
--- a/template/cordova/lib/prepare.js
+++ b/template/cordova/lib/prepare.js
@@ -458,6 +458,9 @@ module.exports.prepare = function (cordovaProject, options) {
     })
     .then(function () {
         copyImages(cordovaProject, self.locations);
+        // CB-5421 Add BOM to all html, js, css files
+        // to ensure app can pass Windows Store Certification
+        addBOMSignature(self.locations.www);
     })
     .then(function () {
         events.emit('verbose', 'Prepared windows project successfully');
@@ -495,7 +498,7 @@ module.exports.clean = function (options) {
 function addBOMSignature(directory) {
     shell.ls('-R', directory)
     .forEach(function (file) {
-        if (!file.match(/\.(js|html|css|json)$/i)) {
+        if (!file.match(/\.(js|htm|html|css|json)$/i)) {
             return;
         }
 
@@ -512,8 +515,6 @@ function addBOMSignature(directory) {
     });
 }
 
-module.exports.addBOMSignature = addBOMSignature;
-
 /**
  * Updates config files in project based on app's config.xml and config munge,
  *   generated by plugins.


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


[4/7] cordova-windows git commit: CB-11621 Update dependencies and check in node_modules

Posted by an...@apache.org.
CB-11621 Update dependencies and check in node_modules


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

Branch: refs/heads/4.4.x
Commit: 5e1da1fb00741c312ca7869189cb4f0667c2a581
Parents: 70adcc6
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Mon Jul 25 12:03:29 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 25 13:14:56 2016 +0300

----------------------------------------------------------------------
 node_modules/balanced-match/README.md           |   4 +-
 node_modules/balanced-match/index.js            |   2 +-
 node_modules/balanced-match/package.json        |  24 ++--
 node_modules/brace-expansion/index.js           |  10 ++
 node_modules/brace-expansion/package.json       |  22 ++--
 node_modules/cordova-common/README.md           |  14 +--
 node_modules/cordova-common/RELEASENOTES.md     |   3 +
 node_modules/cordova-common/package.json        |  38 +++---
 .../src/ConfigChanges/ConfigChanges.js          | 108 ++++++++++++++--
 .../src/ConfigChanges/ConfigFile.js             |  20 ++-
 .../src/ConfigChanges/munge-util.js             |   3 +
 node_modules/cordova-common/src/PlatformJson.js |   5 +-
 .../cordova-common/src/PluginInfo/PluginInfo.js |  18 ++-
 .../cordova-common/src/PluginManager.js         |   2 +-
 .../cordova-common/src/util/xml-helpers.js      | 124 ++++++++++++++-----
 node_modules/semver/README.md                   |   4 +
 node_modules/semver/package.json                |  34 ++---
 node_modules/semver/semver.js                   |  19 ++-
 package.json                                    |   4 +-
 19 files changed, 334 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/balanced-match/README.md
----------------------------------------------------------------------
diff --git a/node_modules/balanced-match/README.md b/node_modules/balanced-match/README.md
index d6880b2..08e918c 100644
--- a/node_modules/balanced-match/README.md
+++ b/node_modules/balanced-match/README.md
@@ -47,7 +47,7 @@ object with those keys:
 
 If there's no match, `undefined` will be returned.
 
-If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`.
+If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
 
 ### var r = balanced.range(a, b, str)
 
@@ -56,7 +56,7 @@ array with indexes: `[ <a index>, <b index> ]`.
 
 If there's no match, `undefined` will be returned.
 
-If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]`.
+If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
 
 ## Installation
 

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/balanced-match/index.js
----------------------------------------------------------------------
diff --git a/node_modules/balanced-match/index.js b/node_modules/balanced-match/index.js
index 4670f7f..e8d8587 100644
--- a/node_modules/balanced-match/index.js
+++ b/node_modules/balanced-match/index.js
@@ -30,7 +30,7 @@ function range(a, b, str) {
     begs = [];
     left = str.length;
 
-    while (i < str.length && i >= 0 && ! result) {
+    while (i >= 0 && !result) {
       if (i == ai) {
         begs.push(i);
         ai = str.indexOf(a, i + 1);

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/balanced-match/package.json
----------------------------------------------------------------------
diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json
index 5a6a85d..b0d9090 100644
--- a/node_modules/balanced-match/package.json
+++ b/node_modules/balanced-match/package.json
@@ -14,20 +14,20 @@
     ]
   ],
   "_from": "balanced-match@>=0.4.1 <0.5.0",
-  "_id": "balanced-match@0.4.1",
+  "_id": "balanced-match@0.4.2",
   "_inCache": true,
   "_installable": true,
   "_location": "/balanced-match",
-  "_nodeVersion": "6.0.0",
+  "_nodeVersion": "4.4.7",
   "_npmOperationalInternal": {
-    "host": "packages-12-west.internal.npmjs.com",
-    "tmp": "tmp/balanced-match-0.4.1.tgz_1462129663650_0.39764496590942144"
+    "host": "packages-16-east.internal.npmjs.com",
+    "tmp": "tmp/balanced-match-0.4.2.tgz_1468834991581_0.6590619895141572"
   },
   "_npmUser": {
     "name": "juliangruber",
     "email": "julian@juliangruber.com"
   },
-  "_npmVersion": "3.8.6",
+  "_npmVersion": "2.15.8",
   "_phantomChildren": {},
   "_requested": {
     "raw": "balanced-match@^0.4.1",
@@ -41,8 +41,8 @@
   "_requiredBy": [
     "/brace-expansion"
   ],
-  "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz",
-  "_shasum": "19053e2e0748eadb379da6c09d455cf5e1039335",
+  "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
+  "_shasum": "cb3f3e3c732dc0f01ee70b403f302e61d7709838",
   "_shrinkwrap": null,
   "_spec": "balanced-match@^0.4.1",
   "_where": "d:\\cordova\\cordova-windows\\node_modules\\brace-expansion",
@@ -57,14 +57,14 @@
   "dependencies": {},
   "description": "Match balanced character pairs, like \"{\" and \"}\"",
   "devDependencies": {
-    "tape": "~4.5.0"
+    "tape": "^4.6.0"
   },
   "directories": {},
   "dist": {
-    "shasum": "19053e2e0748eadb379da6c09d455cf5e1039335",
-    "tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz"
+    "shasum": "cb3f3e3c732dc0f01ee70b403f302e61d7709838",
+    "tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz"
   },
-  "gitHead": "7004b289baaaab6a832f4901735e29d37cc2a863",
+  "gitHead": "57c2ea29d89a2844ae3bdcc637c6e2cbb73725e2",
   "homepage": "https://github.com/juliangruber/balanced-match",
   "keywords": [
     "match",
@@ -107,5 +107,5 @@
       "android-browser/4.2..latest"
     ]
   },
-  "version": "0.4.1"
+  "version": "0.4.2"
 }

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/brace-expansion/index.js
----------------------------------------------------------------------
diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js
index 932718f..955f27c 100644
--- a/node_modules/brace-expansion/index.js
+++ b/node_modules/brace-expansion/index.js
@@ -66,6 +66,16 @@ function expandTop(str) {
   if (!str)
     return [];
 
+  // I don't know why Bash 4.3 does this, but it does.
+  // Anything starting with {} will have the first two bytes preserved
+  // but *only* at the top level, so {},a}b will not expand to anything,
+  // but a{},b}c will be expanded to [a}c,abc].
+  // One could argue that this is a bug in Bash, but since the goal of
+  // this module is to match Bash's rules, we escape a leading {}
+  if (str.substr(0, 2) === '{}') {
+    str = '\\{\\}' + str.substr(2);
+  }
+
   return expand(escapeBraces(str), true).map(unescapeBraces);
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/brace-expansion/package.json
----------------------------------------------------------------------
diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json
index e05d8db..1b5d417 100644
--- a/node_modules/brace-expansion/package.json
+++ b/node_modules/brace-expansion/package.json
@@ -14,20 +14,20 @@
     ]
   ],
   "_from": "brace-expansion@>=1.0.0 <2.0.0",
-  "_id": "brace-expansion@1.1.5",
+  "_id": "brace-expansion@1.1.6",
   "_inCache": true,
   "_installable": true,
   "_location": "/brace-expansion",
-  "_nodeVersion": "4.4.5",
+  "_nodeVersion": "4.4.7",
   "_npmOperationalInternal": {
     "host": "packages-16-east.internal.npmjs.com",
-    "tmp": "tmp/brace-expansion-1.1.5.tgz_1465989660138_0.34528115345165133"
+    "tmp": "tmp/brace-expansion-1.1.6.tgz_1469047715600_0.9362958471756428"
   },
   "_npmUser": {
     "name": "juliangruber",
     "email": "julian@juliangruber.com"
   },
-  "_npmVersion": "2.15.5",
+  "_npmVersion": "2.15.8",
   "_phantomChildren": {},
   "_requested": {
     "raw": "brace-expansion@^1.0.0",
@@ -41,8 +41,8 @@
   "_requiredBy": [
     "/minimatch"
   ],
-  "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.5.tgz",
-  "_shasum": "f5b4ad574e2cb7ccc1eb83e6fe79b8ecadf7a526",
+  "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz",
+  "_shasum": "7197d7eaa9b87e648390ea61fc66c84427420df9",
   "_shrinkwrap": null,
   "_spec": "brace-expansion@^1.0.0",
   "_where": "d:\\cordova\\cordova-windows\\node_modules\\minimatch",
@@ -60,14 +60,14 @@
   },
   "description": "Brace expansion as known from sh/bash",
   "devDependencies": {
-    "tape": "4.5.1"
+    "tape": "^4.6.0"
   },
   "directories": {},
   "dist": {
-    "shasum": "f5b4ad574e2cb7ccc1eb83e6fe79b8ecadf7a526",
-    "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.5.tgz"
+    "shasum": "7197d7eaa9b87e648390ea61fc66c84427420df9",
+    "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz"
   },
-  "gitHead": "ff31acab078f1bb696ac4c55ca56ea24e6495fb6",
+  "gitHead": "791262fa06625e9c5594cde529a21d82086af5f2",
   "homepage": "https://github.com/juliangruber/brace-expansion",
   "keywords": [],
   "license": "MIT",
@@ -109,5 +109,5 @@
       "android-browser/4.2..latest"
     ]
   },
-  "version": "1.1.5"
+  "version": "1.1.6"
 }

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/README.md
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/README.md b/node_modules/cordova-common/README.md
index 6454481..c5dcfd5 100644
--- a/node_modules/cordova-common/README.md
+++ b/node_modules/cordova-common/README.md
@@ -28,7 +28,7 @@ Expoeses shared functionality used by [cordova-lib](https://github.com/apache/co
 Represents special instance of NodeJS EventEmitter which is intended to be used to post events to cordova-lib and cordova-cli
 
 Usage:
-```
+```js
 var events = require('cordova-common').events;
 events.emit('warn', 'Some warning message')
 ```
@@ -41,7 +41,7 @@ An error class used by Cordova to throw cordova-specific errors. The CordovaErro
 
 Usage:
 
-```
+```js
 var CordovaError = require('cordova-common').CordovaError;
 throw new CordovaError('Some error message', SOME_ERR_CODE);
 ```
@@ -53,7 +53,7 @@ See [CordovaError](src/CordovaError/CordovaError.js) for supported error codes.
 Exposes functionality to deal with cordova project `config.xml` files. For ConfigParser API reference check [ConfigParser Readme](src/ConfigParser/README.md).
 
 Usage:
-```
+```js
 var ConfigParser = require('cordova-common').ConfigParser;
 var appConfig = new ConfigParser('path/to/cordova-app/config.xml');
 console.log(appconfig.name() + ':' + appConfig.version());
@@ -64,7 +64,7 @@ console.log(appconfig.name() + ':' + appConfig.version());
 `PluginInfo` is a wrapper for cordova plugins' `plugin.xml` files. This class may be instantiated directly or via `PluginInfoProvider`. The difference is that `PluginInfoProvider` caches `PluginInfo` instances based on plugin source directory.
 
 Usage:
-```
+```js
 var PluginInfo: require('cordova-common').PluginInfo;
 var PluginInfoProvider: require('cordova-common').PluginInfoProvider;
 
@@ -80,7 +80,7 @@ console.log('The plugin ' + plugin1.id + ' has version ' + plugin1.version)
 Utility module for dealing with sequential tasks. Provides a set of tasks that are needed to be done and reverts all tasks that are already completed if one of those tasks fail to complete. Used internally by cordova-lib and platform's plugin installation routines.
 
 Usage:
-```
+```js
 var ActionStack = require('cordova-common').ActionStack;
 var stack = new ActionStack()
 
@@ -104,7 +104,7 @@ stack.process()
 Module for spawning child processes with some advanced logic.
 
 Usage:
-```
+```js
 var superspawn = require('cordova-common').superspawn;
 superspawn.spawn('adb', ['devices'])
 .progress(function(data){
@@ -121,7 +121,7 @@ superspawn.spawn('adb', ['devices'])
 A set of utility methods for dealing with xml files.
 
 Usage:
-```
+```js
 var xml = require('cordova-common').xmlHelpers;
 
 var xmlDoc1 = xml.parseElementtreeSync('some/xml/file');

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/RELEASENOTES.md b/node_modules/cordova-common/RELEASENOTES.md
index 7a99cc9..71ad1ea 100644
--- a/node_modules/cordova-common/RELEASENOTES.md
+++ b/node_modules/cordova-common/RELEASENOTES.md
@@ -20,6 +20,9 @@
 -->
 # Cordova-common Release Notes
 
+### 1.4.0 (Jul 12, 2016)
+* [CB-11023](https://issues.apache.org/jira/browse/CB-11023) Add edit-config functionality
+
 ### 1.3.0 (May 12, 2016)
 * [CB-11259](https://issues.apache.org/jira/browse/CB-11259): Improving prepare and build logging
 * [CB-11194](https://issues.apache.org/jira/browse/CB-11194) Improve cordova load time

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/package.json
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/package.json b/node_modules/cordova-common/package.json
index ca00e1b..6543ba3 100644
--- a/node_modules/cordova-common/package.json
+++ b/node_modules/cordova-common/package.json
@@ -2,49 +2,49 @@
   "_args": [
     [
       {
-        "raw": "cordova-common@^1.3.0",
+        "raw": "cordova-common@^1.4.0",
         "scope": null,
         "escapedName": "cordova-common",
         "name": "cordova-common",
-        "rawSpec": "^1.3.0",
-        "spec": ">=1.3.0 <2.0.0",
+        "rawSpec": "^1.4.0",
+        "spec": ">=1.4.0 <2.0.0",
         "type": "range"
       },
       "d:\\cordova\\cordova-windows"
     ]
   ],
-  "_from": "cordova-common@>=1.3.0 <2.0.0",
-  "_id": "cordova-common@1.3.0",
+  "_from": "cordova-common@>=1.4.0 <2.0.0",
+  "_id": "cordova-common@1.4.0",
   "_inCache": true,
   "_installable": true,
   "_location": "/cordova-common",
-  "_nodeVersion": "5.4.1",
+  "_nodeVersion": "6.3.0",
   "_npmOperationalInternal": {
     "host": "packages-16-east.internal.npmjs.com",
-    "tmp": "tmp/cordova-common-1.3.0.tgz_1464130094288_0.48495062021538615"
+    "tmp": "tmp/cordova-common-1.4.0.tgz_1469092638680_0.9961137105710804"
   },
   "_npmUser": {
-    "name": "stevegill",
-    "email": "stevengill97@gmail.com"
+    "name": "kotikov.vladimir",
+    "email": "kotikov.vladimir@gmail.com"
   },
-  "_npmVersion": "3.9.0",
+  "_npmVersion": "3.10.5",
   "_phantomChildren": {},
   "_requested": {
-    "raw": "cordova-common@^1.3.0",
+    "raw": "cordova-common@^1.4.0",
     "scope": null,
     "escapedName": "cordova-common",
     "name": "cordova-common",
-    "rawSpec": "^1.3.0",
-    "spec": ">=1.3.0 <2.0.0",
+    "rawSpec": "^1.4.0",
+    "spec": ">=1.4.0 <2.0.0",
     "type": "range"
   },
   "_requiredBy": [
     "/"
   ],
-  "_resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.3.0.tgz",
-  "_shasum": "f75161f6aa7cef5486fd5d69a3b0a1f628334491",
+  "_resolved": "file:cordova-common-1.4.0.tgz",
+  "_shasum": "b3ba73595caa34fe8250ac11f20a4ed44e7c84e4",
   "_shrinkwrap": null,
-  "_spec": "cordova-common@^1.3.0",
+  "_spec": "cordova-common@^1.4.0",
   "_where": "d:\\cordova\\cordova-windows",
   "author": {
     "name": "Apache Software Foundation"
@@ -79,8 +79,8 @@
   },
   "directories": {},
   "dist": {
-    "shasum": "f75161f6aa7cef5486fd5d69a3b0a1f628334491",
-    "tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.3.0.tgz"
+    "shasum": "b3ba73595caa34fe8250ac11f20a4ed44e7c84e4",
+    "tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.4.0.tgz"
   },
   "engineStrict": true,
   "engines": {
@@ -127,5 +127,5 @@
     "jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec",
     "test": "npm run jshint && npm run jasmine"
   },
-  "version": "1.3.0"
+  "version": "1.4.0"
 }

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js b/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
index a914fc8..a395c6d 100644
--- a/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
+++ b/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
@@ -36,9 +36,11 @@ var fs   = require('fs'),
     et   = require('elementtree'),
     semver = require('semver'),
     events = require('../events'),
-    ConfigKeeper = require('./ConfigKeeper');
+    ConfigKeeper = require('./ConfigKeeper'),
+    CordovaLogger = require('../CordovaLogger');
 
 var mungeutil = require('./munge-util');
+var xml_helpers = require('../util/xml-helpers');
 
 exports.PlatformMunger = PlatformMunger;
 
@@ -95,9 +97,10 @@ function remove_plugin_changes(pluginInfo, is_top_level) {
     var plugin_vars = is_top_level ?
         platform_config.installed_plugins[pluginInfo.id] :
         platform_config.dependent_plugins[pluginInfo.id];
+    var edit_config_changes = pluginInfo.getEditConfigs(self.platform);
 
     // get config munge, aka how did this plugin change various config files
-    var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
+    var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
     // global munge looks at all plugins' changes to config files
     var global_munge = platform_config.config_munge;
     var munge = mungeutil.decrement_munge(global_munge, config_munge);
@@ -125,12 +128,40 @@ function remove_plugin_changes(pluginInfo, is_top_level) {
 
 
 PlatformMunger.prototype.add_plugin_changes = add_plugin_changes;
-function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increment) {
+function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increment, plugin_force) {
     var self = this;
     var platform_config = self.platformJson.root;
+    var edit_config_changes = pluginInfo.getEditConfigs(self.platform);
+    var config_munge;
 
-    // get config munge, aka how should this plugin change various config files
-    var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
+    if (!edit_config_changes || edit_config_changes.length === 0) {
+        // get config munge, aka how should this plugin change various config files
+        config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
+    }
+    else {
+        var isConflictingInfo = is_conflicting(edit_config_changes, platform_config.config_munge, self, plugin_force);
+        if (plugin_force) {
+            CordovaLogger.get().log(CordovaLogger.WARN, '--force is used. edit-config will overwrite conflicts if any. Conflicting plugins may not work as expected.');
+
+            // remove conflicting munges
+            var conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.conflictingMunge);
+            for (var conflict_file in conflict_munge.files) {
+                self.apply_file_munge(conflict_file, conflict_munge.files[conflict_file], /* remove = */ true);
+            }
+
+            // force add new munges
+            config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
+        }
+        else if(isConflictingInfo.conflictFound) {
+            throw new Error('There was a conflict trying to modify attributes with <edit-config> in plugin ' + pluginInfo.id +
+            '. The conflicting plugin, ' + isConflictingInfo.conflictingPlugin + ', already modified the same attributes. The conflict must be resolved before ' +
+            pluginInfo.id + ' can be added. You may use --force to add the plugin and overwrite the conflicting attributes.');
+        }
+        else {
+            // no conflicts, will handle edit-config
+            config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
+        }
+    }
     // global munge looks at all plugins' changes to config files
 
     // TODO: The should_increment param is only used by cordova-cli and is going away soon.
@@ -186,13 +217,17 @@ function reapply_global_munge () {
 // generate_plugin_config_munge
 // Generate the munge object from plugin.xml + vars
 PlatformMunger.prototype.generate_plugin_config_munge = generate_plugin_config_munge;
-function generate_plugin_config_munge(pluginInfo, vars) {
+function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
     var self = this;
 
     vars = vars || {};
     var munge = { files: {} };
     var changes = pluginInfo.getConfigFiles(self.platform);
 
+    if(edit_config_changes) {
+        Array.prototype.push.apply(changes, edit_config_changes);
+    }
+
     // Demux 'package.appxmanifest' into relevant platform-specific appx manifests.
     // Only spend the cycles if there are version-specific plugin settings
     if (self.platform === 'windows' &&
@@ -291,12 +326,69 @@ function generate_plugin_config_munge(pluginInfo, vars) {
                 });
             }
             // 2. add into munge
-            mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
+            if (change.mode) {
+                mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, plugin: pluginInfo.id });
+            }
+            else {
+                mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
+            }
         });
     });
     return munge;
 }
 
+function is_conflicting(editchanges, config_munge, self, force) {
+    var files = config_munge.files;
+    var conflictFound = false;
+    var conflictingMunge = { files: {} };
+    var conflictingParent;
+    var conflictingPlugin;
+
+    editchanges.forEach(function(editchange) {
+        if (files[editchange.file]) {
+            var parents = files[editchange.file].parents;
+            var target = parents[editchange.target];
+
+            // Check if the edit target will resolve to an existing target
+            if (!target || target.length === 0) {
+                var file_xml = self.config_keeper.get(self.project_dir, self.platform, editchange.file).data;
+                var resolveEditTarget = xml_helpers.resolveParent(file_xml, editchange.target);
+                var resolveTarget;
+
+                if (resolveEditTarget) {
+                    for (var parent in parents) {
+                        resolveTarget = xml_helpers.resolveParent(file_xml, parent);
+                        if (resolveEditTarget === resolveTarget) {
+                            conflictingParent = parent;
+                            target = parents[parent];
+                            break;
+                        }
+                    }
+                }
+            }
+            else {
+                conflictingParent = editchange.target;
+            }
+
+            if (target.length !== 0) {
+                // conflict has been found, exit and throw an error
+                conflictFound = true;
+                if (!force) {
+                    // since there has been modifications to the attributes at this target,
+                    // the current plugin should not modify the attributes
+                    conflictingPlugin = target[0].plugin;
+                    return;
+                }
+
+                // need to find all conflicts when --force is used, track conflicting munges
+                mungeutil.deep_add(conflictingMunge, editchange.file, conflictingParent, target[0]);
+            }
+        }
+    });
+
+    return {conflictFound: conflictFound, conflictingPlugin: conflictingPlugin, conflictingMunge: conflictingMunge};
+}
+
 // Go over the prepare queue and apply the config munges for each plugin
 // that has been (un)installed.
 PlatformMunger.prototype.process = PlatformMunger_process;
@@ -313,7 +405,7 @@ function PlatformMunger_process(plugins_dir) {
     // Now handle installation
     platform_config.prepare_queue.installed.forEach(function(u) {
         var pluginInfo = self.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
-        self.add_plugin_changes(pluginInfo, u.vars, u.topLevel, true);
+        self.add_plugin_changes(pluginInfo, u.vars, u.topLevel, true, u.force);
     });
 
     // Empty out installed/ uninstalled queues.

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js b/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
index 9c540b9..179d54d 100644
--- a/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
+++ b/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
@@ -103,7 +103,16 @@ ConfigFile.prototype.graft_child = function ConfigFile_graft_child(selector, xml
     var result;
     if (self.type === 'xml') {
         var xml_to_graft = [modules.et.XML(xml_child.xml)];
-        result = modules.xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after);
+        switch (xml_child.mode) {
+            case 'merge':
+                result = modules.xml_helpers.graftXMLMerge(self.data, xml_to_graft, selector, xml_child);
+                break;
+            case 'overwrite':
+                result = modules.xml_helpers.graftXMLOverwrite(self.data, xml_to_graft, selector, xml_child);
+                break;
+            default:
+                result = modules.xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after);
+        }
         if ( !result) {
             throw new Error('Unable to graft xml at selector "' + selector + '" from "' + filepath + '" during config install');
         }
@@ -123,7 +132,14 @@ ConfigFile.prototype.prune_child = function ConfigFile_prune_child(selector, xml
     var result;
     if (self.type === 'xml') {
         var xml_to_graft = [modules.et.XML(xml_child.xml)];
-        result = modules.xml_helpers.pruneXML(self.data, xml_to_graft, selector);
+        switch (xml_child.mode) {
+            case 'merge':
+            case 'overwrite':
+                result = modules.xml_helpers.pruneXMLRestore(self.data, selector, xml_child);
+                break;
+            default:
+                result = modules.xml_helpers.pruneXML(self.data, xml_to_graft, selector);
+        }
     } else {
         // plist file
         result = modules.plist_helpers.prunePLIST(self.data, xml_child.xml, selector);

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/src/ConfigChanges/munge-util.js
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/src/ConfigChanges/munge-util.js b/node_modules/cordova-common/src/ConfigChanges/munge-util.js
index 307b3c1..0149bab 100644
--- a/node_modules/cordova-common/src/ConfigChanges/munge-util.js
+++ b/node_modules/cordova-common/src/ConfigChanges/munge-util.js
@@ -52,6 +52,9 @@ exports.deep_remove = function deep_remove(obj, keys /* or key1, key2 .... */ )
             return element.xml == k.xml;
         });
         if (found) {
+            if (parentArray[index].oldAttrib) {
+                k.oldAttrib = _.extend({}, parentArray[index].oldAttrib);
+            }
             found.count -= k.count;
             if (found.count > 0) {
                 return false;

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/src/PlatformJson.js
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/src/PlatformJson.js b/node_modules/cordova-common/src/PlatformJson.js
index 4e2b287..ab94b5f 100644
--- a/node_modules/cordova-common/src/PlatformJson.js
+++ b/node_modules/cordova-common/src/PlatformJson.js
@@ -162,8 +162,8 @@ PlatformJson.prototype.removePluginMetadata = function (pluginInfo) {
     return this;
 };
 
-PlatformJson.prototype.addInstalledPluginToPrepareQueue = function(pluginDirName, vars, is_top_level) {
-    this.root.prepare_queue.installed.push({'plugin':pluginDirName, 'vars':vars, 'topLevel':is_top_level});
+PlatformJson.prototype.addInstalledPluginToPrepareQueue = function(pluginDirName, vars, is_top_level, force) {
+    this.root.prepare_queue.installed.push({'plugin':pluginDirName, 'vars':vars, 'topLevel':is_top_level, 'force':force});
 };
 
 PlatformJson.prototype.addUninstalledPluginToPrepareQueue = function(pluginId, is_top_level) {
@@ -276,4 +276,3 @@ function ModuleMetadata (pluginId, jsModule) {
 }
 
 module.exports = PlatformJson;
-

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/src/PluginInfo/PluginInfo.js
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/src/PluginInfo/PluginInfo.js b/node_modules/cordova-common/src/PluginInfo/PluginInfo.js
index 77199ec..bf1f75b 100644
--- a/node_modules/cordova-common/src/PluginInfo/PluginInfo.js
+++ b/node_modules/cordova-common/src/PluginInfo/PluginInfo.js
@@ -146,6 +146,22 @@ function PluginInfo(dirname) {
         return configFile;
     }
 
+    self.getEditConfigs = getEditConfigs;
+    function getEditConfigs(platform) {
+        var editConfigs = _getTags(self._et, 'edit-config', platform, _parseEditConfigs);
+        return editConfigs;
+    }
+
+    function _parseEditConfigs(tag) {
+        var editConfig =
+        { file : tag.attrib['file']
+        , target : tag.attrib['target']
+        , mode : tag.attrib['mode']
+        , xmls : tag.getchildren()
+        };
+        return editConfig;
+    }
+
     // <info> tags, both global and within a <platform>
     // TODO (kamrik): Do we ever use <info> under <platform>? Example wanted.
     self.getInfo = getInfo;
@@ -382,7 +398,7 @@ function _getTags(pelem, tag, platform, transform) {
     return tags;
 }
 
-// Same as _getTags() but only looks inside a platfrom section.
+// Same as _getTags() but only looks inside a platform section.
 function _getTagsInPlatform(pelem, tag, platform, transform) {
     var platformTag = pelem.find('./platform[@name="' + platform + '"]');
     var tags = platformTag ? platformTag.findall(tag) : [];

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/src/PluginManager.js
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/src/PluginManager.js b/node_modules/cordova-common/src/PluginManager.js
index c3a29fc..e8968f1 100644
--- a/node_modules/cordova-common/src/PluginManager.js
+++ b/node_modules/cordova-common/src/PluginManager.js
@@ -123,7 +123,7 @@ PluginManager.prototype.doOperation = function (operation, plugin, options) {
         if (operation === PluginManager.INSTALL) {
             // Ignore passed `is_top_level` option since platform itself doesn't know
             // anything about managing dependencies - it's responsibility of caller.
-            self.munger.add_plugin_changes(plugin, options.variables, /*is_top_level=*/true, /*should_increment=*/true);
+            self.munger.add_plugin_changes(plugin, options.variables, /*is_top_level=*/true, /*should_increment=*/true, options.force);
             self.munger.platformJson.addPluginMetadata(plugin);
         } else {
             self.munger.remove_plugin_changes(plugin, /*is_top_level=*/true);

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/cordova-common/src/util/xml-helpers.js
----------------------------------------------------------------------
diff --git a/node_modules/cordova-common/src/util/xml-helpers.js b/node_modules/cordova-common/src/util/xml-helpers.js
index 6366af9..f16eaaf 100644
--- a/node_modules/cordova-common/src/util/xml-helpers.js
+++ b/node_modules/cordova-common/src/util/xml-helpers.js
@@ -29,6 +29,9 @@ var fs = require('fs')
   , et = require('elementtree')
   ;
 
+  var ROOT = /^\/([^\/]*)/,
+      ABSOLUTE = /^\/([^\/]*)\/(.*)/;
+
 module.exports = {
     // compare two et.XML nodes, see if they match
     // compares tagName, text, attributes and children (recursively)
@@ -68,7 +71,7 @@ module.exports = {
 
     // adds node to doc at selector, creating parent if it doesn't exist
     graftXML: function(doc, nodes, selector, after) {
-        var parent = resolveParent(doc, selector);
+        var parent = module.exports.resolveParent(doc, selector);
         if (!parent) {
             //Try to create the parent recursively if necessary
             try {
@@ -79,7 +82,7 @@ module.exports = {
             } catch (e) {
                 return false;
             }
-            parent = resolveParent(doc, selector);
+            parent = module.exports.resolveParent(doc, selector);
             if (!parent) return false;
         }
 
@@ -97,9 +100,54 @@ module.exports = {
         return true;
     },
 
+    // adds new attributes to doc at selector
+    // Will only merge if attribute has not been modified already or --force is used
+    graftXMLMerge: function(doc, nodes, selector, xml) {
+        var target = module.exports.resolveParent(doc, selector);
+        if (!target) return false;
+
+        // saves the attributes of the original xml before making changes
+        xml.oldAttrib = _.extend({}, target.attrib);
+
+        nodes.forEach(function (node) {
+            var attributes = node.attrib;
+            for (var attribute in attributes) {
+                target.attrib[attribute] = node.attrib[attribute];
+            }
+        });
+
+        return true;
+    },
+
+    // overwrite all attributes to doc at selector with new attributes
+    // Will only overwrite if attribute has not been modified already or --force is used
+    graftXMLOverwrite: function(doc, nodes, selector, xml) {
+        var target = module.exports.resolveParent(doc, selector);
+        if (!target) return false;
+
+        // saves the attributes of the original xml before making changes
+        xml.oldAttrib = _.extend({}, target.attrib);
+
+        // remove old attributes from target
+        var targetAttributes = target.attrib;
+        for (var targetAttribute in targetAttributes) {
+            delete targetAttributes[targetAttribute];
+        }
+
+        // add new attributes to target
+        nodes.forEach(function (node) {
+            var attributes = node.attrib;
+            for (var attribute in attributes) {
+                target.attrib[attribute] = node.attrib[attribute];
+            }
+        });
+
+        return true;
+    },
+
     // removes node from doc at selector
     pruneXML: function(doc, nodes, selector) {
-        var parent = resolveParent(doc, selector);
+        var parent = module.exports.resolveParent(doc, selector);
         if (!parent) return false;
 
         nodes.forEach(function (node) {
@@ -114,6 +162,19 @@ module.exports = {
         return true;
     },
 
+    // restores attributes from doc at selector
+    pruneXMLRestore: function(doc, selector, xml) {
+        var target = module.exports.resolveParent(doc, selector);
+        if (!target) return false;
+
+        if (xml.oldAttrib) {
+            target.attrib = _.extend({}, xml.oldAttrib);
+        }
+
+        return true;
+    },
+
+
     parseElementtreeSync: function (filename) {
         var contents = fs.readFileSync(filename, 'utf-8');
         if(contents) {
@@ -121,6 +182,30 @@ module.exports = {
             contents = contents.substring(contents.indexOf('<'));
         }
         return new et.ElementTree(et.XML(contents));
+    },
+
+    resolveParent: function (doc, selector) {
+        var parent, tagName, subSelector;
+
+        // handle absolute selector (which elementtree doesn't like)
+        if (ROOT.test(selector)) {
+            tagName = selector.match(ROOT)[1];
+            // test for wildcard "any-tag" root selector
+            if (tagName == '*' || tagName === doc._root.tag) {
+                parent = doc._root;
+
+                // could be an absolute path, but not selecting the root
+                if (ABSOLUTE.test(selector)) {
+                    subSelector = selector.match(ABSOLUTE)[2];
+                    parent = parent.find(subSelector);
+                }
+            } else {
+                return false;
+            }
+        } else {
+            parent = doc.find(selector);
+        }
+        return parent;
     }
 };
 
@@ -152,33 +237,6 @@ function uniqueChild(node, parent) {
     }
 }
 
-var ROOT = /^\/([^\/]*)/,
-    ABSOLUTE = /^\/([^\/]*)\/(.*)/;
-
-function resolveParent(doc, selector) {
-    var parent, tagName, subSelector;
-
-    // handle absolute selector (which elementtree doesn't like)
-    if (ROOT.test(selector)) {
-        tagName = selector.match(ROOT)[1];
-        // test for wildcard "any-tag" root selector
-        if (tagName == '*' || tagName === doc._root.tag) {
-            parent = doc._root;
-
-            // could be an absolute path, but not selecting the root
-            if (ABSOLUTE.test(selector)) {
-                subSelector = selector.match(ABSOLUTE)[2];
-                parent = parent.find(subSelector);
-            }
-        } else {
-            return false;
-        }
-    } else {
-        parent = doc.find(selector);
-    }
-    return parent;
-}
-
 // Find the index at which to insert an entry. After is a ;-separated priority list
 // of tags after which the insertion should be made. E.g. If we need to
 // insert an element C, and the rule is that the order of children has to be
@@ -257,19 +315,19 @@ function mergeXml(src, dest, platform, clobber) {
             dest.append(destChild);
         }
     }
-    
+
     function removeDuplicatePreferences(xml) {
         // reduce preference tags to a hashtable to remove dupes
         var prefHash = xml.findall('preference[@name][@value]').reduce(function(previousValue, currentValue) {
             previousValue[ currentValue.attrib.name ] = currentValue.attrib.value;
             return previousValue;
         }, {});
-        
+
         // remove all preferences
         xml.findall('preference[@name][@value]').forEach(function(pref) {
             xml.remove(pref);
         });
-        
+
         // write new preferences
         Object.keys(prefHash).forEach(function(key, index) {
             var element = et.SubElement(xml, 'preference');

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/semver/README.md
----------------------------------------------------------------------
diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md
index 27b044e..cbd9565 100644
--- a/node_modules/semver/README.md
+++ b/node_modules/semver/README.md
@@ -4,6 +4,8 @@ semver(1) -- The semantic versioner for npm
 ## Usage
 
     $ npm install semver
+    $ node
+    var semver = require('semver')
 
     semver.valid('1.2.3') // '1.2.3'
     semver.valid('a.b.c') // null
@@ -325,6 +327,8 @@ strings that they parse.
   range.
 * `maxSatisfying(versions, range)`: Return the highest version in the list
   that satisfies the range, or `null` if none of them do.
+* `minSatisfying(versions, range)`: Return the lowest version in the list
+  that satisfies the range, or `null` if none of them do.
 * `gtr(version, range)`: Return `true` if version is greater than all the
   versions possible in the range.
 * `ltr(version, range)`: Return `true` if version is less than all the

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/semver/package.json
----------------------------------------------------------------------
diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json
index c8c4df2..46860ab 100644
--- a/node_modules/semver/package.json
+++ b/node_modules/semver/package.json
@@ -2,50 +2,50 @@
   "_args": [
     [
       {
-        "raw": "semver@^5.2.0",
+        "raw": "semver@^5.3.0",
         "scope": null,
         "escapedName": "semver",
         "name": "semver",
-        "rawSpec": "^5.2.0",
-        "spec": ">=5.2.0 <6.0.0",
+        "rawSpec": "^5.3.0",
+        "spec": ">=5.3.0 <6.0.0",
         "type": "range"
       },
       "d:\\cordova\\cordova-windows"
     ]
   ],
-  "_from": "semver@>=5.2.0 <6.0.0",
-  "_id": "semver@5.2.0",
+  "_from": "semver@>=5.3.0 <6.0.0",
+  "_id": "semver@5.3.0",
   "_inCache": true,
   "_installable": true,
   "_location": "/semver",
   "_nodeVersion": "4.4.4",
   "_npmOperationalInternal": {
     "host": "packages-12-west.internal.npmjs.com",
-    "tmp": "tmp/semver-5.2.0.tgz_1467136841238_0.2250258030835539"
+    "tmp": "tmp/semver-5.3.0.tgz_1468515166602_0.9155273644719273"
   },
   "_npmUser": {
     "name": "isaacs",
     "email": "i@izs.me"
   },
-  "_npmVersion": "3.10.2",
+  "_npmVersion": "3.10.6",
   "_phantomChildren": {},
   "_requested": {
-    "raw": "semver@^5.2.0",
+    "raw": "semver@^5.3.0",
     "scope": null,
     "escapedName": "semver",
     "name": "semver",
-    "rawSpec": "^5.2.0",
-    "spec": ">=5.2.0 <6.0.0",
+    "rawSpec": "^5.3.0",
+    "spec": ">=5.3.0 <6.0.0",
     "type": "range"
   },
   "_requiredBy": [
     "/",
     "/cordova-common"
   ],
-  "_resolved": "https://registry.npmjs.org/semver/-/semver-5.2.0.tgz",
-  "_shasum": "281995b80c1448209415ddbc4cf50c269cef55c5",
+  "_resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
+  "_shasum": "9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f",
   "_shrinkwrap": null,
-  "_spec": "semver@^5.2.0",
+  "_spec": "semver@^5.3.0",
   "_where": "d:\\cordova\\cordova-windows",
   "bin": {
     "semver": "./bin/semver"
@@ -60,15 +60,15 @@
   },
   "directories": {},
   "dist": {
-    "shasum": "281995b80c1448209415ddbc4cf50c269cef55c5",
-    "tarball": "https://registry.npmjs.org/semver/-/semver-5.2.0.tgz"
+    "shasum": "9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f",
+    "tarball": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz"
   },
   "files": [
     "bin",
     "range.bnf",
     "semver.js"
   ],
-  "gitHead": "f7fef36765c53ebe237bf415c3ea002f24aa5621",
+  "gitHead": "d21444a0658224b152ce54965d02dbe0856afb84",
   "homepage": "https://github.com/npm/node-semver#readme",
   "license": "ISC",
   "main": "semver.js",
@@ -92,5 +92,5 @@
   "scripts": {
     "test": "tap test/*.js"
   },
-  "version": "5.2.0"
+  "version": "5.3.0"
 }

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/node_modules/semver/semver.js
----------------------------------------------------------------------
diff --git a/node_modules/semver/semver.js b/node_modules/semver/semver.js
index b2d7298..5f1a3c5 100644
--- a/node_modules/semver/semver.js
+++ b/node_modules/semver/semver.js
@@ -314,9 +314,9 @@ function SemVer(version, loose) {
   else
     this.prerelease = m[4].split('.').map(function(id) {
       if (/^[0-9]+$/.test(id)) {
-        var num = +id
+        var num = +id;
         if (num >= 0 && num < MAX_SAFE_INTEGER)
-          return num
+          return num;
       }
       return id;
     });
@@ -966,11 +966,11 @@ function replaceXRange(comp, loose) {
       } else if (gtlt === '<=') {
         // <=0.7.x is actually <0.8.0, since any 0.7.x should
         // pass.  Similarly, <=7.x is actually <8.0.0, etc.
-        gtlt = '<'
+        gtlt = '<';
         if (xm)
-          M = +M + 1
+          M = +M + 1;
         else
-          m = +m + 1
+          m = +m + 1;
       }
 
       ret = gtlt + M + '.' + m + '.' + p;
@@ -1094,6 +1094,15 @@ function maxSatisfying(versions, range, loose) {
   })[0] || null;
 }
 
+exports.minSatisfying = minSatisfying;
+function minSatisfying(versions, range, loose) {
+  return versions.filter(function(version) {
+    return satisfies(version, range, loose);
+  }).sort(function(a, b) {
+    return compare(a, b, loose);
+  })[0] || null;
+}
+
 exports.validRange = validRange;
 function validRange(range, loose) {
   try {

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5e1da1fb/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 1ebaf82..01a7bc2 100644
--- a/package.json
+++ b/package.json
@@ -21,12 +21,12 @@
     "jshint": "jshint bin && jshint template && jshint spec"
   },
   "dependencies": {
-    "cordova-common": "^1.3.0",
+    "cordova-common": "^1.4.0",
     "elementtree": "^0.1.6",
     "node-uuid": "^1.4.3",
     "nopt": "^3.0.4",
     "q": "^1.4.1",
-    "semver": "^5.2.0",
+    "semver": "^5.3.0",
     "shelljs": "^0.5.3",
     "winjs": "^4.4.0"
   },


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


[7/7] cordova-windows git commit: CB-11621 Update RELEASENOTES

Posted by an...@apache.org.
CB-11621 Update RELEASENOTES


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

Branch: refs/heads/4.4.x
Commit: f8479e5daf3d88665fe5deabd6d7a3a2288e8e57
Parents: 4f3c14b
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Mon Jul 25 12:19:03 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 25 13:15:45 2016 +0300

----------------------------------------------------------------------
 RELEASENOTES.md | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/f8479e5d/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index acc505d..7f39cdd 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -24,6 +24,11 @@ Update these notes using: git log --pretty=format:'* %s' --topo-order --no-merge
 
 cordova-windows is a library that enables developers to create Windows 8/8.1/10 and WP8.1 application projects that support Cordova APIs.
 
+### 4.4.2 (Jul 25, 2016)
+* [CB-11548](https://issues.apache.org/jira/browse/CB-11548) Fix issues where MSBuild cannot be found
+* [CB-11241](https://issues.apache.org/jira/browse/CB-11241) Return adding BOM to www back to prepare
+* [CB-11582](https://issues.apache.org/jira/browse/CB-11582) Remove duplicate capabilities when writing the appxmanifest
+
 ### 4.4.1 (Jul 11, 2016)
 * [CB-11522](https://issues.apache.org/jira/browse/CB-11522) Save raw 'detail' object to activation context
 * [CB-11538](https://issues.apache.org/jira/browse/CB-11538) Update README with information about logging


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


[5/7] cordova-windows git commit: CB-11621 Update JS snapshot to version 4.4.2 (via coho)

Posted by an...@apache.org.
CB-11621 Update JS snapshot to version 4.4.2 (via coho)


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

Branch: refs/heads/4.4.x
Commit: f5140e42944b4139f26e731798baa52c62a10883
Parents: 5e1da1f
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Mon Jul 25 12:13:48 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 25 13:15:17 2016 +0300

----------------------------------------------------------------------
 template/www/cordova.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/f5140e42/template/www/cordova.js
----------------------------------------------------------------------
diff --git a/template/www/cordova.js b/template/www/cordova.js
index 59d196f..2ea0612 100644
--- a/template/www/cordova.js
+++ b/template/www/cordova.js
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var PLATFORM_VERSION_BUILD_LABEL = '4.4.1';
+var PLATFORM_VERSION_BUILD_LABEL = '4.4.2';
 // file: src/scripts/require.js
 
 /*jshint -W079 */


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


[3/7] cordova-windows git commit: CB-11548 Fix issues where MSBuild cannot be found

Posted by an...@apache.org.
CB-11548 Fix issues where MSBuild cannot be found

This is due to VS installation change. Let Cordova Windows look for MSBuild under VSINSTALLDIR process environment variable. Also, make Cordova Windows more resilient to MSBuild version change. This commit contains work by Vladimir and Jason. Code is reviewed by Vladimir and Tim Barham. Commits are squashed.


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

Branch: refs/heads/4.4.x
Commit: 70adcc6fc807751e3fc0173c9dcd30c259600bab
Parents: 070a6f0
Author: Jason Wang (DEVDIV) <ji...@microsoft.com>
Authored: Thu Jul 21 13:47:49 2016 -0700
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 25 11:59:21 2016 +0300

----------------------------------------------------------------------
 spec/unit/build.spec.js              | 25 ++++++++++++--
 template/cordova/lib/MSBuildTools.js | 23 ++++++++++---
 template/cordova/lib/build.js        | 57 ++++++++++++++++---------------
 3 files changed, 71 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/70adcc6f/spec/unit/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index dc48356..e8fd8d8 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -74,10 +74,12 @@ function createConfigParserMock(winVersion, phoneVersion) {
 
 describe('run method', function() {
     var findAvailableVersionOriginal,
+        findAllAvailableVersionsOriginal,
         configParserOriginal;
 
     beforeEach(function () {
         findAvailableVersionOriginal = build.__get__('MSBuildTools.findAvailableVersion');
+        findAllAvailableVersionsOriginal = build.__get__('MSBuildTools.findAllAvailableVersions');
         configParserOriginal = build.__get__('ConfigParser');
 
         var originalBuildMethod = build.run;
@@ -101,6 +103,7 @@ describe('run method', function() {
 
     afterEach(function() {
         build.__set__('MSBuildTools.findAvailableVersion', findAvailableVersionOriginal);
+        build.__set__('MSBuildTools.findAllAvailableVersions', findAllAvailableVersionsOriginal);
         build.__set__('ConfigParser', configParserOriginal);
     });
 
@@ -336,7 +339,7 @@ describe('run method', function() {
     it('spec.13 should be able to override target via --appx parameter', function(done) {
         var buildSpy = jasmine.createSpy().andCallFake(function(solutionFile, buildType, buildArch) {
                 // check that we build Windows 10 and not Windows 8.1
-                expect(solutionFile.toLowerCase().indexOf('cordovaapp.windows10.jsproj') >=0).toBe(true);
+                expect(solutionFile.toLowerCase()).toMatch('cordovaapp.windows10.jsproj');
             });
 
         createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
@@ -352,6 +355,7 @@ describe('run method', function() {
 
     it('spec.14 should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
         var customMSBuildPath = '/some/path';
+        var msBuildBinPath = path.join(customMSBuildPath, 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
         process.env.VSINSTALLDIR = customMSBuildPath;
 
@@ -368,9 +372,26 @@ describe('run method', function() {
         .fail(fail)
         .finally(function() {
             expect(fail).not.toHaveBeenCalled();
-            expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(customMSBuildPath);
+            expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
             delete process.env.VSINSTALLDIR;
             done();
         });
     });
+
+    it('spec.15 should choose latest version if there are multiple versions available with minor version difference', function(done) {
+        var fail = jasmine.createSpy('fail');
+        var buildTools14 = {version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
+        var buildTools15 = {version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
+        var buildTools151 = {version: '15.1', buildProject: jasmine.createSpy('buildTools151'), path: testPath };
+
+        createFindAllAvailableVersionsMock([buildTools14, buildTools15, buildTools151]);
+        // explicitly specify Windows 10 as target
+        build.run({argv: ['--appx=uap']})
+        .fail(fail)
+        .finally(function() {
+            expect(fail).not.toHaveBeenCalled();
+            expect(buildTools151.buildProject).toHaveBeenCalled();
+            done();
+        });
+    });
 });

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/70adcc6f/template/cordova/lib/MSBuildTools.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index 1296f32..7cc6794 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -84,7 +84,7 @@ module.exports.findAvailableVersion = function () {
     });
 };
 
-module.exports.findAllAvailableVersions = function () {
+function findAllAvailableVersionsFallBack() {
     var versions = ['15.0', '14.0', '12.0', '4.0'];
     events.emit('verbose', 'Searching for available MSBuild versions...');
 
@@ -93,6 +93,21 @@ module.exports.findAllAvailableVersions = function () {
             return !!item;
         });
     });
+}
+
+module.exports.findAllAvailableVersions = function () {
+    // CB-11548 use VSINSTALLDIR environment if defined to find MSBuild. If VSINSTALLDIR
+    // is not specified or doesn't contain the MSBuild path we are looking for - fall back
+    // to default discovery mechanism.
+    if (process.env.VSINSTALLDIR) {
+        var msBuildPath = path.join(process.env.VSINSTALLDIR, 'MSBuild/15.0/Bin');
+        return module.exports.getMSBuildToolsAt(msBuildPath)
+        .then(function (msBuildTools) {
+            return [msBuildTools];
+        }).catch(findAllAvailableVersionsFallBack);
+    }
+
+    return findAllAvailableVersionsFallBack();
 };
 
 /**
@@ -101,7 +116,7 @@ module.exports.findAllAvailableVersions = function () {
  * @param {String}  location  FS location where to search for MSBuild
  * @returns  Promise<MSBuildTools>  The MSBuildTools instance at specified location
  */
-function getMSBuildToolsAt(location) {
+module.exports.getMSBuildToolsAt = function (location) {
     var msbuildExe = path.resolve(location, 'msbuild');
 
     // TODO: can we account on these params availability and printed version format?
@@ -111,9 +126,7 @@ function getMSBuildToolsAt(location) {
         var version = output.match(/^(\d+\.\d+)/)[1];
         return new MSBuildTools(version, location);
     });
-}
-
-module.exports.getMSBuildToolsAt = getMSBuildToolsAt;
+};
 
 function checkMSBuildVersion(version) {
     return spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\' + version, '/v', 'MSBuildToolsPath'])

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/70adcc6f/template/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index 84dedd8..6c173a6 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -24,6 +24,7 @@ var shell = require('shelljs');
 var utils = require('./utils');
 var prepare = require('./prepare');
 var package = require('./package');
+var Version = require('./Version');
 var MSBuildTools = require('./MSBuildTools');
 var AppxManifest = require('./AppxManifest');
 var ConfigParser = require('./ConfigParser');
@@ -57,23 +58,7 @@ module.exports.run = function run (buildOptions) {
 
     var buildConfig = parseAndValidateArgs(buildOptions);
 
-    return Q().then(function () {
-        // CB-something use VSINSTALLDIR environment if defined to find MSBuild
-        // If VSINSTALLDIR is not specified use default discovery mechanism
-        if (!process.env.VSINSTALLDIR) {
-            return MSBuildTools.findAllAvailableVersions();
-        }
-
-        events.emit('log', 'Found VSINSTALLDIR environment variable. Attempting to build project using that version of MSBuild');
-
-        return MSBuildTools.getMSBuildToolsAt(process.env.VSINSTALLDIR)
-        .then(function (tools) { return [tools]; })
-        .catch(function (err) {
-            // If we failed to find msbuild at VSINSTALLDIR
-            // location we fall back to default discovery
-            return MSBuildTools.findAllAvailableVersions();
-        });
-    })
+    return MSBuildTools.findAllAvailableVersions()
     .then(function(msbuildTools) {
         // Apply build related configs
         prepare.updateBuildConfig(buildConfig);
@@ -284,7 +269,7 @@ function updateManifestWithPublisher(allMsBuildVersions, config) {
     if (!config.publisherId) return;
 
     var selectedBuildTargets = getBuildTargets(config);
-    var msbuild = getMsBuildForTargets(selectedBuildTargets, config, allMsBuildVersions);
+    var msbuild = getLatestMSBuild(allMsBuildVersions);
     var myBuildTargets = filterSupportedTargets(selectedBuildTargets, msbuild);
     var manifestFiles = myBuildTargets.map(function(proj) {
         return projFilesToManifests[proj];
@@ -299,7 +284,7 @@ function updateManifestWithPublisher(allMsBuildVersions, config) {
 function buildTargets(allMsBuildVersions, config) {
     // filter targets to make sure they are supported on this development machine
     var selectedBuildTargets = getBuildTargets(config);
-    var msbuild = getMsBuildForTargets(selectedBuildTargets, config, allMsBuildVersions);
+    var msbuild = getLatestMSBuild(allMsBuildVersions);
     if (!msbuild) {
         return Q.reject(new CordovaError('No valid MSBuild was detected for the selected target.'));
     }
@@ -490,14 +475,27 @@ function getBuildTargets(buildConfig) {
     return targets;
 }
 
-function getMsBuildForTargets(selectedTargets, buildConfig, allMsBuildVersions) {
+function getLatestMSBuild(allMsBuildVersions) {
     var availableVersions = allMsBuildVersions
-    .reduce(function(obj, msbuildVersion) {
-        obj[msbuildVersion.version] = msbuildVersion;
-        return obj;
-    }, {});
+    .filter(function (buildTools) {
+        // Sanitize input - filter out tools w/ invalid versions
+        return Version.tryParse(buildTools.version);
+    })
+    .sort(function (a, b) {
+        // Sort tools list - use parsed Version objects for that
+        // to respect both major and minor versions segments
+        var parsedA = Version.fromString(a.version);
+        var parsedB = Version.fromString(b.version);
+
+        if (parsedA.gt(parsedB)) return -1;
+        if (parsedA.eq(parsedB)) return 0;
+        return 1;
+    });
 
-    return availableVersions['15.0'] || availableVersions['14.0'] || availableVersions['12.0'];
+    if (availableVersions.length > 0) {
+        // After sorting the first item will be the highest version available
+        return availableVersions[0];
+    }
 }
 
 // TODO: Fix this so that it outlines supported versions based on version criteria:
@@ -524,10 +522,15 @@ function filterSupportedTargets (targets, msbuild) {
     var targetFilters = {
         '12.0': msBuild12TargetsFilter,
         '14.0': msBuild14TargetsFilter,
-        '15.0': msBuild15TargetsFilter
+        '15.x': msBuild15TargetsFilter,
+        get: function (version) {
+            // Apart from exact match also try to get filter for version range
+            // so we can find for example targets for version '15.1'
+            return this[version] || this[version.replace(/\.\d+$/, '.x')];
+        }
     };
 
-    var filter = targetFilters[msbuild.version];
+    var filter = targetFilters.get(msbuild.version);
     if (!filter) {
         events.emit('warn', 'MSBuild v' + msbuild.version + ' is not supported, aborting.');
         return [];


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


[6/7] cordova-windows git commit: CB-11621 Set VERSION to 4.4.2 (via coho)

Posted by an...@apache.org.
CB-11621 Set VERSION to 4.4.2 (via coho)


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

Branch: refs/heads/4.4.x
Commit: 4f3c14b782a92565a656d13fa73916a7f218e337
Parents: f5140e4
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Mon Jul 25 12:13:49 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Jul 25 13:15:31 2016 +0300

----------------------------------------------------------------------
 VERSION                  | 2 +-
 package.json             | 2 +-
 template/cordova/version | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/4f3c14b7/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index cca25a9..1d068c6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.4.1
+4.4.2

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/4f3c14b7/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 01a7bc2..6dbfe70 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova-windows",
-  "version": "4.4.1",
+  "version": "4.4.2",
   "description": "cordova-windows release",
   "bin": "bin/create",
   "main": "template/cordova/Api.js",

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/4f3c14b7/template/cordova/version
----------------------------------------------------------------------
diff --git a/template/cordova/version b/template/cordova/version
index c7d3481..987b536 100644
--- a/template/cordova/version
+++ b/template/cordova/version
@@ -20,7 +20,7 @@
 */
 
 // Coho updates this line:
-var VERSION = "4.4.1";
+var VERSION = "4.4.2";
 
 module.exports.version = VERSION;
 


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