You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ro...@apache.org on 2015/08/14 23:33:33 UTC
cordova-windows git commit: CB-9482: Upon further investigation of CI
failures,
we saw that AppDeployCmd also failed to install an app when: - The emulator
had been off previously - It had been started with the AppDeployCmd
/uninstall command - The ne
Repository: cordova-windows
Updated Branches:
refs/heads/master 050910c84 -> 5aaa3f641
CB-9482: Upon further investigation of CI failures, we saw that
AppDeployCmd also failed to install an app when:
- The emulator had been off previously
- It had been started with the AppDeployCmd /uninstall command
- The next command was to then install an app
This change detects the condition (only for emulator targets) and retries
once. This appears to correct the issue.
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/5aaa3f64
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/5aaa3f64
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/5aaa3f64
Branch: refs/heads/master
Commit: 5aaa3f6417f3c7b3f2e3a3ac4331c3e9dc180dfb
Parents: 050910c
Author: Rob Paveza <Ro...@microsoft.com>
Authored: Wed Aug 12 14:30:50 2015 -0700
Committer: Rob Paveza <Ro...@microsoft.com>
Committed: Wed Aug 12 16:15:26 2015 -0700
----------------------------------------------------------------------
template/cordova/lib/deployment.js | 21 +++++++++++++++++++--
template/cordova/lib/package.js | 1 +
2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5aaa3f64/template/cordova/lib/deployment.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/deployment.js b/template/cordova/lib/deployment.js
index 29db338..162b8cc 100644
--- a/template/cordova/lib/deployment.js
+++ b/template/cordova/lib/deployment.js
@@ -24,6 +24,8 @@ var Q = require('q'),
/* jshint ignore:end */
proc = require('child_process');
+var E_INVALIDARG = 2147942487;
+
// neither 'exec' nor 'spawn' was sufficient because we need to pass arguments via spawn
// but also need to be able to capture stdout / stderr
function run(cmd, args, opt_cwd) {
@@ -35,7 +37,7 @@ function run(cmd, args, opt_cwd) {
child.stderr.on('data', function(s) { stderr += s; });
child.on('exit', function(code) {
if (code) {
- d.reject(stderr);
+ d.reject({ message: stderr, code: code, toString: function() { return stderr; }});
} else {
d.resolve(stdout);
}
@@ -194,13 +196,28 @@ AppDeployCmdTool.prototype.enumerateDevices = function() {
});
};
+// Note: To account for CB-9482, we pass an extra parameter when retrying the call. Be forwarned to check for that
+// if additional parameters are added in the future.
AppDeployCmdTool.prototype.installAppPackage = function(pathToAppxPackage, targetDevice, shouldLaunch, shouldUpdate, pin) {
var command = shouldUpdate ? '/update' : '/install';
if (shouldLaunch) {
command += 'launch';
}
- return run(this.path, [command, pathToAppxPackage, '/targetdevice:' + targetDevice.__shorthand]);
+ var that = this;
+ var result = run(this.path, [command, pathToAppxPackage, '/targetdevice:' + targetDevice.__shorthand]);
+ if (targetDevice.type === 'emulator') {
+ result = result.then(null, function(e) {
+ // CB-9482: AppDeployCmd also reports E_INVALIDARG during this process. If so, try to repeat.
+ if (e.code === E_INVALIDARG) {
+ return run(that.path, [command, pathToAppxPackage, '/targetdevice:' + targetDevice.__shorthand]);
+ }
+
+ throw e;
+ });
+ }
+
+ return result;
};
AppDeployCmdTool.prototype.uninstallAppPackage = function(packageInfo, targetDevice) {
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5aaa3f64/template/cordova/lib/package.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/package.js b/template/cordova/lib/package.js
index 8aaad69..80a1d80 100644
--- a/template/cordova/lib/package.js
+++ b/template/cordova/lib/package.js
@@ -189,6 +189,7 @@ module.exports.deployToPhone = function (package, deployTarget, targetWindows10,
return uninstallAppFromPhone(deploymentTool, package, target).then(
function() {}, function() {}).then(function() {
// shouldUpdate = false because we've already uninstalled
+ console.log('Deploying app package...');
return deploymentTool.installAppPackage(package.appx, target, /*shouldLaunch*/ true, /*shouldUpdate*/ false);
}).then(function() { }, function(error) {
if (error.indexOf('Error code 2148734208 for command') === 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org