// NAnt - A .NET build tool // Copyright (C) 2001-2002 Gerry Shaw // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Gerry Shaw (gerry_shaw@yahoo.com) // Mike Krueger (mike@icsharpcode.net) // Aaron A. Anderson (aaron@skypoint.com | aaron.anderson@farmcreditbank.com) using System; using System.IO; using SourceForge.NAnt.Attributes; namespace SourceForge.NAnt.Tasks { /// Compiles Microsoft Visual Basic.NET programs using vbc.exe. /// /// Example build file using this task. /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// ///]]> /// /// [TaskName("vbc")] public class VbcTask : CompilerBase { string _baseAddress = null; string _imports = null; string _optionCompare = null; bool _optionExplicit = false; bool _optionStrict = false; bool _optionOptimize = false; bool _removeintchecks = false; string _rootNamespace = null; /// Specifies whether /baseaddress option gets passed to the compiler. /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this property is a string that makes up a 32bit hexidecimal number. [TaskAttribute("baseaddress")] public string BaseAddress { get { return _baseAddress; } set {_baseAddress = value;}} /// Specifies whether the /imports option gets passed to the compiler /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this attribute is a string that contains one or more namespaces separated by commas. /// Example of an imports attribute /// [TaskAttribute("imports")] public string Imports { get { return _imports; } set {_imports = value;}} /// Specifies whether /optioncompare option gets passed to the compiler /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this property must be either text, binary, or an empty string. If the value is false or empty string, the switch is omitted. [TaskAttribute("optioncompare")] public string OptionCompare { get { return _optionCompare; } set {_optionCompare = value;}} /// Specifies whether the /optionexplicit option gets passed to the compiler. /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this attribute must be either true or false. If false, the switch is omitted. [TaskAttribute("optionexplicit")] [BooleanValidator()] public bool OptionExplicit { get { return Convert.ToBoolean(_optionExplicit); } set {_optionExplicit = value;}} /// Specifies whether the /optimize option gets passed to the compiler. /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this attribute must be either true or false. If false, the switch is omitted. [TaskAttribute("optionoptimize")] [BooleanValidator()] public bool OptionOptimize{ get { return Convert.ToBoolean(_optionOptimize); } set {_optionOptimize = value;}} /// Specifies whether the /optionstrict option gets passed to the compiler. /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this attribute must be either true or false. If false, the switch is omitted. [TaskAttribute("optionstrict")] [BooleanValidator()] public bool OptionStrict { get { return Convert.ToBoolean(_optionStrict); } set {_optionStrict = value;}} /// Specifies whether the /removeintchecks option gets passed to the compiler. /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this attribute must be either true or false. If false, the switch is omitted. [TaskAttribute("removeintchecks")] [BooleanValidator()] public bool RemoveIntChecks { get { return Convert.ToBoolean(_removeintchecks); } set {_removeintchecks = value;}} /// Specifies whether the /rootnamespace option gets passed to the compiler. /// See the Microsoft.NET Framework SDK documentation for details. /// The value of this attribute is a string that contains the root namespace of the project. [TaskAttribute("rootnamespace")] public string RootNamespace { get { return _rootNamespace; } set {_rootNamespace = value;}} /// /// Writes the compiler options to the specified TextWriter. /// /// /// protected override void WriteOptions(TextWriter writer) { if (_baseAddress != null) { writer.WriteLine("/baseaddress:{0}", _baseAddress); } if (Debug) { writer.WriteLine("/debug"); writer.WriteLine("/define:DEBUG=True,TRACE=True"); } if (_imports != null) { writer.WriteLine("/imports:{0}", _imports); } System.Console.WriteLine("/imports:{0}", _imports); if (_optionCompare != null) { writer.WriteLine("/optioncompare:{0}", _optionCompare); } if (OptionExplicit) { writer.WriteLine("/optionexplicit"); } if (OptionStrict) { writer.WriteLine("/optionstrict"); } if (RemoveIntChecks) { writer.WriteLine("/removeintchecks"); } if (OptionOptimize) { writer.WriteLine("/optimize"); } if (_rootNamespace != null) { writer.WriteLine("/rootnamespace:{0}", _rootNamespace); } } } }