2010-04-06 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System / System.CodeDom.Compiler / CompilerParameters.cs
blobaa01c5d77934411e49326afcfdc6400fdb9f2145
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)
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.
31 using System.Collections.Specialized;
32 using System.Runtime.InteropServices;
33 using System.Security.Permissions;
34 using System.Security.Policy;
36 namespace System.CodeDom.Compiler {
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 {
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
68 // Constructors
70 public CompilerParameters()
74 public CompilerParameters (string[] assemblyNames)
76 referencedAssemblies = new StringCollection();
77 referencedAssemblies.AddRange (assemblyNames);
80 public CompilerParameters (string[] assemblyNames, string output)
82 referencedAssemblies = new StringCollection();
83 referencedAssemblies.AddRange (assemblyNames);
84 outputAssembly = output;
87 public CompilerParameters (string[] assemblyNames, string output, bool includeDebugInfo)
89 referencedAssemblies = new StringCollection();
90 referencedAssemblies.AddRange (assemblyNames);
91 outputAssembly = output;
92 includeDebugInformation = includeDebugInfo;
96 // Properties
98 public string CompilerOptions {
99 get {
100 return compilerOptions;
102 set {
103 compilerOptions = value;
107 #if NET_1_1
108 public Evidence Evidence {
109 get { return evidence; }
110 [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
111 set { evidence = value; }
113 #endif
115 public bool GenerateExecutable {
116 get {
117 return generateExecutable;
119 set {
120 generateExecutable = value;
124 public bool GenerateInMemory {
125 get {
126 return generateInMemory;
128 set {
129 generateInMemory = value;
133 public bool IncludeDebugInformation {
134 get {
135 return includeDebugInformation;
137 set {
138 includeDebugInformation = value;
142 public string MainClass {
143 get {
144 return mainClass;
146 set {
147 mainClass = value;
151 public string OutputAssembly {
152 get {
153 return outputAssembly;
155 set {
156 outputAssembly = value;
160 public StringCollection ReferencedAssemblies {
161 get {
162 if (referencedAssemblies == null)
163 referencedAssemblies = new StringCollection ();
165 return referencedAssemblies;
169 public TempFileCollection TempFiles {
170 get {
171 if (tempFiles == null)
172 tempFiles = new TempFileCollection ();
173 return tempFiles;
175 set {
176 tempFiles = value;
180 public bool TreatWarningsAsErrors {
181 get {
182 return treatWarningsAsErrors;
184 set {
185 treatWarningsAsErrors = value;
189 public IntPtr UserToken {
190 get {
191 return userToken;
193 set {
194 userToken = value;
198 public int WarningLevel {
199 get {
200 return warningLevel;
202 set {
203 warningLevel = value;
207 public string Win32Resource {
208 get {
209 return win32Resource;
211 set {
212 win32Resource = value;
215 #if NET_2_0
216 [ComVisible (false)]
217 public StringCollection EmbeddedResources {
218 get {
219 if (embedded_resources == null)
220 embedded_resources = new StringCollection ();
221 return embedded_resources;
225 [ComVisible (false)]
226 public StringCollection LinkedResources {
227 get {
228 if (linked_resources == null)
229 linked_resources = new StringCollection ();
230 return linked_resources;
233 #endif