Ejemplo n.º 1
0
 private static string GetNameOfStage(BuildStage stage)
 {
     switch(stage)
     {
         case BuildStage.WaitingToStart: return "Starting engines";
         case BuildStage.BuildProject: return "Build .app";
         case BuildStage.PackageIPA: return "Package .ipa";
         case BuildStage.UploadIPA: return "Upload .ipa";
         default: return "Just a moment";
     }
 }
Ejemplo n.º 2
0
 private void SetStage(BuildStage stage)
 {
     currentStage = stage;
     Repaint();
 }
Ejemplo n.º 3
0
    private void SetBuildTime(BuildStage stage, float time)
    {
        switch(stage)
        {
        case BuildStage.BuildProject:
            preferences.userPrefs.lastBuildAppTime = time;
            preferences.userPrefs.Save();
            break;

        case BuildStage.PackageIPA:
            preferences.userPrefs.lastPackageIpaTime = time;
            preferences.userPrefs.Save();
            break;

        case BuildStage.Upload:
            preferences.userPrefs.lastUploadTime = time;
            preferences.userPrefs.Save();
            break;
        }
    }
Ejemplo n.º 4
0
    private string GetStageErrorSuggestion(BuildStage stage, string errorString)
    {
        switch(stage)
        {
        case BuildStage.BuildProject:
            if(errorString.Contains("Reason for failure: -[__NSCFDictionary setObject:forKey:]: attempt to insert nil key"))
                return "1. The selected Developer Identity may be invalid, or not compatible with this project.\n" +
                       "2. If you selected the default 'iPhone Distribution' identity, XCode may not have a default for this. Try using a specific certificate.";
            else
                return "";

        case BuildStage.PackageIPA:
            return "";

        case BuildStage.Upload:
            if(errorString.Contains("curl: (6) Could not resolve host:"))
                return "1. Cannot connect to testfight. It may be down, or there may be network issues. Check that you can access testflightapp.com";
            if(errorString.Contains("Invalid Profile: developer build entitlements must have get-task-allow set to true."))
                return  "1. Attempting to upload Ad-hoc build using a 'Developer' identity certificate instead of the 'Distribution' identity it's built against";
            else
                return "";

        default:
            return "";
        }
    }
Ejemplo n.º 5
0
 private string GetStageErrorMessages(BuildStage stage)
 {
     switch(stage)
     {
     case BuildStage.BuildProject: return 	"An error occured trying to build the .app file, please ensure you can manually build an iPhone project at the build location: "+preferences.teamPrefs.buildPath;
     case BuildStage.PackageIPA: return 		"An error occured while packaging the .ipa file, please retry this build... if that does not work build your iPhone project manually and ensure you are able to \"Build & Archive\" within XCode without errors.";
     case BuildStage.Upload: return 			"An error occured uploading to testflight. Please check that you can access testflightapp.com";
     default: return "";
     }
 }
Ejemplo n.º 6
0
 private float GetLastBuildTime(BuildStage stage)
 {
     switch(stage)
     {
     case BuildStage.WaitingToStart: return 2;
     case BuildStage.BuildProject: 	return preferences.userPrefs.lastBuildAppTime;
     case BuildStage.PackageIPA: 	return preferences.userPrefs.lastPackageIpaTime;
     case BuildStage.Upload: 		return preferences.userPrefs.lastUploadTime;
     }
     return -1;
 }
Ejemplo n.º 7
0
 private void DrawStageLabel(BuildStage targetStage)
 {
     string text = GetNameOfStage(targetStage);
     if(targetStage==currentStage)
         GUILayout.Label(text, (targetStage != currentStage) ? "Label":"Foldout");
     else
         GUILayout.Toggle((int)targetStage<(int)currentStage, text);
 }
