Inheritance: MonoDevelop.Projects.ProjectConfiguration
        public static DubProjectConfiguration DeserializeFromPackageJson(JsonReader j)
        {
            var c = new DubProjectConfiguration { Name = "<Undefined>" };

            var srz = new JsonSerializer();
            while (j.Read() && j.TokenType != JsonToken.EndObject)
            {
                if (j.TokenType == JsonToken.PropertyName)
                {
                    switch (j.Value as string)
                    {
                        case "name":
                            c.Name = c.Id = j.ReadAsString();
                            break;
                        case "platforms":
                            j.Read();
                            c.Platform = string.Join("|",srz.Deserialize<string[]>(j));
                            break;
                        default:
                            if (!c.BuildSettings.TryDeserializeBuildSetting(j))
                                j.Skip();
                            break;
                    }
                }
            }

            return c;
        }
        public static DubProjectConfiguration DeserializeFromPackageJson(JsonReader j)
        {
            var c = new DubProjectConfiguration {
                Name = "<Undefined>"
            };

            var srz = new JsonSerializer();

            while (j.Read() && j.TokenType != JsonToken.EndObject)
            {
                if (j.TokenType == JsonToken.PropertyName)
                {
                    switch (j.Value as string)
                    {
                    case "name":
                        c.Name = c.Id = j.ReadAsString();
                        break;

                    case "platforms":
                        j.Read();
                        c.Platform = string.Join("|", srz.Deserialize <string[]>(j));
                        break;

                    default:
                        if (!c.BuildSettings.TryDeserializeBuildSetting(j))
                        {
                            j.Skip();
                        }
                        break;
                    }
                }
            }

            return(c);
        }
Beispiel #3
0
        internal void AddProjectAndSolutionConfiguration(DubProjectConfiguration cfg)
        {        //TODO: Is an other config with the same id already existing?
            if (ParentSolution != null)
            {
                var slnCfg = new SolutionConfiguration(cfg.Name, cfg.Platform);
                ParentSolution.Configurations.Add(slnCfg);
                slnCfg.AddItem(this).Build = true;
            }
            Configurations.Add(cfg);

            if (Configurations.Count == 1)
            {
                DefaultConfigurationId = cfg.Id;
            }
        }
Beispiel #4
0
        public void AddProjectAndSolutionConfiguration(DubProjectConfiguration cfg)
        {
            if (ParentSolution != null)
            {
                var slnCfg = new SolutionConfiguration(cfg.Name, cfg.Platform);
                ParentSolution.Configurations.Add(slnCfg);
                slnCfg.AddItem(this).Build = true;
            }
            Configurations.Add(cfg);

            if (Configurations.Count == 1)
            {
                DefaultConfigurationId = cfg.Id;
            }
        }
Beispiel #5
0
        public bool TryPopulateProperty(string propName, JsonReader j, IProgressMonitor monitor)
        {
            switch (propName.ToLowerInvariant())
            {
            case "displayname":
                displayName = j.ReadAsString();
                break;

            case "name":
                packageName = j.ReadAsString();
                break;

            case "description":
                Description = j.ReadAsString();
                break;

            case "copyright":
                Copyright = j.ReadAsString();
                break;

            case "homepage":
                Homepage = j.ReadAsString();
                break;

            case "authors":
                if (!j.Read() || j.TokenType != JsonToken.StartArray)
                {
                    throw new JsonReaderException("Expected [ when parsing Authors");
                }
                authors.Clear();
                while (j.Read() && j.TokenType != JsonToken.EndArray)
                {
                    if (j.TokenType == JsonToken.String)
                    {
                        authors.Add(j.Value as string);
                    }
                }
                break;

            case "dependencies":
                if (!j.Read() || j.TokenType != JsonToken.StartObject)
                {
                    throw new JsonReaderException("Expected { when parsing Authors");
                }

                DubReferences.DeserializeDubPrjDependencies(j, monitor);
                break;

            case "configurations":
                if (!j.Read() || j.TokenType != JsonToken.StartArray)
                {
                    throw new JsonReaderException("Expected [ when parsing Configurations");
                }

                if (ParentSolution != null && ParentSolution.Configurations.Count == 1 && ParentSolution.Configurations[0].Id == DubProjectConfiguration.DefaultConfigId)
                {
                    ParentSolution.Configurations.Clear();
                }
                if (Configurations.Count == 1 && Configurations[0].Id == DubProjectConfiguration.DefaultConfigId)
                {
                    Configurations.Clear();
                }

                while (j.Read() && j.TokenType != JsonToken.EndArray)
                {
                    AddProjectAndSolutionConfiguration(DubProjectConfiguration.DeserializeFromPackageJson(j));
                }
                break;

            case "subpackages":
                if (!j.Read() || j.TokenType != JsonToken.StartArray)
                {
                    throw new JsonReaderException("Expected [ when parsing subpackages");
                }

                while (j.Read() && j.TokenType != JsonToken.EndArray)
                {
                    DubSubPackage.ReadAndAdd(this, j, monitor);
                }
                break;

            default:
                return(CommonBuildSettings.TryDeserializeBuildSetting(j));
            }

            return(true);
        }
