Example #1
0
        public override void UpdateProps()
        {
            SetPropertyString("fileRef", fileRef);

            PBXElementDict settings = null;

            if (m_Properties.Contains("settings"))
            {
                settings = m_Properties["settings"].AsDict();
            }

            if (compileFlags != null && compileFlags != "")
            {
                if (settings == null)
                {
                    settings = m_Properties.CreateDict("settings");
                }
                settings.SetString("COMPILER_FLAGS", compileFlags);
            }
            else
            {
                if (settings != null)
                {
                    settings.Remove("COMPILER_FLAGS");
                }
            }

            settings = UpdatePropsAttribute(settings, weak, "Weak");
            settings = UpdatePropsAttribute(settings, codeSignOnCopy, "CodeSignOnCopy");
            settings = UpdatePropsAttribute(settings, removeHeadersOnCopy, "RemoveHeadersOnCopy");

            if (assetTags.Count > 0)
            {
                if (settings == null)
                {
                    settings = m_Properties.CreateDict("settings");
                }
                var tagsArray = settings.CreateArray("ASSET_TAGS");
                foreach (string tag in assetTags)
                {
                    tagsArray.AddString(tag);
                }
            }
            else
            {
                if (settings != null)
                {
                    settings.Remove("ASSET_TAGS");
                }
            }

            if (settings != null && settings.values.Count == 0)
            {
                m_Properties.Remove("settings");
            }
        }
Example #2
0
 protected void SetPropertyList(string name, List <string> value)
 {
     if (value == null)
     {
         m_Properties.Remove(name);
     }
     else
     {
         var array = m_Properties.CreateArray(name);
         foreach (string val in value)
         {
             array.AddString(val);
         }
     }
 }
Example #3
0
        PBXElementDict UpdatePropsAttribute(PBXElementDict settings, bool value, string attributeName)
        {
            PBXElementArray attrs = null;

            if (value)
            {
                if (settings == null)
                {
                    settings = m_Properties.CreateDict("settings");
                }
            }
            if (settings != null && settings.Contains("ATTRIBUTES"))
            {
                attrs = settings["ATTRIBUTES"].AsArray();
            }

            if (value)
            {
                if (attrs == null)
                {
                    attrs = settings.CreateArray("ATTRIBUTES");
                }

                bool exists = attrs.values.Any(attr =>
                {
                    return(attr is PBXElementString && attr.AsString() == attributeName);
                });

                if (!exists)
                {
                    attrs.AddString(attributeName);
                }
            }
            else
            {
                if (attrs != null)
                {
                    attrs.values.RemoveAll(el => (el is PBXElementString && el.AsString() == attributeName));
                    if (attrs.values.Count == 0)
                    {
                        settings.Remove("ATTRIBUTES");
                    }
                }
            }
            return(settings);
        }