Example #1
0
        public override void UpdateVars()
        {
            projectReferences = new List <ProjectReference>();
            if (m_Properties.Contains("projectReferences"))
            {
                var el = m_Properties["projectReferences"].AsArray();
                foreach (var value in el.values)
                {
                    PBXElementDict dict = value.AsDict();
                    if (dict.Contains("ProductGroup") && dict.Contains("ProjectRef"))
                    {
                        string group      = dict["ProductGroup"].AsString();
                        string projectRef = dict["ProjectRef"].AsString();
                        projectReferences.Add(ProjectReference.Create(group, projectRef));
                    }
                }
            }
            targets         = GetPropertyList("targets");
            knownRegions    = GetPropertyList("knownRegions");
            buildConfigList = GetPropertyString("buildConfigurationList");

            // update knownAssetTags
            knownAssetTags = new List <string>();
            if (m_Properties.Contains("attributes"))
            {
                var el = m_Properties["attributes"].AsDict();
                if (el.Contains("knownAssetTags"))
                {
                    var tags = el["knownAssetTags"].AsArray();
                    foreach (var tag in tags.values)
                    {
                        knownAssetTags.Add(tag.AsString());
                    }
                }

                capabilities = new List <PBXCapabilityType.TargetCapabilityPair>();
                teamIDs      = new Dictionary <string, string>();

                if (el.Contains("TargetAttributes"))
                {
                    var targetAttr = el["TargetAttributes"].AsDict();
                    foreach (var attr in targetAttr.values)
                    {
                        if (attr.Key == "DevelopmentTeam")
                        {
                            teamIDs.Add(attr.Key, attr.Value.AsString());
                        }

                        if (attr.Key == "SystemCapabilities")
                        {
                            var caps = el["SystemCapabilities"].AsDict();
                            foreach (var cap in caps.values)
                            {
                                capabilities.Add(new PBXCapabilityType.TargetCapabilityPair(attr.Key, PBXCapabilityType.StringToPBXCapabilityType(cap.Value.AsString())));
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact,
                                     PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("{");

            if (el.Contains("isa"))
            {
                WriteDictKeyValue(sb, "isa", el["isa"], indent + 1, compact, checker, comments);
            }
            var keys = new List <string>(el.values.Keys);

            keys.Sort(StringComparer.Ordinal);
            foreach (var key in keys)
            {
                if (key != "isa")
                {
                    WriteDictKeyValue(sb, key, el[key], indent + 1, compact, checker, comments);
                }
            }
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            sb.Append("}");
        }
Example #3
0
        public override void UpdateVars()
        {
            this.fileRef      = this.GetPropertyString("fileRef");
            this.compileFlags = (string)null;
            this.weak         = false;
            this.assetTags    = new List <string>();
            if (!this.m_Properties.Contains("settings"))
            {
                return;
            }
            PBXElementDict pbxElementDict = this.m_Properties["settings"].AsDict();

            if (pbxElementDict.Contains("COMPILER_FLAGS"))
            {
                this.compileFlags = pbxElementDict["COMPILER_FLAGS"].AsString();
            }
            if (pbxElementDict.Contains("ATTRIBUTES"))
            {
                foreach (PBXElement pbxElement in pbxElementDict["ATTRIBUTES"].AsArray().values)
                {
                    if (pbxElement is PBXElementString && pbxElement.AsString() == "Weak")
                    {
                        this.weak = true;
                    }
                    if (pbxElement is PBXElementString && pbxElement.AsString() == "CodeSignOnCopy")
                    {
                        this.codeSignOnCopy = true;
                    }
                    if (pbxElement is PBXElementString && pbxElement.AsString() == "RemoveHeadersOnCopy")
                    {
                        this.removeHeadersOnCopy = true;
                    }
                }
            }
            if (pbxElementDict.Contains("ASSET_TAGS"))
            {
                foreach (PBXElement pbxElement in pbxElementDict["ASSET_TAGS"].AsArray().values)
                {
                    this.assetTags.Add(pbxElement.AsString());
                }
            }
        }
Example #4
0
        private PBXElementDict UpdatePropsAttribute(
            PBXElementDict settings,
            bool value,
            string attributeName)
        {
            PBXElementArray pbxElementArray = (PBXElementArray)null;

            if (value && settings == null)
            {
                settings = this.m_Properties.CreateDict("settings");
            }
            if (settings != null && settings.Contains("ATTRIBUTES"))
            {
                pbxElementArray = settings["ATTRIBUTES"].AsArray();
            }
            if (value)
            {
                if (pbxElementArray == null)
                {
                    pbxElementArray = settings.CreateArray("ATTRIBUTES");
                }
                if (!pbxElementArray.values.Any <PBXElement>((Func <PBXElement, bool>)(attr => attr is PBXElementString && attr.AsString() == attributeName)))
                {
                    pbxElementArray.AddString(attributeName);
                }
            }
            else if (pbxElementArray != null)
            {
                pbxElementArray.values.RemoveAll((Predicate <PBXElement>)(el => el is PBXElementString && el.AsString() == attributeName));
                if (pbxElementArray.values.Count == 0)
                {
                    settings.Remove("ATTRIBUTES");
                }
            }
            return(settings);
        }