Ejemplo n.º 8
0
    private bool CheckProcessErrors()
    {
        string errorString = "";
        int errorCode = 0;

        if(currentProcess == null || !currentProcess.HasExited)
            return false;

        if(currentProcess.ExitCode != 0)
        {
            errorCode = currentProcess.ExitCode;

            if(currentStage == BuildStage.BuildProject)
            {
                StringReader logFile = new System.IO.StringReader(buildAppStageLog);
                while(true)
                {
                    string result = logFile.ReadLine();
                    if(result == null)
                        break;

                    Match m = Regex.Match(result, @"\[BEROR\](.*)");
                    if(m.Success)
                    {
                        errorString += m.Groups[1].Captures[0].Value+"\n";
                        continue;
                    }

                    // 3 line compiple error
                    // we just give the first line of this as formatting makes them unreadable
                    m = Regex.Match(result, @":[0-9]+:[0-9]+: (error|warning):.*");
                    if(m.Success)
                    {
                        errorString += result+"\n\n";
                        continue;
                    }

                    // linker errors
                    m = Regex.Match(result, @"Undefined symbols for architecture");
                    if(m.Success)
                    {
                        do
                        {
                            errorString += result+"\n";
                            result = logFile.ReadLine();
                            m = Regex.Match(result, @"ld: symbol\(s\) not found for architecture");
                        } while(result != null && !m.Success);
                        errorString += "\n";
                    }
                }
            }
            else
                errorString = currentProcess.StandardError.ReadToEnd();
        }
        else if(currentStage == BuildStage.Upload)
        {
            while(!currentProcess.StandardOutput.EndOfStream)
            {
                string str = currentProcess.StandardOutput.ReadLine();

                if(currentProcess.StandardOutput.EndOfStream)
                {
                    if(str == "200")
                        break;
                    else
                        errorCode = int.Parse(str);
                }
                else
                {
                    errorString += str;

                    string[] tokens = str.Split(new char[]{' ', ',', '\n'}, System.StringSplitOptions.RemoveEmptyEntries);
                    if(tokens.Length == 2 && tokens[0] == "\"config_url\":")
                    {
                        resultURL = tokens[1].Trim(new char[]{'"'}).Replace("complete", "report");
                    }
                }
            }
        }

        if(errorCode == 0)
            return false;
        else if(currentStage == BuildStage.Upload)
        {
            if(uploadAttempsRemaining <= 0)
            {
                string uploadSuggestion = GetStageErrorSuggestion(currentStage, errorString);
                int result = EditorUtility.DisplayDialogComplex("Trouble Uploading",
                    "There was a problem uploading to testlight.\n" +
                    "This happens sometimes when their servers are busy, retrying the upload usually works after a few attempts." +
                    "\n\nError Message:\n"+GetStageErrorMessages(currentStage)+
                    (uploadSuggestion.Length > 0 ? ("\n\nKnown Causes for this error:\n"+uploadSuggestion):"")+
                    "\n\nAdditional Output:\n"+errorString,
                    "Retry",
                    "Cancel",
                    "Retry 10 times");

                Debug.LogError("AutoPilot: Stage "+currentStage+" failed:"+GetStageErrorMessages(currentStage)+"\nAdditional Output:"+errorString);

                if(result == 0)
                    uploadAttempsRemaining = 1;
                else if (result==2)
                    uploadAttempsRemaining = 10;
                else
                    return true;
            }

            if(uploadAttempsRemaining > 0)
            {
                currentStage = BuildStage.PackageIPA; // nextstage will be called, setting us to upload again
                return false;
            }
        }

        string suggestion = GetStageErrorSuggestion(currentStage, errorString);

        int option = EditorUtility.DisplayDialogComplex("AutoPilot: Build FAILED", "Stage "+currentStage+
                                    "\n\nError Message:\n"+GetStageErrorMessages(currentStage)+
                                    (suggestion.Length > 0 ? ("\n\nKnown Causes for this error:\n"+suggestion):"")+
                                    "\n\nIf you think this error is a bug with AutoPilot:\nPlease contact the developer ([email protected]) and provide the full error information from the console window."+
                                    "\n\nAdditional Output:\n"+errorString, "Ok", "Check on forums...", "Contact developer...");

           switch (option)
        {
                // Ok
                case 0:
                    break;

            // Check forums
                case 1:
                    Application.OpenURL("http://forum.unity3d.com/threads/100591-AutoPilot-for-Testflight-1.0-(deploy-iOS-builds-via-cloud!)-Now-on-the-asset-store");
                    break;

                // Email developer
                case 2:
                    string bodyString = "1. Describe the issue in detail\n" +
                                        "\n" +
                                        "\n" +
                                        "2. List steps that caused this issue\n" +
                                        "\n" +
                                        "\n" +
                                        "3. How often does this happen?\n" +
                                        "\n" +
                                        "\n" +
                                        "Build Stage: " + currentStage + "\n" +
                                        "\n" +
                                        "Build Error:\n" + errorString;

                    bodyString = Google.GData.Client.HttpUtility.UrlEncode(bodyString);
                    Debug.Log(bodyString);
                    Application.OpenURL("mailto:[email protected]?subject=Autopilot%20Issue&body="+bodyString);
                    break;
        }

        Debug.LogError("AutoPilot: Stage "+currentStage+" failed:"+GetStageErrorMessages(currentStage)+"\nAdditional Output:"+errorString);
        return true;
    }