~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.MacDev/XcodeIntegration/PBXProject.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// 
2
 
// PBXProject.cs
3
 
//  
4
 
// Authors:
5
 
//       Geoff Norton <gnorton@novell.com>
6
 
//       Jeffrey Stedfast <jeff@xamarin.com>
7
 
// 
8
 
// Copyright (c) 2011 Novell, Inc.
9
 
// Copyright (c) 2011 Xamarin Inc.
10
 
// 
11
 
// Permission is hereby granted, free of charge, to any person obtaining a copy
12
 
// of this software and associated documentation files (the "Software"), to deal
13
 
// in the Software without restriction, including without limitation the rights
14
 
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
 
// copies of the Software, and to permit persons to whom the Software is
16
 
// furnished to do so, subject to the following conditions:
17
 
// 
18
 
// The above copyright notice and this permission notice shall be included in
19
 
// all copies or substantial portions of the Software.
20
 
// 
21
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
 
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
 
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
 
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
 
// THE SOFTWARE.
28
 
 
29
 
using System;
30
 
using System.Text;
31
 
using System.Collections.Generic;
32
 
 
33
 
namespace MonoDevelop.MacDev.XcodeIntegration
34
 
{
35
 
        class PBXProject : XcodeObject
36
 
        {
37
 
                XCConfigurationList configuration;
38
 
                PBXGroup productGroup, mainGroup;
39
 
                List<PBXNativeTarget> targets;
40
 
                string name;
41
 
 
42
 
                public PBXProject (string name, XCConfigurationList configuration, PBXGroup mainGroup, PBXGroup productGroup)
43
 
                {
44
 
                        this.KnownRegions = new HashSet<string> ();
45
 
                        this.targets = new List<PBXNativeTarget> ();
46
 
                        this.configuration = configuration;
47
 
                        this.productGroup = productGroup;
48
 
                        this.mainGroup = mainGroup;
49
 
                        this.name = name;
50
 
 
51
 
                        configuration.Target = this;
52
 
                        
53
 
                        KnownRegions.Add ("en");
54
 
                }
55
 
 
56
 
                public void AddNativeTarget (PBXNativeTarget target)
57
 
                {
58
 
                        targets.Add (target);
59
 
                }
60
 
                
61
 
                public HashSet<string> KnownRegions {
62
 
                        get; private set;
63
 
                }
64
 
 
65
 
                public override string Name {
66
 
                        get { return name; }
67
 
                }
68
 
 
69
 
                public override XcodeType Type {
70
 
                        get {
71
 
                                return XcodeType.PBXProject;
72
 
                        }
73
 
                }
74
 
 
75
 
                public override string ToString ()
76
 
                {
77
 
                        var sb = new StringBuilder ();
78
 
                        sb.AppendFormat ("{0} /* Project object */ = {{\n", Token);
79
 
                        sb.AppendFormat ("\t\t\tisa = {0};\n", Type);
80
 
                        sb.AppendFormat ("\t\t\tattributes = {{ }};\n");
81
 
                        sb.AppendFormat ("\t\t\tbuildConfigurationList = {0} /* {1} */;\n",
82
 
                                         configuration.Token, configuration.Name);
83
 
                        sb.AppendFormat ("\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n");
84
 
                        sb.AppendFormat ("\t\t\thasScannedForEncodings = 0;\n");
85
 
                        sb.AppendFormat ("\t\t\tknownRegions = (\n");
86
 
                        foreach (var lang in KnownRegions)
87
 
                                sb.AppendFormat ("\t\t\t\t{0},\n", lang);
88
 
                        sb.AppendFormat ("\t\t\t);\n");
89
 
                        sb.AppendFormat ("\t\t\tmainGroup = {0};\n", mainGroup.Token);
90
 
                        sb.AppendFormat ("\t\t\tproductRefGroup = {0} /* {1} */;\n", productGroup.Token, productGroup.Name);
91
 
                        sb.AppendFormat ("\t\t\tprojectDirPath = \"\";\n");
92
 
                        sb.AppendFormat ("\t\t\tprojectRoot = \"\";\n");
93
 
                        sb.AppendFormat ("\t\t\ttargets = (\n");
94
 
                        foreach (PBXNativeTarget target in targets) 
95
 
                                sb.AppendFormat ("\t\t\t\t{0} /* {1} */,\n", target.Token, target.Name);
96
 
                        sb.AppendFormat ("\t\t\t);\n");
97
 
                        sb.AppendFormat ("\t\t}};");
98
 
                        return sb.ToString ();
99
 
                }
100
 
        }
101
 
}