diff --git a/tools/commands-cordova.js b/tools/commands-cordova.js index 0eb0c0eaa5..1a7bfdae64 100644 --- a/tools/commands-cordova.js +++ b/tools/commands-cordova.js @@ -79,6 +79,13 @@ cordova.buildTargets = function (localPath, targets, options) { verboseLog('Running build for platforms:', platforms); checkRequestedPlatforms(platforms); + platforms = _.filter(platforms, function (platform) { + if (! _.contains(availablePlatforms, platform)) { + Console.warn(platform + ': skipping platform not available on your system'); + return false; + } + return true; + }); _.each(platforms, function (platform) { requirePlatformReady(platform); diff --git a/tools/commands.js b/tools/commands.js index a4efcafe14..404c03a782 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -733,6 +733,8 @@ var buildCommand = function (options) { appName: appName })); } catch (err) { + if (err instanceof main.ExitWithCode) + throw err; Console.printError(err, "Error while building for mobile platforms"); return 1; } @@ -814,6 +816,7 @@ var buildCommand = function (options) { var platformPath = path.join(outputPath, platformName); if (platformName === 'ios') { + if (process.platform !== 'darwin') return; files.cp_r(buildPath, path.join(platformPath, 'project')); fs.writeFileSync( path.join(platformPath, 'README'),