var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvProjectConfigure=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _pluginManager=require("../core/pluginManager");
var _logger=require("../core/systemManager/logger");
var _configParser=require("../core/configManager/configParser");

var _templateManager=require("../core/templateManager");
var _fileutils=require("../core/systemManager/fileutils");
var _crypto=require("../core/systemManager/crypto");
var _migrator=require("../core/projectManager/migrator");
var _constants=require("../core/constants");
var _projectParser=require("../core/projectManager/projectParser");
var _engineManager=require("../core/engineManager");


var taskRnvProjectConfigure=function taskRnvProjectConfigure(c,parentTask,originTask){return _regenerator.default.async(function taskRnvProjectConfigure$(_context){while(1){switch(_context.prev=_context.next){case 0:
(0,_logger.logTask)('taskRnvPlatformConfigure');

if(c.paths.project.builds.dir&&!(0,_fileutils.fsExistsSync)(c.paths.project.builds.dir)){
(0,_logger.logInfo)("Creating folder "+c.paths.project.builds.dir);
(0,_fileutils.fsMkdirSync)(c.paths.project.builds.dir);
}_context.next=4;return _regenerator.default.awrap(
(0,_migrator.checkAndMigrateProject)(c));case 4:_context.next=6;return _regenerator.default.awrap(
(0,_configParser.parseRenativeConfigs)(c));case 6:_context.next=8;return _regenerator.default.awrap(
(0,_configParser.checkIsRenativeProject)(c));case 8:_context.next=10;return _regenerator.default.awrap(
(0,_projectParser.checkAndCreateProjectPackage)(c));case 10:_context.next=12;return _regenerator.default.awrap(
(0,_engineManager.executeTask)(c,_constants.TASK_WORKSPACE_CONFIGURE,_constants.TASK_PROJECT_CONFIGURE,originTask));case 12:if(!(

c.program.only&&!!parentTask)){_context.next=20;break;}_context.next=15;return _regenerator.default.awrap(
(0,_configParser.configureRuntimeDefaults)(c));case 15:_context.next=17;return _regenerator.default.awrap(
(0,_engineManager.executeTask)(c,_constants.TASK_APP_CONFIGURE,_constants.TASK_PROJECT_CONFIGURE,originTask));case 17:_context.next=19;return _regenerator.default.awrap(
(0,_configParser.generateRuntimeConfig)(c));case 19:return _context.abrupt("return",
true);case 20:_context.next=22;return _regenerator.default.awrap(


(0,_templateManager.checkIfTemplateInstalled)(c));case 22:_context.next=24;return _regenerator.default.awrap(
(0,_configParser.fixRenativeConfigsSync)(c));case 24:_context.next=26;return _regenerator.default.awrap(
(0,_engineManager.executeTask)(c,_constants.TASK_INSTALL,_constants.TASK_PROJECT_CONFIGURE,originTask));case 26:_context.next=28;return _regenerator.default.awrap(
(0,_crypto.checkCrypto)(c,parentTask,originTask));case 28:_context.next=30;return _regenerator.default.awrap(
(0,_configParser.configureRuntimeDefaults)(c));case 30:if(!(

originTask!==_constants.TASK_TEMPLATE_APPLY)){_context.next=55;break;}_context.next=33;return _regenerator.default.awrap(
(0,_templateManager.applyTemplate)(c));case 33:_context.next=35;return _regenerator.default.awrap(
(0,_configParser.configureRuntimeDefaults)(c));case 35:_context.next=37;return _regenerator.default.awrap(
(0,_pluginManager.configurePlugins)(c));case 37:_context.next=39;return _regenerator.default.awrap(
(0,_engineManager.executeTask)(c,_constants.TASK_INSTALL,_constants.TASK_PROJECT_CONFIGURE,originTask));case 39:_context.next=41;return _regenerator.default.awrap(
(0,_engineManager.executeTask)(c,_constants.TASK_APP_CONFIGURE,_constants.TASK_PROJECT_CONFIGURE,originTask));case 41:_context.next=43;return _regenerator.default.awrap(
(0,_configParser.configureRuntimeDefaults)(c));case 43:if(!
c.program.resetHard){_context.next=47;break;}
(0,_logger.logInfo)("You passed "+
(0,_logger.chalk)().white('-R')+" argument. \""+(0,_logger.chalk)().white('./platformAssets')+"\" will be cleaned up first");_context.next=47;return _regenerator.default.awrap(


(0,_projectParser.cleanPlaformAssets)(c));case 47:_context.next=49;return _regenerator.default.awrap(

(0,_projectParser.copyRuntimeAssets)(c));case 49:_context.next=51;return _regenerator.default.awrap(
(0,_templateManager.configureEntryPoints)(c));case 51:_context.next=53;return _regenerator.default.awrap(
(0,_configParser.generateRuntimeConfig)(c));case 53:_context.next=55;return _regenerator.default.awrap(
(0,_pluginManager.overrideTemplatePlugins)(c));case 55:return _context.abrupt("return",


true);case 56:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvProjectConfigure=taskRnvProjectConfigure;var _default=


{
description:'Configure current project',
fn:taskRnvProjectConfigure,
task:_constants.TASK_PROJECT_CONFIGURE,
params:_constants.PARAMS.withBase(),
platforms:[]};exports.default=_default;
//# sourceMappingURL=task.rnv.project.configure.js.map