Beispiel #6
0
        public bool TryPopulateProperty(string propName, JsonReader j)
        {
            switch (propName)
            {
            case "name":
                Name = j.ReadAsString();
                break;

            case "description":
                Description = j.ReadAsString();
                break;

            case "copyright":
                Copyright = j.ReadAsString();
                break;

            case "homepage":
                Homepage = j.ReadAsString();
                break;

            case "authors":
                if (!j.Read() || j.TokenType != JsonToken.StartArray)
                {
                    throw new JsonReaderException("Expected [ when parsing Authors");
                }
                authors.Clear();
                while (j.Read() && j.TokenType != JsonToken.EndArray)
                {
                    if (j.TokenType == JsonToken.String)
                    {
                        authors.Add(j.Value as string);
                    }
                }
                break;

            case "dependencies":
                if (!j.Read() || j.TokenType != JsonToken.StartObject)
                {
                    throw new JsonReaderException("Expected { when parsing Authors");
                }
                dependencies.Clear();
                while (j.Read() && j.TokenType != JsonToken.EndObject)
                {
                    if (j.TokenType == JsonToken.PropertyName)
                    {
                        DeserializeDubPrjDependency(j);
                    }
                }
                break;

            case "configurations":
                if (!j.Read() || j.TokenType != JsonToken.StartArray)
                {
                    throw new JsonReaderException("Expected [ when parsing Configurations");
                }
                if (ParentSolution != null)
                {
                    ParentSolution.Configurations.Clear();
                }
                Configurations.Clear();

                while (j.Read() && j.TokenType != JsonToken.EndArray)
                {
                    AddProjectAndSolutionConfiguration(DubProjectConfiguration.DeserializeFromPackageJson(j));
                }
                break;

            default:
                return(GlobalBuildSettings.TryDeserializeBuildSetting(j));
            }

            return(true);
        }
Beispiel #7
0
		public void BuildProgramArgAppendix(StringBuilder sr, DubProject prj, DubProjectConfiguration cfg)
		{

		}
Beispiel #8
0
 public void BuildProgramArgAppendix(StringBuilder sr, DubProject prj, DubProjectConfiguration cfg)
 {
 }
Beispiel #9
0
		internal void AddProjectAndSolutionConfiguration(DubProjectConfiguration cfg)
		{//TODO: Is an other config with the same id already existing?
			if (ParentSolution != null)
			{
				var slnCfg = new SolutionConfiguration(cfg.Name, cfg.Platform);
				ParentSolution.Configurations.Add(slnCfg);
				slnCfg.AddItem(this).Build = true;
			}
			Configurations.Add(cfg);

			if (Configurations.Count == 1)
				DefaultConfigurationId = cfg.Id;
		}
Beispiel #10
0
        public void AddProjectAndSolutionConfiguration(DubProjectConfiguration cfg)
        {
            if (ParentSolution != null)
            {
                var slnCfg = new SolutionConfiguration(cfg.Name, cfg.Platform);
                ParentSolution.Configurations.Add(slnCfg);
                slnCfg.AddItem(this).Build = true;
            }
            Configurations.Add(cfg);

            if (Configurations.Count == 1)
                DefaultConfigurationId = cfg.Id;
        }