public void AddShellScript(string targetGuid, string script) { PBXNativeTargetData target = nativeTargets[targetGuid]; // Do nothing if script already added var scripts = shellScripts.GetEntries(); foreach (var existingScript in scripts) { // check if script already there if (existingScript.Value.Script == script && target.phases.Contains(existingScript.Value.guid)) { Debug.Log("Script was already added: " + script); return; } } var shellScriptData = PBXShellScriptBuildPhaseData.Create(script); shellScripts.AddEntry(shellScriptData); // add "Run Script" section to "Build phases" target.phases.AddGUID(shellScriptData.guid); }
public static PBXShellScriptBuildPhaseData Create(string shellScript) { var res = new PBXShellScriptBuildPhaseData(); res.guid = PBXGUID.Generate(); res.SetPropertyString("isa", "PBXShellScriptBuildPhase"); res.SetPropertyString("buildActionMask", "2147483647"); res.files = new List <string>(); res.SetPropertyString("runOnlyForDeploymentPostprocessing", "0"); res.SetPropertyString("shellPath", "/bin/sh"); res.SetPropertyString("shellScript", shellScript); return(res); }