var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.parseXcscheme=void 0;var _path=_interopRequireDefault(require("path"));
var _fs=_interopRequireDefault(require("fs"));
var _chalk=_interopRequireDefault(require("chalk"));
var _common=require("../../common");


















var _projectParser=require("../../projectTools/projectParser");
var _pluginTools=require("../../pluginTools");
var _apple=require("../apple");

var parseXcscheme=function parseXcscheme(c,platform){return new Promise(function(resolve,reject){
(0,_common.logTask)("parseXcscheme:"+platform);

var allowProvisioningUpdates=(0,_common.getConfigProp)(c,platform,'allowProvisioningUpdates',true);
var provisioningStyle=(0,_common.getConfigProp)(c,platform,'provisioningStyle','Automatic');
var runScheme=(0,_common.getConfigProp)(c,platform,'runScheme');
var poisxSpawn=runScheme==='Release'&&!allowProvisioningUpdates&&provisioningStyle==='Manual';
var appFolder=(0,_common.getAppFolder)(c,platform);
var appFolderName=(0,_apple.getAppFolderName)(c,platform);
var appTemplateFolder=(0,_common.getAppTemplateFolder)(c,platform);

var debuggerId=poisxSpawn?'':'Xcode.DebuggerFoundation.Debugger.LLDB';
var launcherId=poisxSpawn?'Xcode.IDEFoundation.Launcher.PosixSpawn':'Xcode.DebuggerFoundation.Launcher.LLDB';
var schemePath=appFolderName+".xcodeproj/xcshareddata/xcschemes/"+appFolderName+".xcscheme";
(0,_common.writeCleanFile)(_path.default.join(appTemplateFolder,schemePath),_path.default.join(appFolder,schemePath),[
{pattern:'{{PLUGIN_DEBUGGER_ID}}',override:debuggerId},
{pattern:'{{PLUGIN_LAUNCHER_ID}}',override:launcherId}]);

resolve();
});};exports.parseXcscheme=parseXcscheme;