Search Unity

UCB not installing PODS

Discussion in 'Unity Build Automation' started by jfmitchell, Apr 27, 2020.

  1. jfmitchell

    jfmitchell

    Joined:
    Jul 18, 2017
    Posts:
    2
    Hello,

    We have fully functional build with XCode but we cannot make it work with UCB.

    This is the problem we are facing:

    + Installing cocoapods dependencies:
    11716: ! Podfile.lock and Pods/ directory exists, skipping cocoapods install
    11717: + Building with Xcode 11.3.1

    Without PODS installed, the build will eventually fail.

    Any ideas on why the UCB sees "Podfile.lock"? We don't have the same issue when building locally. No "Podfile.lock" file being generated.

    Thanks!
     
  2. luizb_unity

    luizb_unity

    Joined:
    Nov 11, 2019
    Posts:
    9
    Hey @jfmitchell I think I had something similar a long time ago.
    The command I run nowadays is:
    pod install --repo-update

    This should force the repo to update and avoid caching issues.
     
    sysper likes this.
  3. sysper

    sysper

    Joined:
    Oct 11, 2014
    Posts:
    33
    Hi @luizb_unity How can I run or add the following command in Unity Cloud Build?
     
  4. luizb_unity

    luizb_unity

    Joined:
    Nov 11, 2019
    Posts:
    9
    Sorry about the very delay answer.
    Actually I learned that Unity Cloud Build will execute cocoapods automatically.
    So in the end I just rely on their call instead of mine.

    I guess the real question is, how are you making your build work locally?
    In my setup, I execute some code that will write the pod file from scratch right after unity builds the XCode project.
    When the pod file is written, I execute "pod install --repo-update":

    Code (CSharp):
    1. RunProcess(GetPodPath(), "install --repo-update", projectPath);
    Code (CSharp):
    1. private static void RunProcess(string filePath, string command, string workingDirectory)
    2.         {
    3.             Process process = new Process();
    4.             ProcessStartInfo startInfo = process.StartInfo;
    5.  
    6.             startInfo.FileName = filePath;
    7.             startInfo.Arguments = command;
    8.  
    9.             startInfo.RedirectStandardError = true;
    10.             startInfo.RedirectStandardOutput = true;
    11.             startInfo.CreateNoWindow = true;
    12.             startInfo.UseShellExecute = false;
    13.             startInfo.WorkingDirectory = workingDirectory;
    14.  
    15.             if (startInfo.EnvironmentVariables.ContainsKey("LANG"))
    16.             {
    17.                 startInfo.EnvironmentVariables["LANG"] = "en_US.UTF-8";
    18.             }
    19.             else
    20.             {
    21.                 startInfo.EnvironmentVariables.Add("LANG", "en_US.UTF-8");
    22.             }
    23.  
    24.             process.StartInfo = startInfo;
    25.             process.Start();
    26.  
    27.             process.WaitForExit();
    28.  
    29.             string output = process.StandardOutput.ReadToEnd();
    30.             string error = process.StandardError.ReadToEnd();
    31.             var exitCode = process.ExitCode;
    32.  
    33.             process.Close();
    34.         }
    And in my case, we only use Macs, so:
    Code (CSharp):
    1. public static string GetPodPath()
    2.         {
    3.             string localPath = "/usr/local/bin/pod";
    4.             if (File.Exists(localPath))
    5.             {
    6.                 return localPath;
    7.             }
    8.  
    9.             const string PATH = "/usr/bin/pod";
    10.             if (File.Exists(PATH))
    11.             {
    12.                 return PATH;
    13.             }
    14.  
    15.             return string.Empty;
    16.         }