minor fix for bug 9520:
[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 Microsoft.Build.Construction;
38 using Microsoft.Build.Internal;
39 using Microsoft.Build.Execution;
40 using Microsoft.Build.Framework;
41 using Microsoft.Build.Logging;
42
43 namespace Microsoft.Build.Evaluation
44 {
45         [DebuggerDisplay("{FullPath} EffectiveToolsVersion={ToolsVersion} #GlobalProperties="
46                          +"{data.globalProperties.Count} #Properties={data.Properties.Count} #ItemTypes="
47                          +"{data.ItemTypes.Count} #ItemDefinitions={data.ItemDefinitions.Count} #Items="
48                          +"{data.Items.Count} #Targets={data.Targets.Count}")]
49         public class Project
50         {
51                 public Project (ProjectRootElement xml) : this(xml, null, null)
52                 {
53                 }
54                 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
55                                 string toolsVersion)
56                         : this(xml, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
57                 {
58                 }
59                 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
60                                 string toolsVersion, ProjectCollection projectCollection)
61                         : this(xml, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
62                 {
63                 }
64
65                 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
66                                 string toolsVersion, ProjectCollection projectCollection,
67                                 ProjectLoadSettings loadSettings)
68                 {
69                         ProjectCollection = projectCollection;
70                         Xml = xml;
71                         GlobalProperties = globalProperties;
72                         ToolsVersion = toolsVersion;
73                 }
74
75                 public Project (string projectFile) : this(projectFile, null, null)
76                 {
77                 }
78
79                 public Project (string projectFile, IDictionary<string, string> globalProperties,
80                                 string toolsVersion)
81                         : this(projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection, ProjectLoadSettings.Default)
82                 {
83                 }
84
85                 public Project (string projectFile, IDictionary<string, string> globalProperties,
86                                 string toolsVersion, ProjectCollection projectCollection)
87                         : this(projectFile, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
88                 {
89                 }
90
91                 public Project (string projectFile, IDictionary<string, string> globalProperties,
92                                 string toolsVersion, ProjectCollection projectCollection,
93                                 ProjectLoadSettings loadSettings)
94                 {
95                         throw new NotImplementedException ();
96                 }
97
98                 public IDictionary<string, string> GlobalProperties { get; private set; }
99                 public ProjectCollection ProjectCollection { get; private set; }
100                 public string ToolsVersion { get; private set; }
101                 public ProjectRootElement Xml { get; private set; }
102
103                 public ICollection<ProjectItem> GetItemsIgnoringCondition (string itemType)
104                 {
105                         return new CollectionFromEnumerable<ProjectItem> (
106                                 new FilteredEnumerable<ProjectItemElement> (Xml.Items).
107                                 Where (p => p.ItemType.Equals (itemType, StringComparison.OrdinalIgnoreCase)).
108                                 Select (p => new ProjectItem(p)));
109                 }
110                 public void RemoveItems (IEnumerable<ProjectItem> items)
111                 {
112                         var removal = new List<ProjectItem> (items);
113                         foreach (var item in removal) {
114                                 var parent = item.Xml.Parent;
115                                 parent.RemoveChild (item.Xml);
116                                 if (parent.Count == 0)
117                                         parent.Parent.RemoveChild (parent);
118                         }
119                 }
120
121                 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude)
122                 {
123                         throw new NotImplementedException ();
124                 }
125
126                 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude,
127                         IEnumerable<KeyValuePair<string, string>> metadata)
128                 {
129                         throw new NotImplementedException ();
130                 }
131
132                 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude)
133                 {
134                         throw new NotImplementedException ();
135                 }
136
137                 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude,
138                         IEnumerable<KeyValuePair<string, string>> metadata)
139                 {
140                         throw new NotImplementedException ();
141                 }
142
143                 public bool Build ()
144                 {
145                         throw new NotImplementedException ();
146                 }
147
148                 public bool Build (IEnumerable<ILogger> loggers)
149                 {
150                         throw new NotImplementedException ();
151                 }
152
153                 public bool Build (string target)
154                 {
155                         throw new NotImplementedException ();
156                 }
157
158                 public bool Build (string[] targets)
159                 {
160                         throw new NotImplementedException ();
161                 }
162
163                 public bool Build (ILogger logger)
164                 {
165                         throw new NotImplementedException ();
166                 }
167
168                 public bool Build (string[] targets, IEnumerable<ILogger> loggers)
169                 {
170                         throw new NotImplementedException ();
171                 }
172
173                 public bool Build (IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
174                 {
175                         throw new NotImplementedException ();
176                 }
177
178                 public bool Build (string target, IEnumerable<ILogger> loggers)
179                 {
180                         throw new NotImplementedException ();
181                 }
182
183                 public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
184                 {
185                         throw new NotImplementedException ();
186                 }
187
188                 public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
189                 {
190                         throw new NotImplementedException ();
191                 }
192
193                 public ProjectInstance CreateProjectInstance ()
194                 {
195                         throw new NotImplementedException ();
196                 }
197
198                 public string ExpandString (string unexpandedValue)
199                 {
200                         throw new NotImplementedException ();
201                 }
202
203                 public static string GetEvaluatedItemIncludeEscaped (ProjectItem item)
204                 {
205                         throw new NotImplementedException ();
206                 }
207
208                 public static string GetEvaluatedItemIncludeEscaped (ProjectItemDefinition item)
209                 {
210                         throw new NotImplementedException ();
211                 }
212
213                 public ICollection<ProjectItem> GetItems (string itemType)
214                 {
215                         throw new NotImplementedException ();
216                 }
217
218                 public ICollection<ProjectItem> GetItemsByEvaluatedInclude (string evaluatedInclude)
219                 {
220                         throw new NotImplementedException ();
221                 }
222
223                 public IEnumerable<ProjectElement> GetLogicalProject ()
224                 {
225                         throw new NotImplementedException ();
226                 }
227
228                 public static string GetMetadataValueEscaped (ProjectMetadata metadatum)
229                 {
230                         throw new NotImplementedException ();
231                 }
232
233                 public static string GetMetadataValueEscaped (ProjectItem item, string name)
234                 {
235                         throw new NotImplementedException ();
236                 }
237
238                 public static string GetMetadataValueEscaped (ProjectItemDefinition item, string name)
239                 {
240                         throw new NotImplementedException ();
241                 }
242
243                 public string GetPropertyValue (string name)
244                 {
245                         throw new NotImplementedException ();
246                 }
247
248                 public static string GetPropertyValueEscaped (ProjectProperty property)
249                 {
250                         throw new NotImplementedException ();
251                 }
252
253                 public ProjectProperty GetProperty (string name)
254                 {
255                         throw new NotImplementedException ();
256                 }
257
258                 public void MarkDirty ()
259                 {
260                         throw new NotImplementedException ();
261                 }
262
263                 public void ReevaluateIfNecessary ()
264                 {
265                         throw new NotImplementedException ();
266                 }
267
268                 public bool RemoveGlobalProperty (string name)
269                 {
270                         throw new NotImplementedException ();
271                 }
272
273                 public bool RemoveItem (ProjectItem item)
274                 {
275                         throw new NotImplementedException ();
276                 }
277
278                 public bool RemoveProperty (ProjectProperty property)
279                 {
280                         throw new NotImplementedException ();
281                 }
282
283                 public void Save ()
284                 {
285                         throw new NotImplementedException ();
286                 }
287
288                 public void Save (TextWriter writer)
289                 {
290                         throw new NotImplementedException ();
291                 }
292
293                 public void Save (string path)
294                 {
295                         throw new NotImplementedException ();
296                 }
297
298                 public void Save (Encoding encoding)
299                 {
300                         throw new NotImplementedException ();
301                 }
302
303                 public void Save (string path, Encoding encoding)
304                 {
305                         throw new NotImplementedException ();
306                 }
307
308                 public void SaveLogicalProject (TextWriter writer)
309                 {
310                         throw new NotImplementedException ();
311                 }
312
313                 public bool SetGlobalProperty (string name, string escapedValue)
314                 {
315                         throw new NotImplementedException ();
316                 }
317
318                 public ProjectProperty SetProperty (string name, string unevaluatedValue)
319                 {
320                         throw new NotImplementedException ();
321                 }
322
323                 public ICollection<ProjectMetadata> AllEvaluatedItemDefinitionMetadata {
324                         get { throw new NotImplementedException (); }
325                 }
326
327                 public ICollection<ProjectItem> AllEvaluatedItems {
328                         get { throw new NotImplementedException (); }
329                 }
330
331                 public ICollection<ProjectProperty> AllEvaluatedProperties {
332                         get { throw new NotImplementedException (); }
333                 }
334
335                 public IDictionary<string, List<string>> ConditionedProperties {
336                         get { throw new NotImplementedException (); }
337                 }
338
339                 public string DirectoryPath {
340                         get { throw new NotImplementedException (); }
341                 }
342
343                 public bool DisableMarkDirty { get; set; }
344
345                 public int EvaluationCounter {
346                         get { throw new NotImplementedException (); }
347                 }
348
349                 public string FullPath {
350                         get { throw new NotImplementedException (); }
351                         set { throw new NotImplementedException (); }
352                 }
353
354                 public IList<ResolvedImport> Imports {
355                         get { throw new NotImplementedException (); }
356                 }
357
358                 public IList<ResolvedImport> ImportsIncludingDuplicates {
359                         get { throw new NotImplementedException (); }
360                 }
361
362                 public bool IsBuildEnabled {
363                         get { throw new NotImplementedException (); }
364                 }
365
366                 public bool IsDirty {
367                         get { throw new NotImplementedException (); }
368                 }
369
370                 public IDictionary<string, ProjectItemDefinition> ItemDefinitions {
371                         get { throw new NotImplementedException (); }
372                 }
373
374                 public ICollection<ProjectItem> Items {
375                         get { throw new NotImplementedException (); }
376                 }
377
378                 public ICollection<ProjectItem> ItemsIgnoringCondition {
379                         get { throw new NotImplementedException (); }
380                 }
381
382                 public ICollection<string> ItemTypes {
383                         get { throw new NotImplementedException (); }
384                 }
385
386                 public ICollection<ProjectProperty> Properties {
387                         get { throw new NotImplementedException (); }
388                 }
389
390                 public bool SkipEvaluation { get; set; }
391
392                 public IDictionary<string, ProjectTargetInstance> Targets {
393                         get { throw new NotImplementedException (); }
394                 }
395         }
396 }