var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvRunHelp=exports.taskRnvRun=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _common=require("../core/common");
var _platformManager=require("../core/platformManager");
var _logger=require("../core/systemManager/logger");
var _constants=require("../core/constants");







var _sdkXcode=require("../sdk-xcode");
var _sdkAndroid=require("../sdk-android");
var _engineManager=require("../core/engineManager");
var _commonEngine=require("./commonEngine");

var taskRnvRun=function taskRnvRun(c,parentTask,originTask){var platform,port,target,hosted,bundleAssets;return _regenerator.default.async(function taskRnvRun$(_context){while(1){switch(_context.prev=_context.next){case 0:
platform=c.platform;
port=c.runtime.port;
target=c.runtime.target;
hosted=c.program.hosted;
(0,_logger.logTask)('taskRnvRun',"parent:"+parentTask+" port:"+port+" target:"+target+" hosted:"+hosted);_context.next=7;return _regenerator.default.awrap(

(0,_engineManager.executeOrSkipTask)(c,_constants.TASK_CONFIGURE,_constants.TASK_RUN,originTask));case 7:

bundleAssets=(0,_common.getConfigProp)(c,c.platform,'bundleAssets',false);_context.t0=

platform;_context.next=_context.t0===
_constants.IOS?11:_context.t0===
_constants.TVOS?11:_context.t0===









_constants.ANDROID?19:_context.t0===
_constants.ANDROID_TV?19:_context.t0===
_constants.ANDROID_WEAR?19:30;break;case 11:if(c.program.only){_context.next=18;break;}_context.next=14;return _regenerator.default.awrap((0,_commonEngine.startBundlerIfRequired)(c,_constants.TASK_RUN,originTask));case 14:_context.next=16;return _regenerator.default.awrap((0,_sdkXcode.runXcodeProject)(c));case 16:if(!bundleAssets){(0,_logger.logSummary)('BUNDLER STARTED');}return _context.abrupt("return",(0,_commonEngine.waitForBundlerIfRequired)(c));case 18:return _context.abrupt("return",(0,_sdkXcode.runXcodeProject)(c));case 19:if(
c.program.only){_context.next=29;break;}_context.next=22;return _regenerator.default.awrap(
(0,_commonEngine.startBundlerIfRequired)(c,_constants.TASK_RUN,originTask));case 22:if(!(
bundleAssets||platform===_constants.ANDROID_WEAR)){_context.next=25;break;}_context.next=25;return _regenerator.default.awrap(
(0,_sdkAndroid.packageAndroid)(c));case 25:_context.next=27;return _regenerator.default.awrap(

(0,_sdkAndroid.runAndroid)(c,target));case 27:
if(!bundleAssets){
(0,_logger.logSummary)('BUNDLER STARTED');
}return _context.abrupt("return",
(0,_commonEngine.waitForBundlerIfRequired)(c));case 29:return _context.abrupt("return",

(0,_sdkAndroid.runAndroid)(c,target));case 30:return _context.abrupt("return",

(0,_platformManager.logErrorPlatform)(c));case 31:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvRun=taskRnvRun;



var taskRnvRunHelp=function taskRnvRunHelp(){return _regenerator.default.async(function taskRnvRunHelp$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:
(0,_logger.logRaw)("\nMore info at: https://renative.org/docs/api-cli\n");case 1:case"end":return _context2.stop();}}},null,null,null,Promise);};exports.taskRnvRunHelp=taskRnvRunHelp;




var Task={
description:'Run your app on target device or emulator',
fn:taskRnvRun,
fnHelp:taskRnvRunHelp,
task:'run',
dependencies:{
before:_constants.TASK_CONFIGURE},

params:_constants.PARAMS.withBase(_constants.PARAMS.withConfigure(_constants.PARAMS.withRun())),
platforms:[
_constants.IOS,
_constants.TVOS,
_constants.ANDROID,
_constants.ANDROID_TV,
_constants.ANDROID_WEAR]};var _default=



Task;exports.default=_default;
//# sourceMappingURL=task.rnv.run.js.map