Merge branch 'sgen-android'
[mono.git] / mcs / class / System / System.CodeDom.Compiler / CompilerParameters.cs
1 //
2 // System.CodeDom.Compiler.CompilerParameters.cs
3 //
4 // Authors:
5 //   Daniel Stodden (stodden@in.tum.de)
6 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
7 //
8 // (C) 2002 Ximian, Inc.
9 // Copyright (C) 2005 Novell, Inc (http://www.novell.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.Collections.Specialized;
32 using System.Runtime.InteropServices;
33 using System.Security.Permissions;
34 using System.Security.Policy;
35
36 namespace System.CodeDom.Compiler {
37
38 #if NET_2_0
39         [Serializable]
40 #else
41         [ComVisible (false)]
42 #endif
43         [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
44         [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
45         public class CompilerParameters {
46
47                 private string compilerOptions;
48 #if NET_1_1
49                 private Evidence evidence;
50 #endif
51                 private bool generateExecutable = false;
52                 private bool generateInMemory = false;
53                 private bool includeDebugInformation = false;
54                 private string mainClass;
55                 private string outputAssembly;
56                 private StringCollection referencedAssemblies;
57                 private TempFileCollection tempFiles;
58                 private bool treatWarningsAsErrors = false;
59                 private IntPtr userToken = IntPtr.Zero;
60                 private int warningLevel = -1;
61                 private string win32Resource;
62 #if NET_2_0
63                 private StringCollection embedded_resources;
64                 private StringCollection linked_resources;
65 #endif
66
67                 //
68                 // Constructors
69                 //
70                 public CompilerParameters()
71                 {
72                 }
73                 
74                 public CompilerParameters (string[] assemblyNames)
75                 {
76                         referencedAssemblies = new StringCollection();
77                         referencedAssemblies.AddRange (assemblyNames);
78                 }
79
80                 public CompilerParameters (string[] assemblyNames, string output)
81                 {
82                         referencedAssemblies = new StringCollection();
83                         referencedAssemblies.AddRange (assemblyNames);
84                         outputAssembly = output;
85                 }
86
87                 public CompilerParameters (string[] assemblyNames, string output, bool includeDebugInfo)
88                 {
89                         referencedAssemblies = new StringCollection();
90                         referencedAssemblies.AddRange (assemblyNames);
91                         outputAssembly = output;
92                         includeDebugInformation = includeDebugInfo;
93                 }
94
95                 //
96                 // Properties
97                 //
98                 public string CompilerOptions {
99                         get {
100                                 return compilerOptions;
101                         }
102                         set {
103                                 compilerOptions = value;
104                         }
105                 }
106
107 #if NET_1_1
108 #if NET_4_0
109                 [Obsolete]
110 #endif
111                 public Evidence Evidence {
112                         get { return evidence; }
113                         [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
114                         set { evidence = value; }
115                 }
116 #endif
117
118                 public bool GenerateExecutable {
119                         get {
120                                 return generateExecutable;
121                         }
122                         set {
123                                 generateExecutable = value;
124                         }
125                 }
126
127                 public bool GenerateInMemory {
128                         get {
129                                 return generateInMemory;
130                         }
131                         set {
132                                 generateInMemory = value;
133                         }
134                 }
135                 
136                 public bool IncludeDebugInformation {
137                         get {
138                                 return includeDebugInformation;
139                         }
140                         set {
141                                 includeDebugInformation = value;
142                         }
143                 }
144
145                 public string MainClass {
146                         get {
147                                 return mainClass;
148                         }
149                         set {
150                                 mainClass = value;
151                         }
152                 }
153
154                 public string OutputAssembly {
155                         get {
156                                 return outputAssembly;
157                         }
158                         set {
159                                 outputAssembly = value;
160                         }
161                 }
162
163                 public StringCollection ReferencedAssemblies {
164                         get {
165                                 if (referencedAssemblies == null)
166                                         referencedAssemblies = new StringCollection ();
167
168                                 return referencedAssemblies;
169                         }
170                 }
171
172                 public TempFileCollection TempFiles {
173                         get {
174                                 if (tempFiles == null)
175                                         tempFiles = new TempFileCollection ();
176                                 return tempFiles;
177                         }
178                         set {
179                                 tempFiles = value;
180                         }
181                 }
182
183                 public bool TreatWarningsAsErrors {
184                         get {
185                                 return treatWarningsAsErrors;
186                         }
187                         set {
188                                 treatWarningsAsErrors = value;
189                         }
190                 }
191
192                 public IntPtr UserToken {
193                         get {
194                                 return userToken;
195                         }
196                         set {
197                                 userToken = value;
198                         }
199                 }
200
201                 public int WarningLevel {
202                         get {
203                                 return warningLevel;
204                         }
205                         set {
206                                 warningLevel = value;
207                         }
208                 }
209                 
210                 public string Win32Resource {
211                         get {
212                                 return win32Resource;
213                         }
214                         set {
215                                 win32Resource = value;
216                         }
217                 }
218 #if NET_2_0
219                 [ComVisible (false)]
220                 public StringCollection EmbeddedResources {
221                         get {
222                                 if (embedded_resources == null)
223                                         embedded_resources = new StringCollection ();
224                                 return embedded_resources;
225                         }
226                 }
227
228                 [ComVisible (false)]
229                 public StringCollection LinkedResources {
230                         get {
231                                 if (linked_resources == null)
232                                         linked_resources = new StringCollection ();
233                                 return linked_resources;
234                         }
235                 }
236 #endif
237         }
238 }