5 // Leszek Ciesielski (skolima@gmail.com)
6 // Rolf Bjarne Kvinge (rolf@xamarin.com)
8 // (C) 2011 Leszek Ciesielski
9 // Copyright (C) 2011 Xamarin Inc. (http://www.xamarin.com)
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
32 using System.Collections.Generic;
33 using System.Diagnostics;
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;
44 namespace Microsoft.Build.Evaluation
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}")]
52 public Project (XmlReader xml)
53 : this (ProjectRootElement.Create (xml))
56 public Project (XmlReader xml, IDictionary<string, string> globalProperties,
58 : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion)
61 public Project (XmlReader xml, IDictionary<string, string> globalProperties,
62 string toolsVersion, ProjectCollection projectCollection)
63 : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion, projectCollection)
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)
73 public Project (ProjectRootElement xml) : this(xml, null, null)
76 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
78 : this(xml, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
81 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
82 string toolsVersion, ProjectCollection projectCollection)
83 : this(xml, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
87 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
88 string toolsVersion, ProjectCollection projectCollection,
89 ProjectLoadSettings loadSettings)
91 ProjectCollection = projectCollection;
93 GlobalProperties = globalProperties;
94 ToolsVersion = toolsVersion;
97 public Project (string projectFile) : this(projectFile, null, null)
101 public Project (string projectFile, IDictionary<string, string> globalProperties,
103 : this(projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection, ProjectLoadSettings.Default)
107 public Project (string projectFile, IDictionary<string, string> globalProperties,
108 string toolsVersion, ProjectCollection projectCollection)
109 : this(projectFile, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
113 public Project (string projectFile, IDictionary<string, string> globalProperties,
114 string toolsVersion, ProjectCollection projectCollection,
115 ProjectLoadSettings loadSettings)
117 throw new NotImplementedException ();
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; }
125 public ICollection<ProjectItem> GetItemsIgnoringCondition (string itemType)
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)));
132 public void RemoveItems (IEnumerable<ProjectItem> items)
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);
143 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude)
145 throw new NotImplementedException ();
148 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude,
149 IEnumerable<KeyValuePair<string, string>> metadata)
151 throw new NotImplementedException ();
154 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude)
156 throw new NotImplementedException ();
159 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude,
160 IEnumerable<KeyValuePair<string, string>> metadata)
162 throw new NotImplementedException ();
167 throw new NotImplementedException ();
170 public bool Build (IEnumerable<ILogger> loggers)
172 throw new NotImplementedException ();
175 public bool Build (string target)
177 throw new NotImplementedException ();
180 public bool Build (string[] targets)
182 throw new NotImplementedException ();
185 public bool Build (ILogger logger)
187 throw new NotImplementedException ();
190 public bool Build (string[] targets, IEnumerable<ILogger> loggers)
192 throw new NotImplementedException ();
195 public bool Build (IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
197 throw new NotImplementedException ();
200 public bool Build (string target, IEnumerable<ILogger> loggers)
202 throw new NotImplementedException ();
205 public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
207 throw new NotImplementedException ();
210 public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
212 throw new NotImplementedException ();
215 public ProjectInstance CreateProjectInstance ()
217 throw new NotImplementedException ();
220 public string ExpandString (string unexpandedValue)
222 throw new NotImplementedException ();
225 public static string GetEvaluatedItemIncludeEscaped (ProjectItem item)
227 throw new NotImplementedException ();
230 public static string GetEvaluatedItemIncludeEscaped (ProjectItemDefinition item)
232 throw new NotImplementedException ();
235 public ICollection<ProjectItem> GetItems (string itemType)
237 throw new NotImplementedException ();
240 public ICollection<ProjectItem> GetItemsByEvaluatedInclude (string evaluatedInclude)
242 throw new NotImplementedException ();
245 public IEnumerable<ProjectElement> GetLogicalProject ()
247 throw new NotImplementedException ();
250 public static string GetMetadataValueEscaped (ProjectMetadata metadatum)
252 throw new NotImplementedException ();
255 public static string GetMetadataValueEscaped (ProjectItem item, string name)
257 throw new NotImplementedException ();
260 public static string GetMetadataValueEscaped (ProjectItemDefinition item, string name)
262 throw new NotImplementedException ();
265 public string GetPropertyValue (string name)
267 throw new NotImplementedException ();
270 public static string GetPropertyValueEscaped (ProjectProperty property)
272 throw new NotImplementedException ();
275 public ProjectProperty GetProperty (string name)
277 throw new NotImplementedException ();
280 public void MarkDirty ()
282 throw new NotImplementedException ();
285 public void ReevaluateIfNecessary ()
287 throw new NotImplementedException ();
290 public bool RemoveGlobalProperty (string name)
292 throw new NotImplementedException ();
295 public bool RemoveItem (ProjectItem item)
297 throw new NotImplementedException ();
300 public bool RemoveProperty (ProjectProperty property)
302 throw new NotImplementedException ();
307 throw new NotImplementedException ();
310 public void Save (TextWriter writer)
312 throw new NotImplementedException ();
315 public void Save (string path)
317 throw new NotImplementedException ();
320 public void Save (Encoding encoding)
322 throw new NotImplementedException ();
325 public void Save (string path, Encoding encoding)
327 throw new NotImplementedException ();
330 public void SaveLogicalProject (TextWriter writer)
332 throw new NotImplementedException ();
335 public bool SetGlobalProperty (string name, string escapedValue)
337 throw new NotImplementedException ();
340 public ProjectProperty SetProperty (string name, string unevaluatedValue)
342 throw new NotImplementedException ();
345 public ICollection<ProjectMetadata> AllEvaluatedItemDefinitionMetadata {
346 get { throw new NotImplementedException (); }
349 public ICollection<ProjectItem> AllEvaluatedItems {
350 get { throw new NotImplementedException (); }
353 public ICollection<ProjectProperty> AllEvaluatedProperties {
354 get { throw new NotImplementedException (); }
357 public IDictionary<string, List<string>> ConditionedProperties {
358 get { throw new NotImplementedException (); }
361 public string DirectoryPath {
362 get { throw new NotImplementedException (); }
365 public bool DisableMarkDirty { get; set; }
367 public int EvaluationCounter {
368 get { throw new NotImplementedException (); }
371 public string FullPath {
372 get { throw new NotImplementedException (); }
373 set { throw new NotImplementedException (); }
376 public IList<ResolvedImport> Imports {
377 get { throw new NotImplementedException (); }
380 public IList<ResolvedImport> ImportsIncludingDuplicates {
381 get { throw new NotImplementedException (); }
384 public bool IsBuildEnabled {
385 get { throw new NotImplementedException (); }
388 public bool IsDirty {
389 get { throw new NotImplementedException (); }
392 public IDictionary<string, ProjectItemDefinition> ItemDefinitions {
393 get { throw new NotImplementedException (); }
396 public ICollection<ProjectItem> Items {
397 get { throw new NotImplementedException (); }
400 public ICollection<ProjectItem> ItemsIgnoringCondition {
401 get { throw new NotImplementedException (); }
404 public ICollection<string> ItemTypes {
405 get { throw new NotImplementedException (); }
408 public ICollection<ProjectProperty> Properties {
409 get { throw new NotImplementedException (); }
412 public bool SkipEvaluation { get; set; }
414 public IDictionary<string, ProjectTargetInstance> Targets {
415 get { throw new NotImplementedException (); }