[ https://issues.apache.org/jira/browse/CB-9283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14617815#comment-14617815 ]
ASF GitHub Bot commented on CB-9283: ------------------------------------ Github user nikhilkh commented on a diff in the pull request: https://github.com/apache/cordova-windows/pull/96#discussion_r34109798 --- Diff: template/cordova/lib/package.js --- @@ -130,58 +145,47 @@ module.exports.findDevice = function (target) { }; // returns array of available devices names -module.exports.listDevices = function () { - return utils.getAppDeployUtils().then(function(appDeployUtils) { - return exec('"' + appDeployUtils + '" /enumeratedevices').then(function(output) { - return Q.resolve(output.split('\n').map(function(line) { - var match = /\s*(\d)+\s+(.*)/.exec(line); - return match && match[2]; - }).filter(function (line) { - return line; - })); +module.exports.listDevices = function (deploymentTool) { + + return deploymentTool.enumerateDevices().then(function(deviceList) { + return deviceList.map(function(device) { + return device.toString(); }); - }); -}; - -function installAppToPhone(appDeployUtils, package, target, update) { - // /installlaunch option sometimes fails with 'Error: The parameter is incorrect.' - // so we use separate steps to /install or /update and then /launch - var cmd = update ? '/update' : '/install'; - console.log('Installing application...'); - return spawn(appDeployUtils, [cmd, package.appx, '/targetdevice:' + target]); -} + }, function(e) { + console.warn('Failed to enumerate devices'); + console.warn(e); -function runAppOnPhone(appDeployUtils, target) { - return Q().then(function() { - return module.exports.getAppId(path.join(__dirname, '..', '..')); - }).then(function(appId) { - console.log('Running application... '); - return spawn(appDeployUtils, ['/launch', appId, '/targetdevice:' + target]); + throw e; }); -} +}; + function uninstallAppFromPhone(appDeployUtils, package, target) { console.log('Attempting to remove previously installed application...'); - return spawn(appDeployUtils, ['/uninstall', package.phoneId, '/targetdevice:' + target]); + return appDeployUtils.uninstallAppPackage(package.phoneId, target); } // deploys specified phone package to device/emulator and launches it -module.exports.deployToPhone = function (package, deployTarget, targetWindows10) { - var getTarget = deployTarget == 'device' ? Q('de') : - deployTarget == 'emulator' ? Q('xd') : module.exports.findDevice(deployTarget); - - return getTarget.then(function(target) { - return utils.getAppDeployUtils(targetWindows10).then(function(appDeployUtils) { +module.exports.deployToPhone = function (package, deployTarget, targetWindows10, deploymentTool) { + var deployment; + if (deploymentTool) { + deployment = Q(deploymentTool); + } + else { + deployment = utils.getAppDeployUtils(targetWindows10); + } - return uninstallAppFromPhone(appDeployUtils, package, target).then( + return deployment.then(function(deploymentTool) { + return module.exports.findDevice(deploymentTool, deployTarget).then(function(target) { + return uninstallAppFromPhone(deploymentTool, package, target).then( function() {}, function() {}).then(function() { - return installAppToPhone(appDeployUtils, package, target, false); - }).then(function() { - return runAppOnPhone(appDeployUtils, target); - }, function(error) { + // shouldUpdate = false because we've already uninstalled + return deploymentTool.installAppPackage(package.appx, target, true, false); + }).then(function() { }, function(error) { + console.dir(error); --- End diff -- should the console.dir be removed? > Windows 10: Migrate to new deployment infrastructure > ---------------------------------------------------- > > Key: CB-9283 > URL: https://issues.apache.org/jira/browse/CB-9283 > Project: Apache Cordova > Issue Type: Improvement > Components: Windows > Reporter: Rob Paveza > Assignee: Rob Paveza > > The Windows 10 SDK includes a new deployment tool, WinAppDeployCmd, which > supercedes Windows Phone 8.1's AppDeployCmd. Its command line interface is > incompatible. This task is to migrate to WinAppDeployCmd. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org