5 // Rolf Bjarne Kvinge (rolf@xamarin.com)
7 // Copyright (C) 2011 Xamarin Inc.
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Collections.Generic;
33 using Microsoft.Build.Construction;
34 using Microsoft.Build.Evaluation;
35 using Microsoft.Build.Framework;
36 using Microsoft.Build.Logging;
38 namespace Microsoft.Build.Execution
40 public class ProjectInstance
44 public ProjectInstance (ProjectRootElement xml)
45 : this (xml, null, null, ProjectCollection.GlobalProjectCollection)
49 public ProjectInstance (string projectFile)
50 : this (projectFile, null, null, ProjectCollection.GlobalProjectCollection)
54 public ProjectInstance (string projectFile, IDictionary<string, string> globalProperties,
56 : this (projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
60 public ProjectInstance (ProjectRootElement xml, IDictionary<string, string> globalProperties,
61 string toolsVersion, ProjectCollection projectCollection)
63 projects = projectCollection;
64 global_properties = globalProperties ?? new Dictionary<string, string> ();
65 ToolsVersion = toolsVersion;
66 InitializeProperties (xml);
69 public ProjectInstance (string projectFile, IDictionary<string, string> globalProperties,
70 string toolsVersion, ProjectCollection projectCollection)
71 : this (ProjectRootElement.Create (projectFile), globalProperties, toolsVersion, projectCollection)
75 ProjectCollection projects;
76 IDictionary<string, string> global_properties;
78 void InitializeProperties (ProjectRootElement xml)
80 DefaultTargets = xml.DefaultTargets.Split (';').Select (s => s.Trim ()).ToList ();
81 InitialTargets = xml.InitialTargets.Split (';').Select (s => s.Trim ()).ToList ();
84 public List<string> DefaultTargets { get; private set; }
86 public string Directory {
87 get { throw new NotImplementedException (); }
90 public string FullPath {
91 get { throw new NotImplementedException (); }
94 public IDictionary<string, string> GlobalProperties {
95 get { return global_properties; }
98 public List<string> InitialTargets { get; private set; }
101 public bool IsImmutable {
102 get { throw new NotImplementedException (); }
106 public IDictionary<string, ProjectItemDefinitionInstance> ItemDefinitions {
107 get { throw new NotImplementedException (); }
110 public ICollection<ProjectItemInstance> Items {
111 get { throw new NotImplementedException (); }
114 public ICollection<string> ItemTypes {
115 get { throw new NotImplementedException (); }
119 public ElementLocation ProjectFileLocation {
120 get { throw new NotImplementedException (); }
124 public ICollection<ProjectPropertyInstance> Properties {
125 get { throw new NotImplementedException (); }
133 IDictionary<string, ProjectTargetInstance> Targets {
134 get { throw new NotImplementedException (); }
137 public string ToolsVersion { get; private set; }
139 public ProjectItemInstance AddItem (string itemType, string evaluatedInclude)
141 return AddItem (itemType, evaluatedInclude, new KeyValuePair<string, string> [0]);
144 public ProjectItemInstance AddItem (string itemType, string evaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata)
146 throw new NotImplementedException ();
151 return Build (new ILogger [0]);
154 public bool Build (IEnumerable<ILogger> loggers)
156 return Build (loggers, new ForwardingLoggerRecord [0]);
159 public bool Build (IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
161 return Build ((string []) null, loggers, remoteLoggers);
164 public bool Build (string target, IEnumerable<ILogger> loggers)
166 return Build (target, loggers, new ForwardingLoggerRecord [0]);
169 public bool Build (string [] targets, IEnumerable<ILogger> loggers)
171 return Build (targets, loggers, new ForwardingLoggerRecord [0]);
174 public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
176 return Build (new string [] {target}, loggers, remoteLoggers);
179 public bool Build (string [] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
181 IDictionary<string, TargetResult> outputs;
182 return Build (targets, loggers, remoteLoggers, out outputs);
185 public bool Build (string[] targets, IEnumerable<ILogger> loggers, out IDictionary<string, TargetResult> targetOutputs)
187 return Build (targets, loggers, new ForwardingLoggerRecord [0], out targetOutputs);
190 public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers, out IDictionary<string, TargetResult> targetOutputs)
192 throw new NotImplementedException ();
195 public ProjectInstance DeepCopy ()
197 return DeepCopy (false);
200 public ProjectInstance DeepCopy (bool isImmutable)
202 throw new NotImplementedException ();
205 public bool EvaluateCondition (string condition)
207 throw new NotImplementedException ();
210 public string ExpandString (string unexpandedValue)
212 throw new NotImplementedException ();
215 public ICollection<ProjectItemInstance> GetItems (string itemType)
217 throw new NotImplementedException ();
220 public IEnumerable<ProjectItemInstance> GetItemsByItemTypeAndEvaluatedInclude (string itemType, string evaluatedInclude)
222 throw new NotImplementedException ();
225 public ProjectPropertyInstance GetProperty (string name)
227 throw new NotImplementedException ();
230 public string GetPropertyValue (string name)
232 throw new NotImplementedException ();
235 public bool RemoveItem (ProjectItemInstance item)
237 throw new NotImplementedException ();
240 public bool RemoveProperty (string name)
242 throw new NotImplementedException ();
245 public ProjectPropertyInstance SetProperty (string name, string evaluatedValue)
247 throw new NotImplementedException ();
250 public ProjectRootElement ToProjectRootElement ()
252 throw new NotImplementedException ();
256 public void UpdateStateFrom (ProjectInstance projectState)
258 throw new NotImplementedException ();
264 public static string GetEvaluatedItemIncludeEscaped (ProjectItemDefinitionInstance item)
266 throw new NotImplementedException ();
269 public static string GetEvaluatedItemIncludeEscaped (ProjectItemInstance item)
271 throw new NotImplementedException ();
274 public static string GetMetadataValueEscaped (ProjectMetadataInstance metadatum)
276 throw new NotImplementedException ();
279 public static string GetMetadataValueEscaped (ProjectItemDefinitionInstance item, string name)
281 throw new NotImplementedException ();
284 public static string GetMetadataValueEscaped (ProjectItemInstance item, string name)
286 throw new NotImplementedException ();
289 public static string GetPropertyValueEscaped (ProjectPropertyInstance property)
291 throw new NotImplementedException ();