var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvCryptoInstallProfiles=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _path=_interopRequireDefault(require("path"));
var _logger=require("../core/systemManager/logger");





var _fileutils=require("../core/systemManager/fileutils");





var _engineManager=require("../core/engineManager");
var _constants=require("../core/constants");


var taskRnvCryptoInstallProfiles=function taskRnvCryptoInstallProfiles(c,parentTask,originTask){var ppFolder,list,mobileprovisionArr;return _regenerator.default.async(function taskRnvCryptoInstallProfiles$(_context){while(1){switch(_context.prev=_context.next){case 0:
(0,_logger.logTask)('taskRnvCryptoInstallProfiles');_context.next=3;return _regenerator.default.awrap(

(0,_engineManager.executeTask)(c,_constants.TASK_PROJECT_CONFIGURE,_constants.TASK_CRYPTO_INSTALL_PROFILES,originTask));case 3:if(!(

c.platform!=='ios')){_context.next=6;break;}
(0,_logger.logError)("taskRnvCryptoInstallProfiles: platform "+
c.platform+" not supported");return _context.abrupt("return",

true);case 6:


ppFolder=_path.default.join(
c.paths.home.dir,
'Library/MobileDevice/Provisioning Profiles');


if(!(0,_fileutils.fsExistsSync)(ppFolder)){
(0,_logger.logWarning)("folder "+ppFolder+" does not exist!");
(0,_fileutils.mkdirSync)(ppFolder);
}

list=(0,_fileutils.getFileListSync)(c.paths.workspace.project.dir);
mobileprovisionArr=list.filter(function(v){return v.endsWith('.mobileprovision');});

try{
mobileprovisionArr.forEach(function(v){
(0,_logger.logDebug)("taskRnvCryptoInstallProfiles: Installing: "+v);
(0,_fileutils.copyFileSync)(v,ppFolder);
});
}catch(e){
(0,_logger.logError)(e);
}return _context.abrupt("return",

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


{
description:'',
fn:taskRnvCryptoInstallProfiles,
task:_constants.TASK_CRYPTO_INSTALL_PROFILES,
params:_constants.PARAMS.withBase(),
platforms:[],
skipPlatforms:true};exports.default=_default;
//# sourceMappingURL=task.rnv.crypto.installProfiles.js.map