This is an automated email from the ASF dual-hosted git repository.

shazron pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/master by this push:
     new 371da48  CB-12830 - cordova emulate ios with --target throws undefined 
error (#332)
371da48 is described below

commit 371da486b33184d88bc9766ff0c3d124a9987fbf
Author: Shazron Abdullah <[email protected]>
AuthorDate: Tue Aug 29 16:16:44 2017 -0700

    CB-12830 - cordova emulate ios with --target throws undefined error (#332)
---
 bin/templates/scripts/cordova/lib/build.js | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/bin/templates/scripts/cordova/lib/build.js 
b/bin/templates/scripts/cordova/lib/build.js
index d7c2cbe..fcc10c3 100644
--- a/bin/templates/scripts/cordova/lib/build.js
+++ b/bin/templates/scripts/cordova/lib/build.js
@@ -115,17 +115,26 @@ module.exports.run = function (buildOpts) {
         }).then(function () {
             // CB-12287: Determine the device we should target when building 
for a simulator
             if (!buildOpts.device) {
-                var promise;
-                if (buildOpts.target) {
-                    // a target was given to us, find the matching Xcode 
destination name
-                    promise = 
require('./list-emulator-build-targets').targetForSimIdentifier(buildOpts.target);
-                } else {
-                    // no target provided, pick a default one (matching our 
emulator logic)
-                    promise = getDefaultSimulatorTarget();
+                var newTarget = buildOpts.target || '';
+
+                if (newTarget) {
+                    // only grab the device name, not the runtime specifier
+                    newTarget = newTarget.split(',')[0];
                 }
+                // a target was given to us, find the matching Xcode 
destination name
+                var promise = 
require('./list-emulator-build-targets').targetForSimIdentifier(newTarget);
                 return promise.then(function (theTarget) {
-                    emulatorTarget = theTarget.name;
-                    events.emit('log', 'Building for ' + emulatorTarget + ' 
Simulator');
+                    if (!theTarget) {
+                        return getDefaultSimulatorTarget().then(function 
(defaultTarget) {
+                            emulatorTarget = defaultTarget.name;
+                            events.emit('log', 'Building for ' + 
emulatorTarget + ' Simulator');
+                            return emulatorTarget;
+                        });
+                    } else {
+                        emulatorTarget = theTarget.name;
+                        events.emit('log', 'Building for ' + emulatorTarget + 
' Simulator');
+                        return emulatorTarget;
+                    }
                 });
             }
         }).then(function () {

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to