Fix net_4_0 build.
[mono.git] / mcs / class / Microsoft.Build / Microsoft.Build.Execution / ProjectInstance.cs
1 //
2 // ProjectInstance.cs
3 //
4 // Author:
5 //   Rolf Bjarne Kvinge (rolf@xamarin.com)
6 //
7 // Copyright (C) 2011 Xamarin Inc.
8 //
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:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
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.
27 //
28
29 using System;
30 using System.Collections.Generic;
31 using System.Linq;
32
33 using Microsoft.Build.Construction;
34 using Microsoft.Build.Evaluation;
35 using Microsoft.Build.Framework;
36 using Microsoft.Build.Logging;
37
38 namespace Microsoft.Build.Execution
39 {
40         public class ProjectInstance
41         {
42                 // instance members
43                 
44                 public ProjectInstance (ProjectRootElement xml)
45                         : this (xml, null, null, ProjectCollection.GlobalProjectCollection)
46                 {
47                 }
48
49                 public ProjectInstance (string projectFile)
50                         : this (projectFile, null, null, ProjectCollection.GlobalProjectCollection)
51                 {
52                 }
53
54                 public ProjectInstance (string projectFile, IDictionary<string, string> globalProperties,
55                                 string toolsVersion)
56                         : this (projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
57                 {
58                 }
59
60                 public ProjectInstance (ProjectRootElement xml, IDictionary<string, string> globalProperties,
61                                 string toolsVersion, ProjectCollection projectCollection)
62                 {
63                         projects = projectCollection;
64                         global_properties = globalProperties ?? new Dictionary<string, string> ();
65                         ToolsVersion = toolsVersion;
66                         InitializeProperties (xml);
67                 }
68
69                 public ProjectInstance (string projectFile, IDictionary<string, string> globalProperties,
70                                 string toolsVersion, ProjectCollection projectCollection)
71                         : this (ProjectRootElement.Create (projectFile), globalProperties, toolsVersion, projectCollection)
72                 {
73                 }
74
75                 ProjectCollection projects;
76                 IDictionary<string, string> global_properties;
77
78                 void InitializeProperties (ProjectRootElement xml)
79                 {
80                         DefaultTargets = xml.DefaultTargets.Split (';').Select (s => s.Trim ()).ToList ();
81                         InitialTargets = xml.InitialTargets.Split (';').Select (s => s.Trim ()).ToList ();
82                 }
83
84                 public List<string> DefaultTargets { get; private set; }
85                 
86                 public string Directory {
87                         get { throw new NotImplementedException (); }
88                 }
89                 
90                 public string FullPath {
91                         get { throw new NotImplementedException (); }
92                 }
93                 
94                 public IDictionary<string, string> GlobalProperties {
95                         get { return global_properties; }
96                 }
97                 
98                 public List<string> InitialTargets { get; private set; }
99                 
100 #if NET_4_5             
101                 public bool IsImmutable {
102                         get { throw new NotImplementedException (); }
103                 }
104 #endif
105                 
106                 public IDictionary<string, ProjectItemDefinitionInstance> ItemDefinitions {
107                         get { throw new NotImplementedException (); }
108                 }
109                 
110                 public ICollection<ProjectItemInstance> Items {
111                         get { throw new NotImplementedException (); }
112                 }
113                 
114                 public ICollection<string> ItemTypes {
115                         get { throw new NotImplementedException (); }
116                 }
117
118 #if NET_4_5             
119                 public ElementLocation ProjectFileLocation {
120                         get { throw new NotImplementedException (); }
121                 }
122 #endif
123
124                 public ICollection<ProjectPropertyInstance> Properties {
125                         get { throw new NotImplementedException (); }
126                 }
127                 
128                 #if NET_4_5
129                 public
130                 #else
131                 internal
132                 #endif
133                 IDictionary<string, ProjectTargetInstance> Targets {
134                         get { throw new NotImplementedException (); }
135                 }
136                 
137                 public string ToolsVersion { get; private set; }
138
139                 public ProjectItemInstance AddItem (string itemType, string evaluatedInclude)
140                 {
141                         return AddItem (itemType, evaluatedInclude, new KeyValuePair<string, string> [0]);
142                 }
143                 
144                 public ProjectItemInstance AddItem (string itemType, string evaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata)
145                 {
146                         throw new NotImplementedException ();
147                 }
148
149                 public bool Build ()
150                 {
151                         return Build (new ILogger [0]);
152                 }
153
154                 public bool Build (IEnumerable<ILogger> loggers)
155                 {
156                         return Build (loggers, new ForwardingLoggerRecord [0]);
157                 }
158                 
159                 public bool Build (IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
160                 {
161                         return Build ((string []) null, loggers, remoteLoggers);
162                 }
163
164                 public bool Build (string target, IEnumerable<ILogger> loggers)
165                 {
166                         return Build (target, loggers, new ForwardingLoggerRecord [0]);
167                 }
168
169                 public bool Build (string [] targets, IEnumerable<ILogger> loggers)
170                 {
171                         return Build (targets, loggers, new ForwardingLoggerRecord [0]);
172                 }
173                 
174                 public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
175                 {
176                         return Build (new string [] {target}, loggers, remoteLoggers);
177                 }
178                 
179                 public bool Build (string [] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
180                 {
181                         IDictionary<string, TargetResult> outputs;
182                         return Build (targets, loggers, remoteLoggers, out outputs);
183                 }
184
185                 public bool Build (string[] targets, IEnumerable<ILogger> loggers, out IDictionary<string, TargetResult> targetOutputs)
186                 {
187                                 return Build (targets, loggers, new ForwardingLoggerRecord [0], out targetOutputs);
188                 }
189
190                 public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers, out IDictionary<string, TargetResult> targetOutputs)
191                 {
192                         throw new NotImplementedException ();
193                 }
194                 
195                 public ProjectInstance DeepCopy ()
196                 {
197                         return DeepCopy (false);
198                 }
199                 
200                 public ProjectInstance DeepCopy (bool isImmutable)
201                 {
202                         throw new NotImplementedException ();
203                 }
204                 
205                 public bool EvaluateCondition (string condition)
206                 {
207                         throw new NotImplementedException ();
208                 }
209
210                 public string ExpandString (string unexpandedValue)
211                 {
212                         throw new NotImplementedException ();
213                 }
214
215                 public ICollection<ProjectItemInstance> GetItems (string itemType)
216                 {
217                         throw new NotImplementedException ();
218                 }
219
220                 public IEnumerable<ProjectItemInstance> GetItemsByItemTypeAndEvaluatedInclude (string itemType, string evaluatedInclude)
221                 {
222                         throw new NotImplementedException ();
223                 }
224
225                 public ProjectPropertyInstance GetProperty (string name)
226                 {
227                         throw new NotImplementedException ();
228                 }
229                 
230                 public string GetPropertyValue (string name)
231                 {
232                         throw new NotImplementedException ();
233                 }
234                 
235                 public bool RemoveItem (ProjectItemInstance item)
236                 {
237                         throw new NotImplementedException ();
238                 }
239
240                 public bool RemoveProperty (string name)
241                 {
242                         throw new NotImplementedException ();
243                 }
244                 
245                 public ProjectPropertyInstance SetProperty (string name, string evaluatedValue)
246                 {
247                         throw new NotImplementedException ();
248                 }
249                 
250                 public ProjectRootElement ToProjectRootElement ()
251                 {
252                         throw new NotImplementedException ();
253                 }
254                 
255 #if NET_4_5
256                 public void UpdateStateFrom (ProjectInstance projectState)
257                 {
258                         throw new NotImplementedException ();
259                 }
260 #endif
261                 
262                 // static members               
263
264                 public static string GetEvaluatedItemIncludeEscaped (ProjectItemDefinitionInstance item)
265                 {
266                         throw new NotImplementedException ();
267                 }
268
269                 public static string GetEvaluatedItemIncludeEscaped (ProjectItemInstance item)
270                 {
271                         throw new NotImplementedException ();
272                 }
273
274                 public static string GetMetadataValueEscaped (ProjectMetadataInstance metadatum)
275                 {
276                         throw new NotImplementedException ();
277                 }
278                 
279                 public static string GetMetadataValueEscaped (ProjectItemDefinitionInstance item, string name)
280                 {
281                         throw new NotImplementedException ();
282                 }
283                 
284                 public static string GetMetadataValueEscaped (ProjectItemInstance item, string name)
285                 {
286                         throw new NotImplementedException ();
287                 }
288
289                 public static string GetPropertyValueEscaped (ProjectPropertyInstance property)
290                 {
291                         throw new NotImplementedException ();
292                 }
293         }
294 }
295