Esempio n. 1
0
        IPBXProjExpression ParseBaseExpression()
        {
            CheckForUnexpectedEndOfSource();

            if (_currentToken.Type != PBXProjTokenType.String)
            {
                throw new PBXProjParserException("Expected a string value, not " + _currentToken.Value);
            }

            string value = _currentToken.Value;
            //is it a bool
            PBXProjBoolean boolExpression = ParseBoolean(value);

            if (boolExpression != null)
            {
                ReadNextToken();
                return(boolExpression);
            }

            PBXProjString stringExpression = ParseString(value);

            if (stringExpression != null)
            {
                ReadNextToken();
                return(stringExpression);
            }

            return(null);
        }
        public void AddCustomStringBuildSetting(string settingName, string value)
        {
            if (string.IsNullOrEmpty(settingName) || string.IsNullOrEmpty(value))
            {
                return;
            }

            BuildSettings [settingName] = new PBXProjString(value.ToLiteralIfRequired());
        }
Esempio n. 3
0
        public void EnableAutomaticProvisioning(string targetKey, bool enable)
        {
            var attribs = TargetAttributesEntry(targetKey);

            //is on by default, so don't add the key. this ensures we don't add things to the project that have not been explictly asked for
            if (!attribs.ContainsKey(PROVISIONING_STYLE_KEY) && enable)
            {
                return;
            }

            attribs[PROVISIONING_STYLE_KEY] = new PBXProjString(enable ? "Automatic" : "Manual");
        }
        void AddStringListBuildSetting(StringListBuildSetting stringListSetting, string[] values, MergeMethod mergeMethod)
        {
            var           settings   = BuildSettings;
            PBXProjString stringList = null;

            //TODO check conditionals, as will have to run for each conditional variant

            //handle appending
            if (mergeMethod == MergeMethod.Append)
            {
                stringList = settings.Element <PBXProjString>(stringListSetting.BuildSettingName);
            }

            //handles null case and replace case
            if (stringList == null)
            {
                stringList = new PBXProjString();
                settings[stringListSetting.BuildSettingName] = stringList;
            }

            //break down string list into list so it can be checked
            List <string> existingValues = StringUtils.StringListToList(stringList.Value);

            // handle settings that need inherit string being added
            if (stringListSetting.AddInherited)
            {
                if (existingValues.Where(o => o.Equals(INHERITED)).Count() <= 0)
                {
                    existingValues.Insert(0, INHERITED);
                }
            }

            foreach (var v in values)
            {
                if (existingValues.Where(o => o.Equals(v)).Count() <= 0)
                {
                    existingValues.Add(v);
                }
            }

            stringList.Value = StringUtils.ListToStringList(existingValues);
        }
        public void AddEnumBuildSetting(string settingName, string value)
        {
            if (string.IsNullOrEmpty(settingName))
            {
                return;
            }

            BaseBuildSetting baseSetting = null;

            XcodeBuildSettings.Instance().BuildSetting(settingName, out baseSetting);

            //we don't know about it (custom) add as string, or it is a known enum, or it is known but not an enum
            if (baseSetting == null)
            {
                AddCustomStringBuildSetting(settingName, value);
            }
            else if (baseSetting is EnumBuildSetting)
            {
                var enumSetting = baseSetting as EnumBuildSetting;

                if (!enumSetting.IsValidValue(value))
                {
                    string values = enumSetting.EnumValues[0];

                    for (int ii = 1; ii < enumSetting.EnumValues.Length; ii++)
                    {
                        values += ", " + enumSetting.EnumValues[ii];
                    }

                    Debug.LogError("EgoXproject: " + settingName + " value " + value + " is not a valid option. It can only be one of the following: " + values);
                    return;
                }

                //TODO check for enum conditional
                BuildSettings[settingName] = new PBXProjString(value.ToLiteralIfRequired());
            }
            else
            {
                Debug.LogError("EgoXproject: " + settingName + " is not an enumerated string build setting");
            }
        }
        public void AddStringBuildSetting(string settingName, string value)
        {
            if (string.IsNullOrEmpty(settingName) || string.IsNullOrEmpty(value))
            {
                return;
            }

            BaseBuildSetting baseSetting = null;

            XcodeBuildSettings.Instance().BuildSetting(settingName, out baseSetting);

            //is custom or is a string setting
            if (baseSetting == null || baseSetting is StringBuildSetting)
            {
                string settingNameToUse = SettingNameToUse(settingName);
                BuildSettings[settingNameToUse] = new PBXProjString(value.ToLiteralIfRequired());
            }
            else
            {
                Debug.LogError("EgoXproject: " + settingName + " is not a string build setting");
            }
        }
Esempio n. 7
0
        public void SetDevelopmentTeam(string targetKey, string teamId)
        {
            var attribs = TargetAttributesEntry(targetKey);

            attribs[DEVELOPMENT_TEAM_KEY] = new PBXProjString(teamId);
        }