Ejemplo n.º 1
0
        DubProjectConfiguration DeserializeFromPackageJson(JSONObject j)
        {
            var c = new DubProjectConfiguration { Name = "<Undefined>" };

            if (j.Properties.ContainsKey ("name"))
                c.Name = ExpectJsonStringValue(j.Properties ["name"], "name");

            foreach (var kv in j.Properties) {
                TryDeserializeBuildSetting (c.BuildSettings, kv.Key, kv.Value);
            }

            return c;
        }
Ejemplo n.º 2
0
        DubProjectConfiguration DeserializeFromPackageJson(JSONObject j)
        {
            var c = new DubProjectConfiguration {
                Name = "<Undefined>"
            };

            if (j.Properties.ContainsKey("name"))
            {
                c.Name = ExpectJsonStringValue(j.Properties ["name"], "name");
            }

            foreach (var kv in j.Properties)
            {
                TryDeserializeBuildSetting(c.BuildSettings, kv.Key, kv.Value);
            }

            return(c);
        }
Ejemplo n.º 3
0
 protected void IntroduceConfiguration(DubProject prj, DubProjectConfiguration projectConfiguration)
 {
     prj.Configurations.Add (projectConfiguration);
 }
Ejemplo n.º 4
0
        void InterpretGlobalProperty(SDLDeclaration decl, DubProject target)
        {
            switch (decl.Name.ToLower())
            {
                case "displayname":
                    target.Name = ExtractFirstAttribute(decl);
                    break;
                case "name":
                    target.packageName = ExtractFirstAttribute(decl);
                    break;
                case "description":
                    target.Description = ExtractFirstAttribute(decl);
                    break;
                case "homepage":
                    target.Homepage = ExtractFirstAttribute(decl);
                    break;
                case "authors":
                    target.Authors.Clear();
                    target.Authors.AddRange(ExtractUnnamedAttributes(decl));
                    break;
                case "copyright":
                    target.Copyright = ExtractFirstAttribute(decl);
                    break;
                case "subpackage":
                    if (decl is SDLObject)
                        base.Load(target, target.ParentSolution, decl, target.FileName);
                    else
                        DubFileManager.Instance.LoadProject(GetDubFilePath(target, ExtractFirstAttribute(decl)), target.ParentSolution, null, DubFileManager.LoadFlags.None, target);
                    break;
                case "configuration":
                    var o = decl as SDLObject;
                    if (o != null)
                    {
                        var c = new DubProjectConfiguration { Name = ExtractFirstAttribute(o) };
                        if (string.IsNullOrEmpty(c.Name))
                            c.Name = "<Undefined>";

                        foreach (var childDecl in o.Children)
                        {
                            InterpretBuildSetting(childDecl, c.BuildSettings);
                        }

                        IntroduceConfiguration(target, c);
                    }
                    break;
                case "buildtype":
                    var name = ExtractFirstAttribute(decl);
                    if (!string.IsNullOrEmpty(name))
                    {
                        target.buildTypes.Add(name);
                    }
                    // Ignore remaining contents as they're not needed by mono-d
                    break;
                default:
                    InterpretBuildSetting(decl, target.CommonBuildSettings);
                    break;
            }
        }
Ejemplo n.º 5
0
		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 (!TryDeserializeBuildSetting(c.BuildSettings, j))
								j.Skip();
							break;
					}
				}
			}

			return c;
		}
Ejemplo n.º 6
0
        void InterpretGlobalProperty(SDLDeclaration decl, DubProject target)
        {
            switch (decl.Name.ToLower())
            {
            case "displayname":
                target.Name = ExtractFirstAttribute(decl);
                break;

            case "name":
                target.packageName = ExtractFirstAttribute(decl);
                break;

            case "description":
                target.Description = ExtractFirstAttribute(decl);
                break;

            case "homepage":
                target.Homepage = ExtractFirstAttribute(decl);
                break;

            case "authors":
                target.Authors.Clear();
                target.Authors.AddRange(ExtractUnnamedAttributes(decl));
                break;

            case "copyright":
                target.Copyright = ExtractFirstAttribute(decl);
                break;

            case "subpackage":
                if (decl is SDLObject)
                {
                    base.Load(target, target.ParentSolution, decl, target.FileName);
                }
                else
                {
                    DubFileManager.Instance.LoadProject(GetDubFilePath(target, ExtractFirstAttribute(decl)), target.ParentSolution, null, DubFileManager.LoadFlags.None, target);
                }
                break;

            case "configuration":
                var o = decl as SDLObject;
                if (o != null)
                {
                    var c = new DubProjectConfiguration {
                        Name = ExtractFirstAttribute(o)
                    };
                    if (string.IsNullOrEmpty(c.Name))
                    {
                        c.Name = "<Undefined>";
                    }

                    foreach (var childDecl in o.Children)
                    {
                        InterpretBuildSetting(childDecl, c.BuildSettings);
                    }

                    IntroduceConfiguration(target, c);
                }
                break;

            case "buildtype":
                var name = ExtractFirstAttribute(decl);
                if (!string.IsNullOrEmpty(name))
                {
                    target.buildTypes.Add(name);
                }
                // Ignore remaining contents as they're not needed by mono-d
                break;

            default:
                InterpretBuildSetting(decl, target.CommonBuildSettings);
                break;
            }
        }
Ejemplo n.º 7
0
 protected void IntroduceConfiguration(DubProject prj, DubProjectConfiguration projectConfiguration)
 {
     prj.Configurations.Add(projectConfiguration);
 }