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;
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;
43 namespace Microsoft.Build.Evaluation
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}")]
51 public Project (ProjectRootElement xml) : this(xml, null, null)
54 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
56 : this(xml, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
59 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
60 string toolsVersion, ProjectCollection projectCollection)
61 : this(xml, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
65 public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
66 string toolsVersion, ProjectCollection projectCollection,
67 ProjectLoadSettings loadSettings)
69 ProjectCollection = projectCollection;
71 GlobalProperties = globalProperties;
72 ToolsVersion = toolsVersion;
75 public Project (string projectFile) : this(projectFile, null, null)
79 public Project (string projectFile, IDictionary<string, string> globalProperties,
81 : this(projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection, ProjectLoadSettings.Default)
85 public Project (string projectFile, IDictionary<string, string> globalProperties,
86 string toolsVersion, ProjectCollection projectCollection)
87 : this(projectFile, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
91 public Project (string projectFile, IDictionary<string, string> globalProperties,
92 string toolsVersion, ProjectCollection projectCollection,
93 ProjectLoadSettings loadSettings)
95 throw new NotImplementedException ();
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; }
103 public ICollection<ProjectItem> GetItemsIgnoringCondition (string itemType)
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)));
110 public void RemoveItems (IEnumerable<ProjectItem> items)
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);
121 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude)
123 throw new NotImplementedException ();
126 public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude,
127 IEnumerable<KeyValuePair<string, string>> metadata)
129 throw new NotImplementedException ();
132 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude)
134 throw new NotImplementedException ();
137 public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude,
138 IEnumerable<KeyValuePair<string, string>> metadata)
140 throw new NotImplementedException ();
145 throw new NotImplementedException ();
148 public bool Build (IEnumerable<ILogger> loggers)
150 throw new NotImplementedException ();
153 public bool Build (string target)
155 throw new NotImplementedException ();
158 public bool Build (string[] targets)
160 throw new NotImplementedException ();
163 public bool Build (ILogger logger)
165 throw new NotImplementedException ();
168 public bool Build (string[] targets, IEnumerable<ILogger> loggers)
170 throw new NotImplementedException ();
173 public bool Build (IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
175 throw new NotImplementedException ();
178 public bool Build (string target, IEnumerable<ILogger> loggers)
180 throw new NotImplementedException ();
183 public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
185 throw new NotImplementedException ();
188 public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
190 throw new NotImplementedException ();
193 public ProjectInstance CreateProjectInstance ()
195 throw new NotImplementedException ();
198 public string ExpandString (string unexpandedValue)
200 throw new NotImplementedException ();
203 public static string GetEvaluatedItemIncludeEscaped (ProjectItem item)
205 throw new NotImplementedException ();
208 public static string GetEvaluatedItemIncludeEscaped (ProjectItemDefinition item)
210 throw new NotImplementedException ();
213 public ICollection<ProjectItem> GetItems (string itemType)
215 throw new NotImplementedException ();
218 public ICollection<ProjectItem> GetItemsByEvaluatedInclude (string evaluatedInclude)
220 throw new NotImplementedException ();
223 public IEnumerable<ProjectElement> GetLogicalProject ()
225 throw new NotImplementedException ();
228 public static string GetMetadataValueEscaped (ProjectMetadata metadatum)
230 throw new NotImplementedException ();
233 public static string GetMetadataValueEscaped (ProjectItem item, string name)
235 throw new NotImplementedException ();
238 public static string GetMetadataValueEscaped (ProjectItemDefinition item, string name)
240 throw new NotImplementedException ();
243 public string GetPropertyValue (string name)
245 throw new NotImplementedException ();
248 public static string GetPropertyValueEscaped (ProjectProperty property)
250 throw new NotImplementedException ();
253 public ProjectProperty GetProperty (string name)
255 throw new NotImplementedException ();
258 public void MarkDirty ()
260 throw new NotImplementedException ();
263 public void ReevaluateIfNecessary ()
265 throw new NotImplementedException ();
268 public bool RemoveGlobalProperty (string name)
270 throw new NotImplementedException ();
273 public bool RemoveItem (ProjectItem item)
275 throw new NotImplementedException ();
278 public bool RemoveProperty (ProjectProperty property)
280 throw new NotImplementedException ();
285 throw new NotImplementedException ();
288 public void Save (TextWriter writer)
290 throw new NotImplementedException ();
293 public void Save (string path)
295 throw new NotImplementedException ();
298 public void Save (Encoding encoding)
300 throw new NotImplementedException ();
303 public void Save (string path, Encoding encoding)
305 throw new NotImplementedException ();
308 public void SaveLogicalProject (TextWriter writer)
310 throw new NotImplementedException ();
313 public bool SetGlobalProperty (string name, string escapedValue)
315 throw new NotImplementedException ();
318 public ProjectProperty SetProperty (string name, string unevaluatedValue)
320 throw new NotImplementedException ();
323 public ICollection<ProjectMetadata> AllEvaluatedItemDefinitionMetadata {
324 get { throw new NotImplementedException (); }
327 public ICollection<ProjectItem> AllEvaluatedItems {
328 get { throw new NotImplementedException (); }
331 public ICollection<ProjectProperty> AllEvaluatedProperties {
332 get { throw new NotImplementedException (); }
335 public IDictionary<string, List<string>> ConditionedProperties {
336 get { throw new NotImplementedException (); }
339 public string DirectoryPath {
340 get { throw new NotImplementedException (); }
343 public bool DisableMarkDirty { get; set; }
345 public int EvaluationCounter {
346 get { throw new NotImplementedException (); }
349 public string FullPath {
350 get { throw new NotImplementedException (); }
351 set { throw new NotImplementedException (); }
354 public IList<ResolvedImport> Imports {
355 get { throw new NotImplementedException (); }
358 public IList<ResolvedImport> ImportsIncludingDuplicates {
359 get { throw new NotImplementedException (); }
362 public bool IsBuildEnabled {
363 get { throw new NotImplementedException (); }
366 public bool IsDirty {
367 get { throw new NotImplementedException (); }
370 public IDictionary<string, ProjectItemDefinition> ItemDefinitions {
371 get { throw new NotImplementedException (); }
374 public ICollection<ProjectItem> Items {
375 get { throw new NotImplementedException (); }
378 public ICollection<ProjectItem> ItemsIgnoringCondition {
379 get { throw new NotImplementedException (); }
382 public ICollection<string> ItemTypes {
383 get { throw new NotImplementedException (); }
386 public ICollection<ProjectProperty> Properties {
387 get { throw new NotImplementedException (); }
390 public bool SkipEvaluation { get; set; }
392 public IDictionary<string, ProjectTargetInstance> Targets {
393 get { throw new NotImplementedException (); }