Bug 15572. Lookup KnownTypeCollection element types in MSSimpleNamespace
[mono.git] / mcs / class / Microsoft.Build / Microsoft.Build.Evaluation / Project.cs
1 //
2 // Project.cs
3 //
4 // Author:
5 //   Leszek Ciesielski (skolima@gmail.com)
6 //   Rolf Bjarne Kvinge (rolf@xamarin.com)
7 //
8 // (C) 2011 Leszek Ciesielski
9 // Copyright (C) 2011 Xamarin Inc. (http://www.xamarin.com)
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.Collections.Generic;
33 using System.Diagnostics;
34 using System.IO;
35 using System.Linq;
36 using System.Text;
37 using System.Xml;
38 using Microsoft.Build.Construction;
39 using Microsoft.Build.Internal;
40 using Microsoft.Build.Execution;
41 using Microsoft.Build.Framework;
42 using Microsoft.Build.Logging;
43
44 namespace Microsoft.Build.Evaluation
45 {
46         [DebuggerDisplay("{FullPath} EffectiveToolsVersion={ToolsVersion} #GlobalProperties="
47                          +"{data.globalProperties.Count} #Properties={data.Properties.Count} #ItemTypes="
48                          +"{data.ItemTypes.Count} #ItemDefinitions={data.ItemDefinitions.Count} #Items="
49                          +"{data.Items.Count} #Targets={data.Targets.Count}")]
50         public class Project
51         {
52                 public Project (XmlReader xml)
53                         : this (ProjectRootElement.Create (xml))
54                 {
55                 }
56                 public Project (XmlReader xml, IDictionary<string, string> globalProperties,
57                                 string toolsVersion)
58                         : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion)
59                 {
60                 }
61                 public Project (XmlReader xml, IDictionary<string, string> globalProperties,
62                                 string toolsVersion, ProjectCollection projectCollection)
63                         : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion, projectCollection)
64                 {
65                 }
66                 public Project (XmlReader xml, IDictionary<string, string> globalProperties,
67                                 string toolsVersion, ProjectCollection projectCollection,
68                                 ProjectLoadSettings loadSettings)
69                         : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion, projectCollection, loadSettings)
70                 {
71                 }
72
73                 public Project (ProjectRootElement xml) : this(xml, null, null)
74                 {
75                 }
76                 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
77                                 string toolsVersion)
78                         : this(xml, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
79                 {
80                 }
81                 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
82                                 string toolsVersion, ProjectCollection projectCollection)
83                         : this(xml, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
84                 {
85                 }
86
87                 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
88                                 string toolsVersion, ProjectCollection projectCollection,
89                                 ProjectLoadSettings loadSettings)
90                 {
91                         ProjectCollection = projectCollection;
92                         Xml = xml;
93                         GlobalProperties = globalProperties;
94                         ToolsVersion = toolsVersion;
95                 }
96
97                 public Project (string projectFile) : this(projectFile, null, null)
98                 {
99                 }
100
101                 public Project (string projectFile, IDictionary<string, string> globalProperties,
102                                 string toolsVersion)
103                         : this(projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection, ProjectLoadSettings.Default)
104                 {
105                 }
106
107                 public Project (string projectFile, IDictionary<string, string> globalProperties,
108                                 string toolsVersion, ProjectCollection projectCollection)
109                         : this(projectFile, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
110                 {
111                 }
112
113                 public Project (string projectFile, IDictionary<string, string> globalProperties,
114                                 string toolsVersion, ProjectCollection projectCollection,
115                                 ProjectLoadSettings loadSettings)
116                 {
117                         throw new NotImplementedException ();
118                 }
119
120                 public IDictionary<string, string> GlobalProperties { get; private set; }
121                 public ProjectCollection ProjectCollection { get; private set; }
122                 public string ToolsVersion { get; private set; }
123                 public ProjectRootElement Xml { get; private set; }
124
125                 public ICollection<ProjectItem> GetItemsIgnoringCondition (string itemType)
126                 {
127                         return new CollectionFromEnumerable<ProjectItem> (
128                                 new FilteredEnumerable<ProjectItemElement> (Xml.Items).
129                                 Where (p => p.ItemType.Equals (itemType, StringComparison.OrdinalIgnoreCase)).
130                                 Select (p => new ProjectItem(p)));
131                 }
132                 public void RemoveItems (IEnumerable<ProjectItem> items)
133                 {
134                         var removal = new List<ProjectItem> (items);
135                         foreach (var item in removal) {
136                                 var parent = item.Xml.Parent;
137                                 parent.RemoveChild (item.Xml);
138                                 if (parent.Count == 0)
139                                         parent.Parent.RemoveChild (parent);
140                         }
141                 }
142
143                 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude)
144                 {
145                         throw new NotImplementedException ();
146                 }
147
148                 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude,
149                         IEnumerable<KeyValuePair<string, string>> metadata)
150                 {
151                         throw new NotImplementedException ();
152                 }
153
154                 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude)
155                 {
156                         throw new NotImplementedException ();
157                 }
158
159                 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude,
160                         IEnumerable<KeyValuePair<string, string>> metadata)
161                 {
162                         throw new NotImplementedException ();
163                 }
164
165                 public bool Build ()
166                 {
167                         throw new NotImplementedException ();
168                 }
169
170                 public bool Build (IEnumerable<ILogger> loggers)
171                 {
172                         throw new NotImplementedException ();
173                 }
174
175                 public bool Build (string target)
176                 {
177                         throw new NotImplementedException ();
178                 }
179
180                 public bool Build (string[] targets)
181                 {
182                         throw new NotImplementedException ();
183                 }
184
185                 public bool Build (ILogger logger)
186                 {
187                         throw new NotImplementedException ();
188                 }
189
190                 public bool Build (string[] targets, IEnumerable<ILogger> loggers)
191                 {
192                         throw new NotImplementedException ();
193                 }
194
195                 public bool Build (IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
196                 {
197                         throw new NotImplementedException ();
198                 }
199
200                 public bool Build (string target, IEnumerable<ILogger> loggers)
201                 {
202                         throw new NotImplementedException ();
203                 }
204
205                 public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
206                 {
207                         throw new NotImplementedException ();
208                 }
209
210                 public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
211                 {
212                         throw new NotImplementedException ();
213                 }
214
215                 public ProjectInstance CreateProjectInstance ()
216                 {
217                         throw new NotImplementedException ();
218                 }
219
220                 public string ExpandString (string unexpandedValue)
221                 {
222                         throw new NotImplementedException ();
223                 }
224
225                 public static string GetEvaluatedItemIncludeEscaped (ProjectItem item)
226                 {
227                         throw new NotImplementedException ();
228                 }
229
230                 public static string GetEvaluatedItemIncludeEscaped (ProjectItemDefinition item)
231                 {
232                         throw new NotImplementedException ();
233                 }
234
235                 public ICollection<ProjectItem> GetItems (string itemType)
236                 {
237                         throw new NotImplementedException ();
238                 }
239
240                 public ICollection<ProjectItem> GetItemsByEvaluatedInclude (string evaluatedInclude)
241                 {
242                         throw new NotImplementedException ();
243                 }
244
245                 public IEnumerable<ProjectElement> GetLogicalProject ()
246                 {
247                         throw new NotImplementedException ();
248                 }
249
250                 public static string GetMetadataValueEscaped (ProjectMetadata metadatum)
251                 {
252                         throw new NotImplementedException ();
253                 }
254
255                 public static string GetMetadataValueEscaped (ProjectItem item, string name)
256                 {
257                         throw new NotImplementedException ();
258                 }
259
260                 public static string GetMetadataValueEscaped (ProjectItemDefinition item, string name)
261                 {
262                         throw new NotImplementedException ();
263                 }
264
265                 public string GetPropertyValue (string name)
266                 {
267                         throw new NotImplementedException ();
268                 }
269
270                 public static string GetPropertyValueEscaped (ProjectProperty property)
271                 {
272                         throw new NotImplementedException ();
273                 }
274
275                 public ProjectProperty GetProperty (string name)
276                 {
277                         throw new NotImplementedException ();
278                 }
279
280                 public void MarkDirty ()
281                 {
282                         throw new NotImplementedException ();
283                 }
284
285                 public void ReevaluateIfNecessary ()
286                 {
287                         throw new NotImplementedException ();
288                 }
289
290                 public bool RemoveGlobalProperty (string name)
291                 {
292                         throw new NotImplementedException ();
293                 }
294
295                 public bool RemoveItem (ProjectItem item)
296                 {
297                         throw new NotImplementedException ();
298                 }
299
300                 public bool RemoveProperty (ProjectProperty property)
301                 {
302                         throw new NotImplementedException ();
303                 }
304
305                 public void Save ()
306                 {
307                         throw new NotImplementedException ();
308                 }
309
310                 public void Save (TextWriter writer)
311                 {
312                         throw new NotImplementedException ();
313                 }
314
315                 public void Save (string path)
316                 {
317                         throw new NotImplementedException ();
318                 }
319
320                 public void Save (Encoding encoding)
321                 {
322                         throw new NotImplementedException ();
323                 }
324
325                 public void Save (string path, Encoding encoding)
326                 {
327                         throw new NotImplementedException ();
328                 }
329
330                 public void SaveLogicalProject (TextWriter writer)
331                 {
332                         throw new NotImplementedException ();
333                 }
334
335                 public bool SetGlobalProperty (string name, string escapedValue)
336                 {
337                         throw new NotImplementedException ();
338                 }
339
340                 public ProjectProperty SetProperty (string name, string unevaluatedValue)
341                 {
342                         throw new NotImplementedException ();
343                 }
344
345                 public ICollection<ProjectMetadata> AllEvaluatedItemDefinitionMetadata {
346                         get { throw new NotImplementedException (); }
347                 }
348
349                 public ICollection<ProjectItem> AllEvaluatedItems {
350                         get { throw new NotImplementedException (); }
351                 }
352
353                 public ICollection<ProjectProperty> AllEvaluatedProperties {
354                         get { throw new NotImplementedException (); }
355                 }
356
357                 public IDictionary<string, List<string>> ConditionedProperties {
358                         get { throw new NotImplementedException (); }
359                 }
360
361                 public string DirectoryPath {
362                         get { throw new NotImplementedException (); }
363                 }
364
365                 public bool DisableMarkDirty { get; set; }
366
367                 public int EvaluationCounter {
368                         get { throw new NotImplementedException (); }
369                 }
370
371                 public string FullPath {
372                         get { throw new NotImplementedException (); }
373                         set { throw new NotImplementedException (); }
374                 }
375
376                 public IList<ResolvedImport> Imports {
377                         get { throw new NotImplementedException (); }
378                 }
379
380                 public IList<ResolvedImport> ImportsIncludingDuplicates {
381                         get { throw new NotImplementedException (); }
382                 }
383
384                 public bool IsBuildEnabled {
385                         get { throw new NotImplementedException (); }
386                 }
387
388                 public bool IsDirty {
389                         get { throw new NotImplementedException (); }
390                 }
391
392                 public IDictionary<string, ProjectItemDefinition> ItemDefinitions {
393                         get { throw new NotImplementedException (); }
394                 }
395
396                 public ICollection<ProjectItem> Items {
397                         get { throw new NotImplementedException (); }
398                 }
399
400                 public ICollection<ProjectItem> ItemsIgnoringCondition {
401                         get { throw new NotImplementedException (); }
402                 }
403
404                 public ICollection<string> ItemTypes {
405                         get { throw new NotImplementedException (); }
406                 }
407
408                 public ICollection<ProjectProperty> Properties {
409                         get { throw new NotImplementedException (); }
410                 }
411
412                 public bool SkipEvaluation { get; set; }
413
414                 public IDictionary<string, ProjectTargetInstance> Targets {
415                         get { throw new NotImplementedException (); }
416                 }
417         }
418 }