Ejemplo n.º 1
0
        public PBXCopyFilesBuildPhase AddEmbedFrameworkBuildPhase()
        {
            PBXCopyFilesBuildPhase phase = null;

            PBXNativeTarget naviTarget = GetNativeTarget("Unity-iPhone");

            if (naviTarget == null)
            {
                Debug.Log("Not found Correct NativeTarget.");
                return(phase);
            }

            //check if embed framework buildPhase exist
            foreach (var currentObject in copyBuildPhases)
            {
                object nameObj = null;
                if (currentObject.Value.data.TryGetValue("name", out nameObj))
                {
                    string name = (string)nameObj;
                    if (name == "Embed Frameworks")
                    {
                        return(currentObject.Value);
                    }
                }
            }

            int buildActionMask = this.GetBuildActionMask();

            phase = new PBXCopyFilesBuildPhase(buildActionMask);
            var buildPhases = (ArrayList)naviTarget.data ["buildPhases"];

            buildPhases.Add(phase.guid);             //add build phase
            copyBuildPhases.Add(phase);
            return(phase);
        }
Ejemplo n.º 2
0
        public PBXNativeTarget GetNativeTarget(string name)
        {
            PBXNativeTarget naviTarget = null;

            foreach (KeyValuePair <string, PBXNativeTarget> currentObject in nativeTargets)
            {
                string targetName = (string)currentObject.Value.data ["name"];
                if (targetName == name)
                {
                    naviTarget = currentObject.Value;
                    break;
                }
            }
            return(naviTarget);
        }
Ejemplo n.º 3
0
        public string ResolveName(string guid)
        {
            if (!this.objects.ContainsKey(guid))
            {
                Debug.LogWarning(this + " ResolveName could not resolve " + guid);
                return(string.Empty);                //"UNRESOLVED GUID:" + guid;
            }

            object entity = this.objects[guid];

            if (entity is PBXBuildFile)
            {
                return(ResolveName(((PBXBuildFile)entity).fileRef));
            }
            else if (entity is PBXFileReference)
            {
                PBXFileReference casted = (PBXFileReference)entity;
                return(casted.name != null ? casted.name : casted.path);
            }
            else if (entity is PBXGroup)
            {
                PBXGroup casted = (PBXGroup)entity;
                return(casted.name != null ? casted.name : casted.path);
            }
            else if (entity is PBXProject || guid == this.rootObject)
            {
                return("Project object");
            }
            else if (entity is PBXFrameworksBuildPhase)
            {
                return("Frameworks");
            }
            else if (entity is PBXResourcesBuildPhase)
            {
                return("Resources");
            }
            else if (entity is PBXShellScriptBuildPhase)
            {
                return("ShellScript");
            }
            else if (entity is PBXSourcesBuildPhase)
            {
                return("Sources");
            }
            else if (entity is PBXCopyFilesBuildPhase)
            {
                return("CopyFiles");
            }
            else if (entity is XCConfigurationList)
            {
                XCConfigurationList casted = (XCConfigurationList)entity;
                //Debug.LogWarning ("XCConfigurationList " + guid + " " + casted.ToString());

                if (casted.data.ContainsKey("defaultConfigurationName"))
                {
                    //Debug.Log ("XCConfigurationList " + (string)casted.data[ "defaultConfigurationName" ] + " " + guid);
                    return((string)casted.data["defaultConfigurationName"]);
                }

                return(null);
            }
            else if (entity is PBXNativeTarget)
            {
                PBXNativeTarget obj = (PBXNativeTarget)entity;
                //Debug.LogWarning ("PBXNativeTarget " + guid + " " + obj.ToString());

                if (obj.data.ContainsKey("name"))
                {
                    //Debug.Log ("PBXNativeTarget " + (string)obj.data[ "name" ] + " " + guid);
                    return((string)obj.data["name"]);
                }

                return(null);
            }
            else if (entity is XCBuildConfiguration)
            {
                XCBuildConfiguration obj = (XCBuildConfiguration)entity;
                //Debug.LogWarning ("XCBuildConfiguration UNRESOLVED GUID:" + guid + " " + (obj==null?"":obj.ToString()));

                if (obj.data.ContainsKey("name"))
                {
                    //Debug.Log ("XCBuildConfiguration " + (string)obj.data[ "name" ] + " " + guid + " " + (obj==null?"":obj.ToString()));
                    return((string)obj.data["name"]);
                }
            }
            else if (entity is PBXObject)
            {
                PBXObject obj = (PBXObject)entity;

                if (obj.data.ContainsKey("name"))
                {
                    Debug.Log("PBXObject " + (string)obj.data["name"] + " " + guid + " " + (obj == null?"":obj.ToString()));
                }
                return((string)obj.data["name"]);
            }

            //return "UNRESOLVED GUID:" + guid;
            Debug.LogWarning("UNRESOLVED GUID:" + guid);
            return(null);
        }