iOS PostProcessBuild using python

I’m using the mod_pbxproj.py script for executing post process commands when building for iOS. I use it to add external dependencies and frameworks from the folder that’s usually on my desktop. How can I do that using the cloud build? My project won’t compile in xCode without having this external files included.

This is my OnPostProcessBuild editor script:

string sdkPath = "/Users/admin/Desktop/SDK/";

        Process pythonProcess = new Process();
        pythonProcess.StartInfo.FileName = "python";
        pythonProcess.StartInfo.Arguments = string.Format("Assets/Editor/post_process.py \"{0}\" \"{1}\"", pathToBuildProject, sdkPath);

        UnityEngine.Debug.Log(pythonProcess.StartInfo.Arguments);

        pythonProcess.StartInfo.UseShellExecute = false;
        pythonProcess.StartInfo.RedirectStandardOutput = false;
        pythonProcess.Start();
        pythonProcess.WaitForExit();

You can add the sdk you are trying to include in a folder that lives at the root of your repo, like:

  • project-root

  • Assets/

  • ProjectSettings/

  • SDK/

After that you would just use the relative path when running your post process. Another alternative to this post process python script is to use the Xcode Manipulation API (bundled with Unity since 5.x) to modify the xcode project appropriately.

1 Like