1
// SharpDevelop samples
2
// Copyright (c) 2006, AlphaSierraPapa
3
// All rights reserved.
5
// Redistribution and use in source and binary forms, with or without modification, are
6
// permitted provided that the following conditions are met:
8
// - Redistributions of source code must retain the above copyright notice, this list
9
// of conditions and the following disclaimer.
11
// - Redistributions in binary form must reproduce the above copyright notice, this list
12
// of conditions and the following disclaimer in the documentation and/or other materials
13
// provided with the distribution.
15
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
16
// endorse or promote products derived from this software without specific prior written
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
20
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
using System.CodeDom.Compiler;
31
namespace Mono.Build.Tasks
34
/// Base class for the Mcs and Gmcs tasks.
36
public abstract class MonoCSharpCompilerTask : MonoCompilerTask
38
bool checkForOverflowUnderflow;
40
string documentationFile;
44
string moduleAssemblyName;
49
MonoCSharpCompilerResultsParser parser = new MonoCSharpCompilerResultsParser();
51
public bool CheckForOverflowUnderflow {
52
get { return checkForOverflowUnderflow; }
53
set { checkForOverflowUnderflow = value; }
56
public bool DelaySign {
57
get { return delaySign; }
58
set { delaySign = value; }
61
public string DocumentationFile {
62
get { return documentationFile; }
63
set { documentationFile = value; }
66
public string KeyContainer {
67
get { return keyContainer; }
68
set { keyContainer = value; }
71
public string KeyFile {
72
get { return keyFile; }
73
set { keyFile = value; }
76
public string LangVersion {
77
get { return langVersion; }
78
set { langVersion = value; }
81
public string ModuleAssemblyName {
82
get { return moduleAssemblyName; }
83
set { moduleAssemblyName = value; }
86
public bool NoConfig {
87
get { return noConfig; }
88
set { noConfig = value; }
91
public string Win32Icon {
92
get { return win32Icon; }
93
set { win32Icon = value; }
96
public string Win32Resource {
97
get { return win32Resource; }
98
set { win32Resource = value; }
101
protected override string GenerateResponseFileCommands()
103
CompilerCommandLineArguments args = new CompilerCommandLineArguments();
104
args.AppendSwitchIfTrue("-noconfig", noConfig);
105
if (IsWarningLevelSet) {
106
args.AppendSwitch("-warn:", WarningLevel.ToString());
108
args.AppendFileNameIfNotNull("-out:", OutputAssembly);
109
args.AppendTarget(TargetType);
110
args.AppendSwitchIfTrue("-debug", EmitDebugInformation);
111
args.AppendSwitchIfTrue("-optimize", Optimize);
112
args.AppendSwitchIfTrue("-nologo", NoLogo);
113
args.AppendSwitchIfTrue("-unsafe", AllowUnsafeBlocks);
114
args.AppendSwitchIfTrue("-nostdlib", NoStandardLib);
115
args.AppendSwitchIfTrue("-checked", checkForOverflowUnderflow);
116
args.AppendSwitchIfTrue("-delaysign", delaySign);
117
args.AppendSwitchIfNotNull("-langversion:", langVersion);
118
args.AppendSwitchIfNotNull("-keycontainer:", keyContainer);
119
args.AppendSwitchIfNotNull("-keyfile:", keyFile);
120
args.AppendSwitchIfNotNull("-define:", DefineConstants);
121
args.AppendSwitchIfTrue("-warnaserror", TreatWarningsAsErrors);
122
args.AppendSwitchIfNotNull("-nowarn:", DisabledWarnings);
123
args.AppendSwitchIfNotNull("-main:", MainEntryPoint);
124
args.AppendFileNameIfNotNull("-doc:", documentationFile);
125
args.AppendSwitchIfNotNull("-lib:", AdditionalLibPaths, ",");
126
args.AppendReferencesIfNotNull(References);
127
args.AppendItemsIfNotNull("-resource:", Resources);
128
args.AppendFileNameIfNotNull("-win32res:", win32Resource);
129
args.AppendFileNameIfNotNull("-win32icon:", win32Icon);
130
args.AppendFileNamesIfNotNull(Sources, " ");
132
return args.ToString();
135
protected override CompilerError ParseLine(string line)
137
return parser.ParseLine(line);