From: Michael D. <mik...@us...> - 2004-07-25 11:41:48
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv656/src/NHibernate.Tasks Added Files: AssemblyInfo.cs Hbm2NetTask.cs NHibernate.Tasks-1.1.csproj NHibernate.Tasks.build Log Message: Initial add of NAnt tasks to run hbm2net in the NHibernate Toolset. --- NEW FILE: NHibernate.Tasks-1.1.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{C6F085E3-17FA-424A-9A09-143F3E177FEB}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "NHibernate.Tasks" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "NHibernate.Tasks" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.XML" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> <Reference Name = "NHibernate-1.1" Project = "{0D8B57B0-1310-4EF0-B50C-DD22F37310C7}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> <Reference Name = "log4net" AssemblyName = "log4net" HintPath = "..\..\external-bin\log4net.dll" /> <Reference Name = "NAnt.Core" AssemblyName = "NAnt.Core" HintPath = "..\..\external-bin\NAnt.Core.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Hbm2NetTask.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "NHibernate.Tasks.build" BuildAction = "None" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] --- NEW FILE: NHibernate.Tasks.build --- <project name="NHibernate.Tasks" default="build" xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd" > <!-- Required properties: * build.dir - (path) root level to build to, assemblies will go in ${build.dir}/bin * build.debug - (true|false) debug build? * current.build.defines - framework-specific build defines --> <target name="build" description="NAnt Tasks that use NHibernate's Toolset."> <csc output="${build.dir}/bin/${nant.project.name}.dll" define="${current.build.defines}" target="library" debug="${build.debug}" doc="${build.dir}/bin/${nant.project.name}.xml" nowarn="1591" verbose="true" > <sources failonempty="true"> <includes name="*.cs" /> </sources> <references basedir="${build.dir}/bin"> <includes name="System.dll" /> <includes name="DotNetMock.dll" /> <includes name="NHibernate.dll" /> <includes name="NAnt.Core.dll" /> <includes name="log4net.dll" /> </references> </csc> </target> </project> --- NEW FILE: Hbm2NetTask.cs --- using System; using System.Collections; using System.IO; using System.Text; using NAnt.Core; using NAnt.Core.Types; using NAnt.Core.Tasks; using NAnt.Core.Attributes; namespace NHibernate.Tasks { [TaskName("hbm2net")] public class Hbm2NetTask : ExternalProgramBase { FileSet _set = new FileSet(); string _output = null; string _config = null; string _args = null; [BuildElement("fileset", Required=true)] public FileSet Hbm2NetFileSet { get { return _set; } set { _set = value; } } [TaskAttribute("output")] public string Output { get { return _output; } set { _output = value; } } [TaskAttribute("config")] public string Config { get { return _config; } set { _config = value; } } public override string ExeName { get { string asm = this.GetType().Assembly.Location; string basename = asm.Substring(0, asm.LastIndexOf(Path.DirectorySeparatorChar)+1); return basename + "NHibernate.Tool.hbm2net.exe"; } } public override string ProgramArguments { get { return _args; } } protected override void ExecuteTask() { StringBuilder sb = new StringBuilder(); if(_output != null) { sb.Append("--output=" + _output + " "); } if(_config != null) { sb.Append("--config=" + _config + " "); } foreach(string filename in _set.FileNames) { sb.Append(filename + " "); } _args = sb.ToString(); base.ExecuteTask(); } } } |