Ian, I've included the diff -u at the end of this message (finally). Can you
review and commit this or give me access to the project? I would like to see
this in the next release. My sourceforge username is asansone.
Thanks,
-Aaron
Message: 2
Date: Sat, 18 Jan 2003 11:43:46 +1100
From: Ian MacLean <[EMAIL PROTECTED]>
To: "Sansone, Aaron" <[EMAIL PROTECTED]>
CC: "Nant-Developers (E-mail)" <[EMAIL PROTECTED]>
Subject: Re: [nant-dev] Updates to ResGenTask.cs...
Aaron,
Can you please re-send this as a diff ? cvs diff -u. Its easier to
review and apply in that format.
Ian
>All,
>
>I made some changes to the ResGenTask.cs file that I would like reviewed and
>committed. I was having difficulty using this and having the task create my
>resource files with the appropriate namespace and in the correct "todir". For
>example:
>
><resgen output="AMS.${project.client.assembly.name}.Controls."
>todir="${project.basedir}\${build.dir}\resources" compile="true">
> <resources>
> <includes
>name="${project.basedir}\${project.controls.assembly.name}\**\*.resx" />
> </resources>
></resgen>
>
>I needed the generated resource file from MyControl.resx to have the namespace
>and created as: AMS.Client.Controls.MyControl.resource
>
>I also needed to place the output in a build/resources directory (i.e. todir)
>which was not happening.
>
>If someone gives me developer access I can commit these changes...
--- ResGenTask.cs Fri Jan 17 19:59:06 2003
+++ .\Original\ResGenTask.cs Wed Feb 05 20:37:01 2003
@@ -42,7 +42,7 @@
/// </code>
/// </example>
[TaskName("resgen")]
- public class ResGenTask : ExternalProgramBase {
+ public class ResGenTask : MsftFXSDKExternalProgramBase {
string _arguments;
string _input = null;
@@ -57,16 +57,7 @@
/// <summary>Name of the resource file to output.</summary>
[TaskAttribute("output", Required=false)]
- public string Output {
- get {
- if( _output == null ) {
- return "";
- } else {
- return _output;
- }
- }
- set {_output = value;}
- }
+ public string Output { get { return _output; } set {_output = value;} }
/// <summary>The target type ( usually resources).</summary>
[TaskAttribute("target", Required=false)]
@@ -74,20 +65,11 @@
/// <summary>The directory to which outputs will be stored.</summary>
[TaskAttribute("todir", Required=false)]
- public string ToDirectory {
- get {
- if( _toDir == null ) {
- return BaseDirectory;
- } else {
- return _toDir;
- }
- }
- set {_toDir = value;}
- }
+ public string ToDirectory { get { return _toDir; } set {_toDir =
value;} }
/// <summary>Takes a list of .resX or .txt files to convert to
.resources files.</summary>
[FileSet("resources")]
- public FileSet Resources { get { return _resources; } set {
_resources = value; } }
+ public FileSet Resources { get { return _resources; } set { _resources
= value; } }
public override string ProgramFileName { get { return Name; } }
@@ -125,8 +107,7 @@
_arguments = "";
if (Resources.FileNames.Count > 0) {
foreach ( string filename in Resources.FileNames ) {
- string outputFile =
getOutputFile(filename);
-
+ string outputFile = Path.ChangeExtension( filename,
TargetExt );
if (NeedsCompiling (filename, outputFile)) {
if (_arguments.Length == 0) {
AppendArgument ("/compile");
@@ -134,13 +115,23 @@
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 = getOutputFile(inputFile);
+ string outputFile;
+
+ if (Output != null) {
+ if (ToDirectory == null)
+ ToDirectory = BaseDirectory;
+
+ outputFile = Path.GetFullPath(
+ Path.Combine (ToDirectory, Output));
+ } else
+ outputFile = Path.ChangeExtension (inputFile, TargetExt );
if (NeedsCompiling (inputFile, outputFile)) {
AppendArgument (String.Format ("\"{0}\" \"{1}\"",
inputFile, outputFile));
@@ -153,14 +144,6 @@
}
}
- 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>
/// Clean up generated files
/// </summary>
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers