You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2014/06/25 22:21:59 UTC
git commit: CB-6976 fixes deploy error on WP8.1 emulator
Repository: cordova-windows
Updated Branches:
refs/heads/master bfe1f0e2a -> 78c28f5ca
CB-6976 fixes deploy error on WP8.1 emulator
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/78c28f5c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/78c28f5c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/78c28f5c
Branch: refs/heads/master
Commit: 78c28f5cad5f346ffa605ddfc69a78fae6717885
Parents: bfe1f0e
Author: sgrebnov <v-...@microsoft.com>
Authored: Thu Jun 26 00:21:59 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Thu Jun 26 00:21:59 2014 +0400
----------------------------------------------------------------------
windows/template/cordova/lib/deploy.js | 38 ++++++++++++++++++++++-------
1 file changed, 29 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/78c28f5c/windows/template/cordova/lib/deploy.js
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/deploy.js b/windows/template/cordova/lib/deploy.js
index 92188c7..d80730d 100644
--- a/windows/template/cordova/lib/deploy.js
+++ b/windows/template/cordova/lib/deploy.js
@@ -175,6 +175,32 @@ function localMachine(path, projecttype, buildtype, buildarchs) {
exec_verbose(command);
}
+function readAppIdWindowsPhone() {
+ var manifestPath = ROOT + '\\package.phone.appxmanifest';
+
+ if (!fso.FileExists(manifestPath)) {
+ Log('Error: ' + manifestPath + ' does not exist', true);
+ WScript.Quit(2);
+ }
+ var manifestFile = fso.OpenTextFile(manifestPath, 1);
+ var manifest = manifestFile.ReadAll();
+ manifestFile.Close();
+ return /PhoneProductId="(.*?)"/i.exec(manifest)[1];
+}
+
+function deployWindowsPhone(appxPath, target) {
+ // /installlaunch option sometimes fails with 'Error: The parameter is incorrect.'
+ // so we use separate steps to /install and then /launch
+ // install
+ var cmd = '"' + APP_DEPLOY_UTILS + '" /install "' + appxPath + '" /targetdevice:' + target;
+ Log(cmd);
+ exec_verbose(cmd);
+ // launch
+ cmd = '"' + APP_DEPLOY_UTILS + '" /launch "' + readAppIdWindowsPhone() + '" /targetdevice:' + target;
+ Log(cmd);
+ exec_verbose(cmd);
+}
+
// launches project on device
function device(path, projecttype, buildtype, buildarchs) {
if (projecttype != "phone") {
@@ -184,9 +210,7 @@ function device(path, projecttype, buildtype, buildarchs) {
Log('Deploying to device ...');
var appxFolder = getPackage(path, projecttype, buildtype, buildarchs);
var appxPath = appxFolder + '\\' + fso.GetFolder(appxFolder).Name.split('_Test').join('') + '.appx';
- var cmd = '"' + APP_DEPLOY_UTILS + '" /installlaunch "' + appxPath + '" /targetdevice:de';
- Log(cmd);
- exec_verbose(cmd);
+ deployWindowsPhone(appxPath, 'de');
}
}
@@ -199,9 +223,7 @@ function emulator(path, projecttype, buildtype, buildarchs) {
Log('Deploying to emulator ...');
var appxFolder = getPackage(path, projecttype, buildtype, buildarchs);
var appxPath = appxFolder + '\\' + fso.GetFolder(appxFolder).Name.split('_Test').join('') + '.appx';
- var cmd = '"' + APP_DEPLOY_UTILS + '" /installlaunch "' + appxPath + '" /targetdevice:xd';
- Log(cmd);
- exec_verbose(cmd);
+ deployWindowsPhone(appxPath, 'xd');
}
}
@@ -242,9 +264,7 @@ function target(path, projecttype, buildtype, buildarchs, buildtarget) {
var appxFolder = getPackage(path, projecttype, buildtype, buildarchs);
var appxPath = appxFolder + '\\' + fso.GetFolder(appxFolder).Name.split('_Test').join('') + '.appx';
Log('Deploying to target with id: ' + buildtarget);
- cmd = '"' + APP_DEPLOY_UTILS + '" /installlaunch "' + appxPath + '" /targetdevice:' + deviceMatch[1];
- Log(cmd);
- exec_verbose(cmd);
+ deployWindowsPhone(appxPath, deviceMatch[1]);
return;
}
}