Re: [nant-dev] Mono Support
And Philip... I'm curious as to the environment you got mono NAnt to run in. Cygwin, or the real deal in linux? Suse Linux 8.0, shell script for the initial build, GVim text editor --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] Mono Support
Ooh. Could you post the shell script? I'd like to work on putting something together to help folks get bootstrapped into NAnt from Linux. (Hmmm... this might be a better long-term approach on both platforms. Instead of including a previous set of NAnt binaries) Some maybe-not-so-useful findings in my first hour of fiddling: NAnt.Core.dll compiles as long as ScriptTask.cs is excluded. (I was surprised as hell at how close it got... /usr/lib/Microsoft.VisualBasic.dll wasn't something I was expecting to see come scrolling across my command line). Although 'twould appear that support for CodeDom and all the goodies in the Microsoft.VisualBasic and Microsoft.JScript namespaces is in the works (those guys rule...), I'm betting it's a while before an approach as meta-code as the ScriptTask is able to work in a cross-platform way. I've got too much ecma oozing out my ears right now to think up alternatives :) Brian On Mon, 2003-03-03 at 07:02, Philip Nelson wrote: And Philip... I'm curious as to the environment you got mono NAnt to run in. Cygwin, or the real deal in linux? Suse Linux 8.0, shell script for the initial build, GVim text editor --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] PATCH: copy task w/read-only attribute destination
What about this one? I use the already-gotten dstInfo to test for attribute we don't want and clear them if they exist. Shouldn't be a lot of overhead in this case: diff -u -r1.4 CopyTask.cs --- src/NAnt.Core/Tasks/CopyTask.cs 26 Feb 2003 07:02:30 - 1.4 +++ src/NAnt.Core/Tasks/CopyTask.cs 3 Mar 2003 17:46:09 - @@ -202,6 +202,8 @@ if (Overwrite || outdated) { FileCopyMap.Add(srcInfo.FullName, dstFilePath); +if (dstInfo.Exists dstInfo.Attributes != FileAttributes.Normal) +dstInfo.Attributes = FileAttributes.Normal; } } else { string msg = String.Format(CultureInfo.InvariantCulture, Could not find file {0} to copy., srcInfo.FullName); Philip Nelson wrote: --- Matthew Mastracci [EMAIL PROTECTED] wrote: This fixes the problem with read-only file destination for the copy task. If noone objects, I'll check this in. snip if (File.Exists(dstPath)) File.SetAttributes(dstPath, FileAttributes.Normal); I would *love* to have this in but I would worry about performance when the file set is a network share instead of the local file system. I currently use the attrib task to accomplish the same thing. That would be almost as good if we had (maybe we do now?) fileset references like Ant does. Since the copy task only copies over older files, if the attribute was only reset if the file was actually going to be copied it might be OK. I tend to think it should still be optional though because some people may depend on the current behaviour. --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
RE: [nant-dev] Changes to DeleteTask...
Matthew, This has not been committed yet. I'm of the mind now that this is just a lazy mans attrib task. One can very easily just call an attrib before this task to insure that it is not read only. However, if no one is opposed to this change, I say put it in. I'd really like to see my changes to the resgen task reviewed. The resgen task changes allow you to take a fileset of resx files for resource file creation. I think this is more useful than the delete changes. For the Resgen task cvs diff, see the archived message: Date: Wed, 5 Feb 2003 14:55:23 -0600 Subject: [nant-dev] Changes... -Aaron -Original Message- From: Matthew Mastracci [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 3:53 PM To: Sansone, Aaron Cc: Nant-Developers (E-mail) Subject: Re: [nant-dev] Changes to DeleteTask... Has anyone reviewed, commented or commit this patch yet? Any objections to this? Sansone, Aaron wrote: All, I've made a change to the DeleteTask that I would like to have reviewed/committed if you all agree with the change. This issue I ran into was forcing a delete even if the file is read only. I added a parameter force that will allow this. I also added code that would recurse a directory and force the deletion of a directory even if some of the files in the directory are read only. Let me know what you all think of this. Thanks, Aaron --- DeleteTask.cs Fri Jan 17 23:56:22 2003 +++ .\Original\DeleteTask.cs Wed Feb 05 20:36:33 2003 @@ -19,7 +19,7 @@ using System; using System.IO; -using System.Collections; + using SourceForge.NAnt.Attributes; namespace SourceForge.NAnt.Tasks { @@ -51,8 +51,7 @@ public class DeleteTask : Task { string _file = null; -string _dir = null; - bool _force = false; +string _dir = null; FileSet _fileset = new FileSet(); /// summaryThe file to delete./summary @@ -61,15 +60,6 @@ get { return _file; } set {_file = value; } } - - /// summaryDelete files even if read only./summary - [TaskAttribute(force)] - [BooleanValidator()] - public bool ForceDelete - { - get { return _force; } - set {_force = value; } - } /// summaryThe directory to delete./summary [TaskAttribute(dir)] @@ -130,14 +120,7 @@ } Log.WriteLine(LogPrefix + Deleting directory {0}, path); - if( ForceDelete ) - { - foreach(string file in getRecursiveFileList(path) ) - { - File.SetAttributes(file, FileAttributes.Normal); - } - } - Directory.Delete(path, true); +Directory.Delete(path, true); } else { throw new DirectoryNotFoundException(); } @@ -149,33 +132,10 @@ } } - private ArrayList getRecursiveFileList(string path) - { - ArrayList files = new ArrayList(); - - string[] dirs = Directory.GetDirectories(path); - - foreach (string dir in dirs) - { - files.AddRange( getRecursiveFileList(dir) ); - } - - if( ! path.Equals(.) ) - { - files.AddRange(Directory.GetFiles(path)); - } - - return files; - } - void DeleteFile(string path, bool verbose) { try { if (File.Exists(path)) { Log.WriteLineIf(verbose, LogPrefix + Deleting file {0}, path); - if( ForceDelete ) - { - File.SetAttributes(path, FileAttributes.Normal); - } File.Delete(path); } else { throw new FileNotFoundException(); --- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] PATCH: Aaron Sansone's resgen task changes
Matthew Mastracci wrote: I've manually applied Aaron's changes to my tree, cleaned up the style to match the NAnt coding style and attached it to this message. If noone objects, I'll check this in. Looks ok to me. ? patch.txt Index: ResGenTask.cs === RCS file: /cvsroot/nant/nant/src/NAnt.DotNetTasks/ResGenTask.cs,v retrieving revision 1.4 diff -u -r1.4 ResGenTask.cs --- ResGenTask.cs 25 Feb 2003 23:15:34 - 1.4 +++ ResGenTask.cs 3 Mar 2003 23:33:52 - @@ -58,7 +58,7 @@ /// summaryName of the resource file to output./summary [TaskAttribute(output, Required=false)] -public string Output { get { return _output; } set {_output = value;} } +public string Output { get { return (_output == null) ? String.Empty : _output; } set {_output = value;} } /// summaryThe target type ( usually resources)./summary [TaskAttribute(target, Required=false)] @@ -66,7 +66,7 @@ /// summaryThe directory to which outputs will be stored./summary [TaskAttribute(todir, Required=false)] -public string ToDirectory { get { return _toDir; } set {_toDir = value;} } +public string ToDirectory { get { return (_toDir == null) ? BaseDirectory : _toDir; } set {_toDir = value;} } /// summaryTakes a list of .resX or .txt files to convert to .resources files./summary [FileSet(resources)] @@ -104,35 +104,27 @@ _arguments += s; } +// Process a single file or file group protected override void ExecuteTask() { _arguments = ; if (Resources.FileNames.Count 0) { foreach ( string filename in Resources.FileNames ) { -string outputFile = Path.ChangeExtension( filename, TargetExt ); +string outputFile = getOutputFile(filename); + if (NeedsCompiling (filename, outputFile)) { if (_arguments.Length == 0) { AppendArgument (/compile); } -AppendArgument (String.Format(CultureInfo.InvariantCulture, \{0},{1}\, filename, outputFile)); +AppendArgument (String.Format( \{0},{1}\, filename, outputFile)); } } - } else { // Single file situation if (Input == null) throw new BuildException(Resource generator needs either an input attribute, or a non-empty fileset., Location); - + string inputFile = Path.GetFullPath(Path.Combine (BaseDirectory, Input)); -string outputFile; - -if (Output != null) { -if (ToDirectory == null) -ToDirectory = BaseDirectory; - -outputFile = Path.GetFullPath( -Path.Combine (ToDirectory, Output)); -} else -outputFile = Path.ChangeExtension (inputFile, TargetExt ); +string outputFile = getOutputFile(inputFile); if (NeedsCompiling (inputFile, outputFile)) { AppendArgument (String.Format (\{0}\ \{1}\, inputFile, outputFile)); @@ -143,6 +135,14 @@ // call base class to do the work base.ExecuteTask(); } +} + +// Determine the full path and extension for the output file +private string getOutputFile(string filename) { +FileInfo fileInfo = new FileInfo(filename); +string outputFile = Path.Combine (ToDirectory, Output) + fileInfo.Name; +outputFile = Path.ChangeExtension( outputFile, TargetExt ); +return outputFile; } /// summary --- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
RE: [nant-dev] reading property values from external file
Title: Message On my builds, I have a separate filethat just contains properties and nothing else. For example, ?xml version="1.0" encoding="utf-8" ?project xmlns="http://tempuri.org/nant-vs.xsd" name="Global Properties" property name="isGlobalPropertyFileIncluded" value="true" /!-- System Properties -- property name="dotNetFramework.dir" value="c:\WINNT\Microsoft.NET\Framework\v1.0.3705" / property name="log4net.dir" value="c:\projects\Utils\log4net\bin" / property name="nUnit.dir" value="c:\projects\Utils\nUnit\bin" / property name="nAnt.dir" value="c:\projects\Utils\nAnt\bin" / ... /project Then I include it in my main build file with the include task. include buildfile="globalProperties.include" / This works very well for me and my team. If a user wants to customize a build, they open this "Properties" build file and change the properties. Not sure if this will help your situation Gert. Jason -Original Message-From: Scott Hernandez [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 12:54 AMTo: [EMAIL PROTECTED]Subject: Re: [nant-dev] reading property values from external file Yes, we plan to support loading properties from an xml file, and/or some other configuration location. This has not come up, and nobody has done any work on this, as I remember. I expect when we have a way of specifying configuration info there will be a place to set global/default properties. We will need to address user/system/project properties. With the proposed changes to foreach you should be able to specify something like the following: foreach item="Line" in="properties.csv" delim="," property="x,y" property name="${x}" value="${y}"/ / where properties.cvs is prop1, value prop2, value I'm fine with comparing ant and nant features. I'm surethe ant team, and their users, have learned a lot in the many years of development and use. I'm happy to leverage all their knowledge and experiences. The features that ant has should all be provided by NAnt in one way or another. :) - Original Message - From: Gert Driesen To: [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 10:35 PM Subject: [nant-dev] reading property values from external file Hi, Are there plans to support a task for loading property values from an external (xml) file ? In the end, we should have something like this to allow settings to be specified or overridden on a user level. Using the commandline to specify indiviual properties is fine when you need to override only a few properties, but when you want the build process to be highly configurable by a user, it's not sufficient. Ant (no I don't want to campare Nant with Ant again :-)) currently supports both a properties file (comparabe with INI file) and an xml-properties file. Are there intentions to support something similar for NAnt ? Gert
[nant-dev] Available task
Hi Scott, As agreed, I implemented an Available task that allows you to check for the available of a file or directory resource. I currently have two possible resource checks : - File - Directory eg. available type=File resource=myfile.txt property=myfile.present / I used resource instead of file (or directory) for the attribute name, so we can add more resource checks (for registry key, registry value, .NET runtime, ) later without having to add a attribute for each type of check. I would prefer to be able to use lower case values in the buildfiles, but enum members should use Pascal casing and Nant uses a case-sensitive enum parsing so you have to specify the values in pascal casing too in the buildfile (should we change the behaviour to use a case-insensitive lookup for enum members) ? However, I don't know how the task should behave when a file or directory is not found : should I set the specified property to false or should it not set the property at all (this is how ant works) ? If I don't set the property to a value, then I don't think you can use it in the if and unless attributes and stuff, because NAnt doesn't handle this very well yet. I already proposed to Ian a while ago, to consider a property, that has not been set to a value, to have the value false. I know he changed this behaviour locally, but I don't know if he committed this change already or if he's planning to commit it anyway. Right now, I set the specified property to true or false depending on whether the resource is available or not. I included the source for the AvailableTask and the test class, but let me know if you want me to change the behaviour. Thanks, Gert // NAnt - A .NET build tool // Copyright (C) 2002 Scott Hernandez ([EMAIL PROTECTED]) // // 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 more 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 // Gert Driesen ([EMAIL PROTECTED]) using System; using System.IO; using System.Globalization; using NUnit.Framework; using SourceForge.NAnt.Tasks; //using SourceForge.NAnt.Attributes; namespace SourceForge.NAnt.Tests { /// summary /// Tests available Task. /// /summary [TestFixture] public class AvailableTest : BuildTestBase { [SetUp] protected override void SetUp() { base.SetUp(); tempFile = CreateTempFile(a.b); tempDir = CreateTempDir(foo); // create a temporary file notExistingTempFile = CreateTempFile(b.c); // delete it to make sure it definitely not exists if (notExistingTempFile != null File.Exists(notExistingTempFile)) { File.Delete(notExistingTempFile); } // create a temporary directory notExistingTempDir = CreateTempDir(test); // delete it to make sure it definitely not exists if (notExistingTempDir != null Directory.Exists(notExistingTempDir)) { Directory.Delete(notExistingTempDir); } } [TearDown] protected override void TearDown() { base.TearDown(); if (tempFile != null File.Exists(tempFile)) { File.Delete(tempFile); } if (tempDir != null Directory.Exists(tempDir)) { Directory.Delete(tempDir); } if (notExistingTempFile != null File.Exists(notExistingTempFile)) { File.Delete(notExistingTempFile); } if (notExistingTempDir != null Directory.Exists(notExistingTempDir)) { Directory.Delete(notExistingTempDir); } } [Test] public void Test_ExistingFile() { string _xml= @ project available type='{0}' resource='{1}' property='file.exists'/ echo message='file.exists={2}'/ /project; string result = RunBuild(String.Format(CultureInfo.InvariantCulture, _xml, AvailableTask.ResourceType.File.ToString(CultureInfo.InvariantCulture), tempFile, ${file.exists})); Assertion.Assert(File resource should have existed: + result, result.ToLower().IndexOf(file.exists=true) != -1); } [Test] public void Test_NotExistingFile() { string _xml= @ project