ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet CSharp.java Ilasm.java NetCommand.java
Date Wed, 10 Apr 2002 00:39:20 GMT
stevel      02/04/09 17:39:20

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        CSharp.java Ilasm.java NetCommand.java
  Log:
  updated to release 1.0 of .NET.
  
  stuck through jedit jstyle and idea variable renaming ops too
  
  Revision  Changes    Path
  1.17      +635 -424  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  
  Index: CSharp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CSharp.java	3 Mar 2002 01:46:23 -0000	1.16
  +++ CSharp.java	10 Apr 2002 00:39:20 -0000	1.17
  @@ -1,66 +1,64 @@
   /*
  - * The Apache Software License, Version 1.1
  + *  The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  - * reserved.
  + *  Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + *  reserved.
    *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Ant", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + *  Redistribution and use in source and binary forms, with or without
  + *  modification, are permitted provided that the following conditions
  + *  are met:
  + *
  + *  1. Redistributions of source code must retain the above copyright
  + *  notice, this list of conditions and the following disclaimer.
  + *
  + *  2. Redistributions in binary form must reproduce the above copyright
  + *  notice, this list of conditions and the following disclaimer in
  + *  the documentation and/or other materials provided with the
  + *  distribution.
  + *
  + *  3. The end-user documentation included with the redistribution, if
  + *  any, must include the following acknowlegement:
  + *  "This product includes software developed by the
  + *  Apache Software Foundation (http://www.apache.org/)."
  + *  Alternately, this acknowlegement may appear in the software itself,
  + *  if and wherever such third-party acknowlegements normally appear.
  + *
  + *  4. The names "The Jakarta Project", "Ant", and "Apache Software
  + *  Foundation" must not be used to endorse or promote products derived
  + *  from this software without prior written permission. For written
  + *  permission, please contact apache@apache.org.
  + *
  + *  5. Products derived from this software may not be called "Apache"
  + *  nor may "Apache" appear in their names without prior written
  + *  permission of the Apache Group.
  + *
  + *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + *  DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + *  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + *  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + *  SUCH DAMAGE.
  + *  ====================================================================
  + *
  + *  This software consists of voluntary contributions made by many
  + *  individuals on behalf of the Apache Software Foundation.  For more
  + *  information on the Apache Software Foundation, please see
  + *  <http://www.apache.org/>.
  + */
  +/*
  + *  build notes
  + *  -The reference CD to listen to while editing this file is
  + *  nap: Underworld  - Everything, Everything
  + *  -variable naming policy from Fowler's refactoring book.
  + *  -tested against the PDC pre-beta of csc.exe; future versions will
  + *  inevitably change things
    */
  -
  -/* build notes
  -
  -    -The reference CD to listen to while editing this file is
  -        nap: Underworld  - Everything, Everything
  -    -variable naming policy from Fowler's refactoring book.
  -    -tested against the PDC pre-beta of csc.exe; future versions will
  -     inevitably change things
  -*/
  -
   // ====================================================================
   // place in the optional ant tasks package
   // but in its own dotnet group
  @@ -79,172 +77,186 @@
   import org.apache.tools.ant.taskdefs.MatchingTask;
   import org.apache.tools.ant.types.Path;
   
  -
   // ====================================================================
   
   /**
  -This task compiles CSharp source into executables or modules.
  -The task will only work on win2K until other platforms support csc.exe or
  -an equivalent. CSC.exe must be on the execute path too.
  -
  -<p>
  -All parameters are optional: &lt;csc/&gt; should suffice to produce a debug
  -build of all *.cs files. References to external files do require explicit
  -enumeration, so are one of the first attributes to consider adding.
  -
  -<p>
  -
  -The task is a directory based task, so attributes like <b>includes="*.cs"</b> and
  -<b>excludes="broken.cs"</b> can be used to control the files pulled in. By default,
  -all *.cs files from the project folder down are included in the command.
  -When this happens the output file -if not specified-
  -is taken as the first file in the list, which may be somewhat hard to control.
  -Specifying the output file with <b>'outfile'</b> seems prudent.
  -
  -<p>
  -
  -
  -<p>
  -TODO
  -<ol>
  - <li>is incremental build still broken in beta-1?
  - <li>is Win32Icon broken?
  - <li>all the missing options
  -</ol>
  -<p>
  -History
  - <Table>
  - <tr><td>0.3</td>
  - <td> Beta 1 edition </td>
  - <td> To avoid having to remember which assemblies to include,
  - the task automatically refers to the main dotnet libraries in Beta1.
  -
  - </tr>    <tr><td>0.2</td>
  - <td> Slightly different</td>
  - <td> Split command execution to a separate class;
  - </tr>
  - <tr><td>0.1</td>
  - <td> "I can't believe it's so rudimentary"</td>
  - <td>  First pass; minimal builds only support;
  - </tr>
  -
  - </table>
  - @version 0.3
  - @author Steve Loughran steve_l@iseran.com
  -
  - * @ant.task name="csc" category="dotnet"
  + *  This task compiles CSharp source into executables or modules. The task will
  + *  only work on win2K until other platforms support csc.exe or an equivalent.
  + *  CSC.exe must be on the execute path too. <p>
  + *
  + *  All parameters are optional: &lt;csc/&gt; should suffice to produce a debug
  + *  build of all *.cs files. References to external files do require explicit
  + *  enumeration, so are one of the first attributes to consider adding. <p>
  + *
  + *  The task is a directory based task, so attributes like <b>includes="*.cs"
  + *  </b> and <b>excludes="broken.cs"</b> can be used to control the files pulled
  + *  in. By default, all *.cs files from the project folder down are included in
  + *  the command. When this happens the output file -if not specified- is taken
  + *  as the first file in the list, which may be somewhat hard to control.
  + *  Specifying the output file with <b>'outfile'</b> seems prudent. <p>
  + *
  + *  <p>
  + *
  + *  TODO
  + *  <ol>
  + *    <li> is incremental build still broken in beta-1?
  + *    <li> is Win32Icon broken?
  + *    <li> all the missing options
  + *  </ol>
  + *  <p>
  + *
  + *  History
  + *  <Table>
  + *
  + *    <tr>
  + *
  + *      <td>
  + *        0.3
  + *      </td>
  + *
  + *      <td>
  + *        Beta 1 edition
  + *      </td>
  + *
  + *      <td>
  + *        To avoid having to remember which assemblies to include, the task
  + *        automatically refers to the main dotnet libraries in Beta1.
  + *      </tr>
  + *
  + *      <tr>
  + *
  + *        <td>
  + *          0.2
  + *        </td>
  + *
  + *        <td>
  + *          Slightly different
  + *        </td>
  + *
  + *        <td>
  + *          Split command execution to a separate class;
  + *        </tr>
  + *
  + *        <tr>
  + *
  + *          <td>
  + *            0.1
  + *          </td>
  + *
  + *          <td>
  + *            "I can't believe it's so rudimentary"
  + *          </td>
  + *
  + *          <td>
  + *            First pass; minimal builds only support;
  + *          </tr>
  + *
  + *        </table>
  + *
  + *
  + *@author      Steve Loughran steve_l@iseran.com
  + *@version     0.5
  + *@ant.task    name="csc" category="dotnet"
    */
   
   public class CSharp
  -        extends MatchingTask {
  +         extends MatchingTask {
   
  -    /** constructor inits everything and set up the search pattern
  +    /**
  +     *  Name of the executable. The .exe suffix is deliberately not included in
  +     *  anticipation of the unix version
        */
  +    private final static String csc_exe_name = "csc";
   
  -    public CSharp() {
  -        Clear();
  -        setIncludes(csc_file_pattern);
  -    }
  +    /**
  +     *  what is the file extension we search on?
  +     */
  +    private final static String csc_file_ext = "cs";
   
  -    /** 
  -     * Name of the executable. The .exe suffix is deliberately not 
  -     * included in anticipation of the unix version
  +    /**
  +     *  derive the search pattern from the extension
        */
  -    protected final static String csc_exe_name = "csc";
  +    private final static String csc_file_pattern = "**/*." + csc_file_ext;
   
  -    /** what is the file extension we search on?
  +    /**
  +     *  list of reference classes. (pretty much a classpath equivalent)
        */
  -    protected final static String csc_file_ext = "cs";
  +    private String references;
   
  -    /** derive the search pattern from the extension
  +    /**
  +     *  flag to enable automatic reference inclusion
        */
  -    protected final static String csc_file_pattern = "**/*." + csc_file_ext;
  +    private boolean includeDefaultReferences;
   
  -    /** list of reference classes. (pretty much a classpath equivalent)
  +    /**
  +     *  incremental build flag
        */
  -    protected String _references;
  +    private boolean incremental;
   
       /**
  -     *  Set the reference list to be used for this compilation.
  -     *
  -     * @param  s  The new References value
  +     *  output XML documentation flag
        */
  -    public void setReferences(String s) {
  -        _references = s;
  -    }
  +    private File docFile;
   
       /**
  -     *  get the reference string or null for no argument needed
  -     *
  -     * @return    The References Parameter to CSC
  +     *  icon for incorporation into apps
        */
  -    protected String getReferencesParameter() {
  -        //bail on no references
  -        if (notEmpty(_references)) {
  -            return "/reference:" + _references;
  -        } else {
  -            return null;
  -        }
  -    }
  +    private File win32icon;
   
       /**
  -     using the path approach didnt work as it could not handle the implicit
  -     execution path. Perhaps that could be extracted from the runtime and then
  -     the path approach would be viable
  +     *  icon for incorporation into apps
        */
  -    protected Path _referenceFiles;
  +    private File win32res;
   
       /**
  -     * add another path to the reference file path list
  -     * @param path another path to append
  +     *  Description of the Field
        */
  -    public void setReferenceFiles(Path path) {
  -        //demand create pathlist
  -        if (_referenceFiles == null) {
  -            _referenceFiles = new Path(this.project);
  -        }
  -        _referenceFiles.append(path);
  -    }
  +    private boolean noconfig = false;
   
       /**
  -     turn the path list into a list of files and a /references argument
  -     @return null or a string of references.
  +     *  use full paths to things
        */
  -    protected String getReferenceFilesParameter() {
  -        //bail on no references
  -        if (_references == null) {
  -            return null;
  -        }
  -        //iterate through the ref list & generate an entry for each
  -        //or just rely on the fact that the toString operator does this, but
  -        //noting that the separator is ';' on windows, ':' on unix
  -        String refpath = _references.toString();
  +    private boolean fullpaths = false;
   
  -        //bail on no references listed
  -        if (refpath.length() == 0) {
  -            return null;
  -        }
  +    /**
  +     *  output file. If not supplied this is derived from the source file
  +     */
  +    private File outputFile;
   
  -        StringBuffer s = new StringBuffer("/reference:");
  -        s.append(refpath);
  -        return new String(s);
  -    }
  +    /**
  +     *  flag to control action on execution trouble
  +     */
  +    private boolean failOnError;
   
       /**
  -     * Fix C# reference inclusion.
  -     * C# is really dumb in how it handles inclusion. You have to list
  -     * every 'assembly' -read DLL that is imported. So already you are
  -     * making a platform assumption -shared libraries have a .dll;"+ extension
  -     * and the poor developer has to know every library which is included
  -     * why the compiler cant find classes on the path or in a directory,
  -     * is a mystery.
  -     *
  -     * To reduce the need to be explicit, here is a long list of
  -     * the core libraries used in Beta-1 of .NET
  -     * ommitting the blatantly non portable (MS.win32.interop)
  -     * and the .designer libraries. (ripping out Com was tempting)
  -     * Casing is chosen to match that of the file system <i>exactly</i>
  -     * so may work on a unix box too.
  +     *  using the path approach didnt work as it could not handle the implicit
  +     *  execution path. Perhaps that could be extracted from the runtime and
  +     *  then the path approach would be viable
  +     */
  +    private Path referenceFiles;
  +
  +    /**
  +     *  optimise flag
  +     */
  +    private boolean optimize;
  +
  +    /**
  +     *  file alignment; 0 means let the compiler decide
  +     */
  +    private int fileAlign=0;
  +
  +    /**
  +     *  Fix C# reference inclusion. C# is really dumb in how it handles
  +     *  inclusion. You have to list every 'assembly' -read DLL that is imported.
  +     *  So already you are making a platform assumption -shared libraries have a
  +     *  .dll;"+ extension and the poor developer has to know every library which
  +     *  is included why the compiler cant find classes on the path or in a
  +     *  directory, is a mystery. To reduce the need to be explicit, here is a
  +     *  long list of the core libraries used in Beta-1 of .NET ommitting the
  +     *  blatantly non portable (MS.win32.interop) and the .designer libraries.
  +     *  (ripping out Com was tempting) Casing is chosen to match that of the
  +     *  file system <i>exactly</i> so may work on a unix box too. there is no
  +     *  need to reference mscorlib.dll, cos it is always there
        */
   
       protected final static String DEFAULT_REFERENCE_LIST =
  @@ -260,6 +272,7 @@
               "Microsoft.VisualC.dll;" +
               "Microsoft.Vsa.dll;" +
               "Mscorcfg.dll;" +
  +            "office.dll;" +
               "RegCode.dll;" +
               "System.Configuration.Install.dll;" +
               "System.Data.dll;" +
  @@ -281,13 +294,148 @@
               "System.Windows.Forms.dll;" +
               "System.XML.dll;";
   
  +    /**
  +     *  debug flag. Controls generation of debug information.
  +     */
  +    protected boolean debug;
  +
  +    /**
  +     *  warning level: 0-4, with 4 being most verbose
  +     */
  +    private int warnLevel;
  +
  +    /**
  +     *  enable unsafe code flag. Clearly set to false by default
  +     */
  +    protected boolean unsafe;
  +
  +    /**
  +     *  main class (or null for automatic choice)
  +     */
  +    protected String mainClass;
  +
  +    /**
  +     *  any extra command options?
  +     */
  +    protected String extraOptions;
  +
  +    /**
  +     *  source directory upon which the search pattern is applied
  +     */
  +    private File srcDir;
  +
  +    /**
  +     *  destination directory (null means use the source directory) NB: this is
  +     *  currently not used
  +     */
  +    private File destDir;
  +
  +    /**
  +     *  type of target. Should be one of exe|library|module|winexe|(null)
  +     *  default is exe; the actual value (if not null) is fed to the command
  +     *  line. <br>
  +     *  See /target
  +     */
  +    protected String targetType;
  +
  +    /**
  +     *  utf out flag
  +     */
  +
  +    protected boolean utf8output = false;
   
       /**
  -     * get default reference list
  -     * @return null or a string of references.
  +     *  defines list something like 'RELEASE;WIN32;NO_SANITY_CHECKS;;SOMETHING_ELSE'
  +     */
  +    String definitions;
  +
  +    /**
  +     *  list of extra modules to refer to
  +     */
  +    String additionalModules;
  +
  +
  +    /**
  +     *  constructor inits everything and set up the search pattern
  +     */
  +
  +    public CSharp() {
  +        Clear();
  +        setIncludes(csc_file_pattern);
  +    }
  +
  +
  +    /**
  +     *  Set the reference list to be used for this compilation.
  +     *
  +     *@param  s  The new References value
  +     */
  +    public void setReferences(String s) {
  +        references = s;
  +    }
  +
  +
  +    /**
  +     *  get the reference string or null for no argument needed
  +     *
  +     *@return    The References Parameter to CSC
  +     */
  +    protected String getReferencesParameter() {
  +        //bail on no references
  +        if (notEmpty(references)) {
  +            return "/reference:" + references;
  +        } else {
  +            return null;
  +        }
  +    }
  +
  +    /**
  +     *  add another path to the reference file path list
  +     *
  +     *@param  path  another path to append
  +     */
  +    public void setReferenceFiles(Path path) {
  +        //demand create pathlist
  +        if (referenceFiles == null) {
  +            referenceFiles = new Path(this.project);
  +        }
  +        referenceFiles.append(path);
  +    }
  +
  +
  +    /**
  +     *  turn the path list into a list of files and a /references argument
  +     *
  +     *@return    null or a string of references.
  +     */
  +    protected String getReferenceFilesParameter() {
  +        //bail on no references
  +        if (references == null) {
  +            return null;
  +        }
  +        //iterate through the ref list & generate an entry for each
  +        //or just rely on the fact that the toString operator does this, but
  +        //noting that the separator is ';' on windows, ':' on unix
  +        String refpath = references.toString();
  +
  +        //bail on no references listed
  +        if (refpath.length() == 0) {
  +            return null;
  +        }
  +
  +        StringBuffer s = new StringBuffer("/reference:");
  +        s.append(refpath);
  +        return new String(s);
  +    }
  +
  +
  +    /**
  +     *  get default reference list
  +     *
  +     *@return    null or a string of references.
        */
       protected String getDefaultReferenceParameter() {
  -        if (_includeDefaultReferences) {
  +        if (includeDefaultReferences) {
               StringBuffer s = new StringBuffer("/reference:");
               s.append(DEFAULT_REFERENCE_LIST);
               return new String(s);
  @@ -296,556 +444,616 @@
           }
       }
   
  -    /** flag to enable automatic reference inclusion
  -     *
  -     */
  -    protected boolean _includeDefaultReferences;
   
  -    /** set the automatic reference inclusion flag on or off
  -     *  this flag controls the string of references and the
  -     *  /nostdlib option in CSC
  -     @param f on/off flag
  +    /**
  +     *  set the automatic reference inclusion flag on or off this flag controls
  +     *  the string of references and the /nostdlib option in CSC
  +     *
  +     *@param  f  on/off flag
        */
       public void setIncludeDefaultReferences(boolean f) {
  -        _includeDefaultReferences = f;
  +        includeDefaultReferences = f;
       }
   
  -    /** query the optimise flag
  -     @return true if optimise is turned on
  +
  +    /**
  +     *  query automatic reference inclusion flag
  +     *
  +     *@return    true if flag is turned on
        */
       public boolean getIncludeDefaultReferences() {
  -        return _includeDefaultReferences;
  +        return includeDefaultReferences;
       }
   
  +
       /**
        *  get the include default references flag or null for no argument needed
        *
  -     * @return    The Parameter to CSC
  +     *@return    The Parameter to CSC
        */
       protected String getIncludeDefaultReferencesParameter() {
  -        return "/nostdlib" + (_includeDefaultReferences?"-":"+");
  +        return "/nostdlib" + (includeDefaultReferences ? "-" : "+");
       }
   
  -    /** optimise flag
  -     */
  -    protected boolean _optimize;
   
  -    /** set the optimise flag on or off
  -     @param f on/off flag
  +
  +    /**
  +     *  set the optimise flag on or off
  +     *
  +     *@param  f  on/off flag
        */
       public void setOptimize(boolean f) {
  -        _optimize = f;
  +        optimize = f;
       }
   
  -    /** query the optimise flag
  -     @return true if optimise is turned on
  +
  +    /**
  +     *  query the optimise flag
  +     *
  +     *@return    true if optimise is turned on
        */
       public boolean getOptimize() {
  -        return _optimize;
  +        return optimize;
       }
   
  +
       /**
        *  get the optimise flag or null for no argument needed
        *
  -     * @return    The Optimize Parameter to CSC
  +     *@return    The Optimize Parameter to CSC
        */
       protected String getOptimizeParameter() {
  -        return "/optimize" + (_optimize?"+":"-");
  +        return "/optimize" + (optimize ? "+" : "-");
       }
   
  -    /** incremental build flag */
  -    protected boolean _incremental;
   
  -    /** set the incremental compilation flag on or off
  -     * @param f on/off flag
  +    /**
  +     *  set the incremental compilation flag on or off
  +     *
  +     *@param  f  on/off flag
        */
       public void setIncremental(boolean f) {
  -        _incremental = f;
  +        incremental = f;
       }
   
  -    /** query the incrementalflag
  -     * @return true iff incremental compilation is turned on
  +
  +    /**
  +     *  query the incrementalflag
  +     *
  +     *@return    true iff incremental compilation is turned on
        */
       public boolean getIncremental() {
  -        return _incremental;
  +        return incremental;
       }
   
  +
       /**
        *  get the incremental build argument
        *
  -     * @return    The Incremental Parameter to CSC
  +     *@return    The Incremental Parameter to CSC
        */
       protected String getIncrementalParameter() {
  -        return "/incremental" + (_incremental?"+":"-");
  +        return "/incremental" + (incremental ? "+" : "-");
       }
   
  -    /** debug flag. Controls generation of debug information.
  -     */
  -    protected boolean _debug;
   
  -    /** set the debug flag on or off
  -     * @param f on/off flag
  +    /**
  +     *  set the debug flag on or off
  +     *
  +     *@param  f  on/off flag
        */
       public void setDebug(boolean f) {
  -        _debug = f;
  +        debug = f;
       }
   
  -    /** query the debug flag
  -     * @return true if debug is turned on
  +
  +    /**
  +     *  query the debug flag
  +     *
  +     *@return    true if debug is turned on
        */
       public boolean getDebug() {
  -        return _debug;
  +        return debug;
       }
   
  +
       /**
        *  get the debug switch argument
        *
  -     * @return    The Debug Parameter to CSC
  +     *@return    The Debug Parameter to CSC
        */
       protected String getDebugParameter() {
  -        return "/debug" + (_debug?"+":"-");
  +        return "/debug" + (debug ? "+" : "-");
       }
   
  -    /** output XML documentation flag
  -     */
  -    protected File _docFile;
   
  -    /** file for generated XML documentation
  -     * @param f output file
  +
  +    /**
  +     *  file for generated XML documentation
  +     *
  +     *@param  f  output file
        */
       public void setDocFile(File f) {
  -        _docFile = f;
  +        docFile = f;
       }
   
  -    /** get the argument or null for no argument needed
  -     * @return    The DocFile Parameter to CSC
  +
  +    /**
  +     *  get the argument or null for no argument needed
  +     *
  +     *@return    The DocFile Parameter to CSC
        */
       protected String getDocFileParameter() {
  -        if (_docFile != null) {
  -            return "/doc:" + _docFile.toString();
  +        if (docFile != null) {
  +            return "/doc:" + docFile.toString();
           } else {
               return null;
           }
       }
   
  -    /** warning level: 0-4, with 4 being most verbose
  -     */
  -    private int _warnLevel;
   
  -    /** set warn level (no range checking)
  -     * @param warnLevel warn level -see .net docs for valid range (probably 0-4)
  +    /**
  +     *  set warn level (no range checking)
  +     *
  +     *@param  warnLevel  warn level -see .net docs for valid range (probably
  +     *      0-4)
        */
       public void setWarnLevel(int warnLevel) {
  -        this._warnLevel = warnLevel;
  +        this.warnLevel = warnLevel;
       }
   
  -    /** query warn level
  -     * @return current value
  +
  +    /**
  +     *  query warn level
  +     *
  +     *@return    current value
        */
       public int getWarnLevel() {
  -        return _warnLevel;
  +        return warnLevel;
       }
   
  +
       /**
        *  get the warn level switch
        *
  -     * @return    The WarnLevel Parameter to CSC
  +     *@return    The WarnLevel Parameter to CSC
        */
       protected String getWarnLevelParameter() {
  -        return "/warn:" + _warnLevel;
  +        return "/warn:" + warnLevel;
       }
   
  -    /** enable unsafe code flag. Clearly set to false by default
  -     */
  -    protected boolean _unsafe;
   
       /**
        *  Sets the Unsafe attribute
        *
  -     * @param  unsafe  The new Unsafe value
  +     *@param  unsafe  The new Unsafe value
        */
       public void setUnsafe(boolean unsafe) {
  -        this._unsafe = unsafe;
  +        this.unsafe = unsafe;
       }
   
  +
       /**
        *  query the Unsafe attribute
        *
  -     * @return    The Unsafe value
  +     *@return    The Unsafe value
        */
       public boolean getUnsafe() {
  -        return this._unsafe;
  +        return this.unsafe;
       }
   
  -    /** get the argument or null for no argument needed
  -     * @return    The Unsafe Parameter to CSC
  +
  +    /**
  +     *  get the argument or null for no argument needed
  +     *
  +     *@return    The Unsafe Parameter to CSC
        */
       protected String getUnsafeParameter() {
  -        return _unsafe?"/unsafe":null;
  +        return unsafe ? "/unsafe" : null;
       }
   
  -    /** main class (or null for automatic choice)
  -     */
  -    protected String _mainClass;
   
       /**
        *  Sets the MainClass attribute
        *
  -     * @param  mainClass  The new MainClass value
  +     *@param  mainClass  The new MainClass value
        */
       public void setMainClass(String mainClass) {
  -        this._mainClass = mainClass;
  +        this.mainClass = mainClass;
       }
   
  +
       /**
        *  Gets the MainClass attribute
        *
  -     * @return    The MainClass value
  +     *@return    The MainClass value
        */
       public String getMainClass() {
  -        return this._mainClass;
  +        return this.mainClass;
       }
   
  +
       /**
        *  get the /main argument or null for no argument needed
        *
  -     * @return    The MainClass Parameter to CSC
  +     *@return    The MainClass Parameter to CSC
        */
       protected String getMainClassParameter() {
  -        if (_mainClass != null && _mainClass.length() != 0) {
  -            return "/main:" + _mainClass;
  +        if (mainClass != null && mainClass.length() != 0) {
  +            return "/main:" + mainClass;
           } else {
               return null;
           }
       }
   
  -    /** any extra command options?
  -     */
  -    protected String _extraOptions;
   
       /**
        *  Sets the ExtraOptions attribute
        *
  -     * @param  extraOptions  The new ExtraOptions value
  +     *@param  extraOptions  The new ExtraOptions value
        */
       public void setExtraOptions(String extraOptions) {
  -        this._extraOptions = extraOptions;
  +        this.extraOptions = extraOptions;
       }
   
  +
       /**
        *  Gets the ExtraOptions attribute
        *
  -     * @return    The ExtraOptions value
  +     *@return    The ExtraOptions value
        */
       public String getExtraOptions() {
  -        return this._extraOptions;
  +        return this.extraOptions;
       }
   
  +
       /**
        *  get any extra options or null for no argument needed
        *
  -     * @return    The ExtraOptions Parameter to CSC
  +     *@return    The ExtraOptions Parameter to CSC
        */
       protected String getExtraOptionsParameter() {
  -        if (_extraOptions != null && _extraOptions.length() != 0) {
  -            return _extraOptions;
  +        if (extraOptions != null && extraOptions.length() != 0) {
  +            return extraOptions;
           } else {
               return null;
           }
       }
   
  -    /** source directory upon which the search pattern is applied
  -     */
  -    private File _srcDir;
   
       /**
  -     * Set the source dir to find the files to be compiled
  -     * @param  srcDirName  The new SrcDir value
  +     *  Set the source dir to find the files to be compiled
  +     *
  +     *@param  srcDirName  The new SrcDir value
        */
       public void setSrcDir(File srcDirName) {
  -        _srcDir = srcDirName;
  +        this.srcDir = srcDirName;
       }
   
  -    /** destination directory (null means use the source directory)
  -     * NB: this is currently not used
  -     */
  -    private File _destDir;
   
       /**
  -     * Set the destination dir to find the files to be compiled
  -     * @param  dirName  The new DestDir value
  +     *  Set the destination dir to find the files to be compiled
  +     *
  +     *@param  dirName  The new DestDir value
        */
       public void setDestDir(File dirName) {
  -        _destDir = dirName;
  +        this.destDir = dirName;
       }
   
  -    /** type of target. Should be one of exe|library|module|winexe|(null)
  -     default is exe; the actual value (if not null) is fed to the command line.
  -     <br>See /target
  -     */
  -    protected String _targetType;
   
  -    /** define the target
  -     * @param  targetType          The new TargetType value
  -     * @exception  BuildException  if target is not one of exe|library|module|winexe
  +    /**
  +     *  define the target
  +     *
  +     *@param  targetType          The new TargetType value
  +     *@exception  BuildException  if target is not one of
  +     *      exe|library|module|winexe
        */
       public void setTargetType(String targetType)
  -            throws BuildException {
  +             throws BuildException {
           targetType = targetType.toLowerCase();
           if (targetType.equals("exe") || targetType.equals("library") ||
                   targetType.equals("module") || targetType.equals("winexe")) {
  -            _targetType = targetType;
  +            targetType = targetType;
           } else {
               throw new BuildException("targetType " + targetType + " is not a valid type");
           }
       }
   
  +
       /**
        *  Gets the TargetType attribute
        *
  -     * @return    The TargetType value
  +     *@return    The TargetType value
        */
       public String getTargetType() {
  -        return _targetType;
  +        return targetType;
       }
   
  +
       /**
        *  get the argument or null for no argument needed
        *
  -     * @return    The TargetType Parameter to CSC
  +     *@return    The TargetType Parameter to CSC
        */
       protected String getTargetTypeParameter() {
  -        if (notEmpty(_targetType)) {
  -            return "/target:" + _targetType;
  +        if (notEmpty(targetType)) {
  +            return "/target:" + targetType;
           } else {
               return null;
           }
       }
   
  -    /** icon for incorporation into apps
  -     */
  -    protected File _win32icon;
   
       /**
  -     * Set the win32 icon
  -     * @param fileName path to the file. Can be relative, absolute, whatever.
  +     *  Set the win32 icon
  +     *
  +     *@param  fileName  path to the file. Can be relative, absolute, whatever.
        */
       public void setWin32Icon(File fileName) {
  -        _win32icon = fileName;
  +        win32icon = fileName;
       }
   
  +
       /**
        *  get the argument or null for no argument needed
        *
  -     * @return    The Win32Icon Parameter to CSC
  +     *@return    The Win32Icon Parameter to CSC
        */
       protected String getWin32IconParameter() {
  -        if (_win32icon != null) {
  -            return "/win32icon:" + _win32icon.toString();
  +        if (win32icon != null) {
  +            return "/win32icon:" + win32icon.toString();
           } else {
               return null;
           }
       }
   
  -    /** icon for incorporation into apps
  -     */
  -    protected File _win32res;
   
       /**
  -     * Set the win32 icon
  -     * @param fileName path to the file. Can be relative, absolute, whatever.
  +     *  Set the win32 resource
  +     *
  +     *@param  fileName  path to the file. Can be relative, absolute, whatever.
        */
       public void setWin32Res(File fileName) {
  -        _win32res = fileName;
  +        win32res = fileName;
       }
   
  +
       /**
        *  get the argument or null for no argument needed
        *
  -     * @return    The Win32Icon Parameter to CSC
  +     *@return    The Win32Res Parameter to CSC
        */
       protected String getWin32ResParameter() {
  -        if (_win32res != null) {
  -            return "/win32res:" + _win32res.toString();
  +        if (win32res != null) {
  +            return "/win32res:" + win32res.toString();
           } else {
               return null;
           }
       }
   
  -    /**
  -     * utf out flag
  -     */
  -
  -    protected boolean _utf8output = false;
   
       /**
  -     * enable generation of utf8 output from the compiler.
  +     *  enable generation of utf8 output from the compiler.
  +     *
  +     *@param  enabled  The new utf8Output value
        */
       public void setUtf8Output(boolean enabled) {
  -        _utf8output = enabled;
  +        utf8output = enabled;
       }
   
  -    protected String getUtf8OutpuParameter() {
  -        return _utf8output?"/utf8output":null;
  +
  +    /**
  +     *  Gets the utf8OutpuParameter attribute of the CSharp object
  +     *
  +     *@return    The utf8OutpuParameter value
  +     */
  +    protected String getUtf8OutputParameter() {
  +        return utf8output ? "/utf8output" : null;
       }
   
  -    protected boolean _noconfig = false;
   
  +    /**
  +     *  Sets the noConfig attribute of the CSharp object
  +     *
  +     *@param  enabled  The new noConfig value
  +     */
       protected void setNoConfig(boolean enabled) {
  -        _noconfig = enabled;
  +        noconfig = enabled;
       }
   
  +
  +    /**
  +     *  Gets the noConfigParameter attribute of the CSharp object
  +     *
  +     *@return    The noConfigParameter value
  +     */
       protected String getNoConfigParameter() {
  -        return _noconfig?"/noconfig":null;
  +        return noconfig ? "/noconfig" : null;
       }
   
  -    // /fullpaths
  -    protected boolean _fullpaths = false;
   
  +    /**
  +     *  Sets the fullPaths attribute of the CSharp object
  +     *
  +     *@param  enabled  The new fullPaths value
  +     */
       public void setFullPaths(boolean enabled) {
  -        _fullpaths = enabled;
  +        fullpaths = enabled;
       }
   
  +
  +    /**
  +     *  Gets the fullPathsParameter attribute of the CSharp object
  +     *
  +     *@return    The fullPathsParameter value
  +     */
       protected String getFullPathsParameter() {
  -        return _fullpaths?"/fullpaths":null;
  +        return fullpaths ? "/fullpaths" : null;
       }
   
  -    /** defines list
  -     * something like 'RELEASE;WIN32;NO_SANITY_CHECKS;;SOMETHING_ELSE'
  -     */
  -    String _definitions;
   
       /**
  -     * Set the definitions
  -     * @param list of definitions split by ; or , or even :
  +     *  Set the definitions
  +     *
  +     *@param  params  The new definitions value
        */
       public void setDefinitions(String params) {
  -        _definitions = params;
  +        definitions = params;
       }
   
  +
       /**
        *  get the argument or null for no argument needed
        *
  -     * @return    The Definitions Parameter to CSC
  +     *@return    The Definitions Parameter to CSC
        */
       protected String getDefinitionsParameter() {
  -        if (notEmpty(_definitions)) {
  -            return "/define:" + _definitions;
  +        if (notEmpty(definitions)) {
  +            return "/define:" + definitions;
           } else {
               return null;
           }
       }
   
  -    /** list of extra modules to refer to
  -     *
  -     */
  -    String _additionalModules;
   
       /**
  -     * Set the definitions
  -     * @param list of definitions split by ; or , or even :
  +     *  Set the definitions
  +     *
  +     *@param  params  The new additionalModules value
        */
       public void setAdditionalModules(String params) {
  -        _additionalModules = params;
  +        additionalModules = params;
       }
   
  -    /** get the argument or null for no argument needed
  -     * @return    The AdditionalModules Parameter to CSC
  +
  +    /**
  +     *  get the argument or null for no argument needed
  +     *
  +     *@return    The AdditionalModules Parameter to CSC
        */
       protected String getAdditionalModulesParameter() {
  -        if (notEmpty(_additionalModules)) {
  -            return "/addmodule:" + _additionalModules;
  +        if (notEmpty(additionalModules)) {
  +            return "/addmodule:" + additionalModules;
           } else {
               return null;
           }
       }
   
  -    /** output file. If not supplied this is derived from the
  -     *  source file
  -     */
  -    protected File _outputFile;
   
       /**
  -     * Set the definitions
  -     * @param list of definitions split by ; or , or even :
  +     *  Set the definitions
  +     *
  +     *@param  params  The new outputFile value
        */
       public void setOutputFile(File params) {
  -        _outputFile = params;
  +        outputFile = params;
       }
   
  -    /** get the argument or null for no argument needed
  -     * @return    The OutputFile Parameter to CSC
  +
  +    /**
  +     *  get the argument or null for no argument needed
  +     *
  +     *@return    The OutputFile Parameter to CSC
        */
       protected String getOutputFileParameter() {
  -        if (_outputFile != null) {
  -            File f = _outputFile;
  +        if (outputFile != null) {
  +            File f = outputFile;
               return "/out:" + f.toString();
           } else {
               return null;
           }
       }
   
  -    /** flag to control action on execution trouble
  -     */
  -    protected boolean _failOnError;
   
  -    /**set fail on error flag
  -     * @param  b  The new FailOnError value
  +    /**
  +     *  set fail on error flag
  +     *
  +     *@param  b  The new FailOnError value
        */
       public void setFailOnError(boolean b) {
  -        _failOnError = b;
  +        failOnError = b;
       }
   
  -    /** query fail on error flag
  -     * @return    The FailFailOnError value
  +
  +    /**
  +     *  query fail on error flag
  +     *
  +     *@return    The FailFailOnError value
        */
  -    public boolean getFailFailOnError() {
  -        return _failOnError;
  +    public boolean getFailOnError() {
  +        return failOnError;
       }
   
  -    /** reset all contents.
  +    /** set the file alignment.
  +     *  Valid values are 0,512, 1024, 2048, 4096, 8192, and 16384
  +     *  0 means 'leave to the compiler'
  +     */
  +    public void setFileAlign(int fileAlign) {
  +        this.fileAlign = fileAlign;
  +    }
  +
  +    /**
  +     *  get the argument or null for no argument needed
  +     *
  +     *@return    The OutputFile Parameter to CSC
  +     */
  +    protected String getFileAlignParameter() {
  +        if (fileAlign != 0) {
  +            return "/filealing:" + fileAlign;
  +        } else {
  +            return null;
  +        }
  +    }
  +    /**
  +     *  reset all contents.
        */
       public void Clear() {
  -        _targetType = null;
  -        _win32icon = null;
  -        _srcDir = null;
  -        _destDir = null;
  -        _mainClass = null;
  -        _unsafe = false;
  -        _warnLevel = 3;
  -        _docFile = null;
  -        _incremental = false;
  -        _optimize = false;
  -        _debug = true;
  -        _references = null;
  -        _failOnError = true;
  -        _definitions = null;
  -        _additionalModules = null;
  -        _includeDefaultReferences = true;
  -        _extraOptions = null;
  -        _fullpaths = true;
  +        targetType = null;
  +        win32icon = null;
  +        srcDir = null;
  +        destDir = null;
  +        mainClass = null;
  +        unsafe = false;
  +        warnLevel = 3;
  +        docFile = null;
  +        incremental = false;
  +        optimize = false;
  +        debug = true;
  +        references = null;
  +        failOnError = true;
  +        definitions = null;
  +        additionalModules = null;
  +        includeDefaultReferences = true;
  +        extraOptions = null;
  +        fullpaths = true;
  +        fileAlign=0;
       }
   
  +
       /**
        *  test for a string containing something useful
        *
  -     * @param  s  string in
  -     * @return    true if the argument is not null or empty
  +     *@param  s  string in
  +     *@return    true if the argument is not null or empty
        */
       protected boolean notEmpty(String s) {
           return s != null && s.length() != 0;
       }
   
  -    /** do the work by building the command line and then calling it
  +
  +    /**
  +     *  do the work by building the command line and then calling it
  +     *
  +     *@exception  BuildException  Description of the Exception
        */
       public void execute()
  -            throws BuildException {
  -        if (_srcDir == null) {
  -            _srcDir = project.resolveFile(".");
  +             throws BuildException {
  +        if (srcDir == null) {
  +            srcDir = project.resolveFile(".");
           }
   
           NetCommand command = new NetCommand(this, "CSC", csc_exe_name);
  -        command.setFailOnError(getFailFailOnError());
  +        command.setFailOnError(getFailOnError());
           //DEBUG helper
           command.setTraceCommandLine(true);
           //fill in args
  @@ -866,15 +1074,16 @@
           command.addArgument(getIncludeDefaultReferencesParameter());
           command.addArgument(getDefaultReferenceParameter());
           command.addArgument(getWin32ResParameter());
  -        command.addArgument(getUtf8OutpuParameter());
  +        command.addArgument(getUtf8OutputParameter());
           command.addArgument(getNoConfigParameter());
           command.addArgument(getFullPathsParameter());
           command.addArgument(getExtraOptionsParameter());
  +        command.addArgument(getFileAlignParameter());
   
           //get dependencies list.
  -        DirectoryScanner scanner = super.getDirectoryScanner(_srcDir);
  +        DirectoryScanner scanner = super.getDirectoryScanner(srcDir);
           String[] dependencies = scanner.getIncludedFiles();
  -        log("compiling " + dependencies.length + " file" + ((dependencies.length == 1)?"":"s"));
  +        log("compiling " + dependencies.length + " file" + ((dependencies.length == 1) ? "" : "s"));
           String baseDir = scanner.getBasedir().toString();
           //add to the command
           for (int i = 0; i < dependencies.length; i++) {
  @@ -885,6 +1094,8 @@
   
           //now run the command of exe + settings + files
           command.runCommand();
  -    } // end execute
  +    }
  +    // end execute
  +
  +}
   
  -} //end class
  
  
  
  1.14      +311 -239  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
  
  Index: Ilasm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Ilasm.java	25 Feb 2002 17:38:15 -0000	1.13
  +++ Ilasm.java	10 Apr 2002 00:39:20 -0000	1.14
  @@ -1,66 +1,64 @@
   /*
  - * The Apache Software License, Version 1.1
  + *  The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  - * reserved.
  + *  Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + *  reserved.
    *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Ant", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + *  Redistribution and use in source and binary forms, with or without
  + *  modification, are permitted provided that the following conditions
  + *  are met:
  + *
  + *  1. Redistributions of source code must retain the above copyright
  + *  notice, this list of conditions and the following disclaimer.
  + *
  + *  2. Redistributions in binary form must reproduce the above copyright
  + *  notice, this list of conditions and the following disclaimer in
  + *  the documentation and/or other materials provided with the
  + *  distribution.
  + *
  + *  3. The end-user documentation included with the redistribution, if
  + *  any, must include the following acknowlegement:
  + *  "This product includes software developed by the
  + *  Apache Software Foundation (http://www.apache.org/)."
  + *  Alternately, this acknowlegement may appear in the software itself,
  + *  if and wherever such third-party acknowlegements normally appear.
  + *
  + *  4. The names "The Jakarta Project", "Ant", and "Apache Software
  + *  Foundation" must not be used to endorse or promote products derived
  + *  from this software without prior written permission. For written
  + *  permission, please contact apache@apache.org.
  + *
  + *  5. Products derived from this software may not be called "Apache"
  + *  nor may "Apache" appear in their names without prior written
  + *  permission of the Apache Group.
  + *
  + *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + *  DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + *  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + *  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + *  SUCH DAMAGE.
  + *  ====================================================================
  + *
  + *  This software consists of voluntary contributions made by many
  + *  individuals on behalf of the Apache Software Foundation.  For more
  + *  information on the Apache Software Foundation, please see
  + *  <http://www.apache.org/>.
  + */
  +/*
  + *  build notes
  + *  -The reference CD to listen to while editing this file is
  + *  nap: Underworld  - Everything, Everything
  + *  -variable naming policy from Fowler's refactoring book.
  + *  -tested against the PDC pre-beta of csc.exe; future versions will
  + *  inevitably change things
    */
  -
  -/* build notes
  -
  -   -The reference CD to listen to while editing this file is
  -       nap: Underworld  - Everything, Everything
  -   -variable naming policy from Fowler's refactoring book.
  -   -tested against the PDC pre-beta of csc.exe; future versions will
  -    inevitably change things
  -*/
  -
   // ====================================================================
   // place in the optional ant tasks package
   // but in its own dotnet group
  @@ -79,134 +77,187 @@
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.MatchingTask;
   
  -
   /**
  -Task to assemble .net 'Intermediate Language' files.
  -The task will only work on win2K until other platforms support csc.exe or
  -an equivalent. ilasm.exe must be on the execute path too.
  -<p>
  -
  -<p>
  -All parameters are optional: &lt;il/&gt; should suffice to produce a debug
  -build of all *.il files.
  -The option set is roughly compatible with the CSharp class;
  -even though the command line options are only vaguely
  -equivalent. [The low level commands take things like /OUT=file,
  -csc wants /out:file ... /verbose is used some places; /quiet here in
  -ildasm... etc.] It would be nice if someone made all the command line
  -tools consistent (and not as brittle as the java cmdline tools)
  -
  -
  -<p>
  -
  -The task is a directory based task, so attributes like <b>includes="*.il"</b> and
  -<b>excludes="broken.il"</b> can be used to control the files pulled in.
  -Each file is built on its own, producing an appropriately named output file unless
  -manually specified with <b>outfile</b>
  -
  -
  - @author Steve Loughran steve_l@iseran.com
  - @version 0.2
  + *  Task to assemble .net 'Intermediate Language' files. The task will only work
  + *  on win2K until other platforms support csc.exe or an equivalent. ilasm.exe
  + *  must be on the execute path too. <p>
  + *
  + *  <p>
  + *
  + *  All parameters are optional: &lt;il/&gt; should suffice to produce a debug
  + *  build of all *.il files. The option set is roughly compatible with the
  + *  CSharp class; even though the command line options are only vaguely
  + *  equivalent. [The low level commands take things like /OUT=file, csc wants
  + *  /out:file ... /verbose is used some places; /quiet here in ildasm... etc.]
  + *  It would be nice if someone made all the command line tools consistent (and
  + *  not as brittle as the java cmdline tools) <p>
  + *
  + *  The task is a directory based task, so attributes like <b>includes="*.il"
  + *  </b> and <b>excludes="broken.il"</b> can be used to control the files pulled
  + *  in. Each file is built on its own, producing an appropriately named output
  + *  file unless manually specified with <b>outfile</b>
  + *
  + *@author     Steve Loughran steve_l@iseran.com
  + *@version    0.5
    */
   
  -
   public class Ilasm
  -        extends MatchingTask {
  +         extends MatchingTask {
   
  -    /** constructor inits everything and set up the search pattern
  -     */
  -    public Ilasm() {
  -        Clear();
  -        setIncludes(file_pattern);
  -    }
  -
  -    /** 
  -     * Name of the executable. The .exe suffix is deliberately not included
  -     * in anticipation of the unix version
  +    /**
  +     *  Name of the executable. The .exe suffix is deliberately not included in
  +     *  anticipation of the unix version
        */
       protected final static String exe_name = "ilasm";
   
  -    /** what is the file extension we search on?
  +    /**
  +     *  what is the file extension we search on?
        */
       protected final static String file_ext = "il";
   
  -    /** and now derive the search pattern from the extension
  +    /**
  +     *  and now derive the search pattern from the extension
        */
       protected final static String file_pattern = "**/*." + file_ext;
   
  -    /** title of task for external presentation
  +    /**
  +     *  title of task for external presentation
        */
       protected final static String exe_title = "ilasm";
   
  -    /** reset all contents.
  +    /**
  +     *  source directory upon which the search pattern is applied
        */
  -    public void Clear() {
  -        _targetType = null;
  -        _srcDir = null;
  -        _listing = false;
  -        _verbose = false;
  -        _debug = true;
  -        _outputFile = null;
  -        _failOnError = true;
  -        _resourceFile = null;
  -        _extraOptions = null;
  -    }
  +    private File srcDir;
   
  -    /** source directory upon which the search pattern is applied
  +    /**
  +     *  type of target. Should be one of exe|library|module|winexe|(null)
  +     *  default is exe; the actual value (if not null) is fed to the command
  +     *  line. <br>
  +     *  See /target
        */
  -    private File _srcDir;
  +    protected String targetType;
   
       /**
  -     * Set the source dir to find the files to be compiled
  -     * @param  srcDirName  The new SrcDir value
  +     *  verbose flag
        */
  -    public void setSrcDir(File srcDirName) {
  -        _srcDir = srcDirName;
  +    protected boolean verbose;
  +
  +    /**
  +     *  listing flag
  +     */
  +
  +    protected boolean listing;
  +
  +    /**
  +     *  output file. If not supplied this is derived from the source file
  +     */
  +    protected File outputFile;
  +
  +    /**
  +     *  resource file (.res format) to include in the app.
  +     */
  +    protected File resourceFile;
  +
  +    /**
  +     *  flag to control action on execution trouble
  +     */
  +    protected boolean failOnError;
  +
  +    /**
  +     *  debug flag. Controls generation of debug information.
  +     */
  +    protected boolean debug;
  +
  +    /**
  +     *  file containing private key
  +     */
  +
  +    private File keyfile;
  +
  +    /**
  +     *  any extra command options?
  +     */
  +    protected String extraOptions;
  +
  +
  +    /**
  +     *  constructor inits everything and set up the search pattern
  +     */
  +    public Ilasm() {
  +        Clear();
  +        setIncludes(file_pattern);
  +    }
  +
  +
  +    /**
  +     *  reset all contents.
  +     */
  +    public void Clear() {
  +        targetType = null;
  +        srcDir = null;
  +        listing = false;
  +        verbose = false;
  +        debug = true;
  +        outputFile = null;
  +        failOnError = true;
  +        resourceFile = null;
  +        extraOptions = null;
       }
   
   
  -    /** type of target. Should be one of exe|library|module|winexe|(null)
  -     default is exe; the actual value (if not null) is fed to the command line.
  -     <br>See /target
  +    /**
  +     *  Set the source dir to find the files to be compiled
  +     *
  +     *@param  srcDirName  The new SrcDir value
        */
  -    protected String _targetType;
  +    public void setSrcDir(File srcDirName) {
  +        srcDir = srcDirName;
  +    }
  +
   
  -    /** define the target
  -     * @param  targetType          one of exe|library|
  -     * @exception BuildException if target is not one of exe|library|module|winexe
  +    /**
  +     *  define the target
  +     *
  +     *@param  targetType          one of exe|library|
  +     *@exception  BuildException  if target is not one of
  +     *      exe|library|module|winexe
        */
   
       public void setTargetType(String targetType)
  -            throws BuildException {
  +             throws BuildException {
           targetType = targetType.toLowerCase();
           if (targetType.equals("exe") || targetType.equals("library")) {
  -            _targetType = targetType;
  +            targetType = targetType;
           } else {
               throw new BuildException("targetType " + targetType + " is not a valid type");
           }
       }
   
  +
       /**
  -     * accessor method for target type
  -     * @return the current target option
  +     *  accessor method for target type
  +     *
  +     *@return    the current target option
        */
       public String getTargetType() {
  -        return _targetType;
  +        return targetType;
       }
   
  -    /** g
  -     *  get the target type or null for no argument needed
  +
  +    /**
  +     *  g get the target type or null for no argument needed
        *
  -     * @return    The TargetTypeParameter value
  +     *@return    The TargetTypeParameter value
        */
   
       protected String getTargetTypeParameter() {
  -        if (!notEmpty(_targetType)) {
  +        if (!notEmpty(targetType)) {
               return null;
           }
  -        if (_targetType.equals("exe")) {
  +        if (targetType.equals("exe")) {
               return "/exe";
  -        } else if (_targetType.equals("library")) {
  +        } else if (targetType.equals("library")) {
               return "/dll";
           } else {
               return null;
  @@ -217,219 +268,237 @@
       /**
        *  Sets the Owner attribute
        *
  -     * @param  s  The new Owner value
  +     *@param  s  The new Owner value
        */
   
       public void setOwner(String s) {
           log("This option is not supported by ILASM as of Beta-2, and will be ignored", Project.MSG_WARN);
       }
   
  -    /** test for a string containing something useful
  -     * @param string to test
  -     * @return true if the argument is not null or empty
  +
  +    /**
  +     *  test for a string containing something useful
  +     *
  +     *@param  s       any string
  +     *@return         true if the argument is not null or empty
        */
       protected boolean notEmpty(String s) {
           return s != null && s.length() != 0;
       }
   
  -    /** verbose flag
  -     */
  -    protected boolean _verbose;
   
       /**
  -     * enable/disable verbose ILASM output
  -     * @param b flag set to true for verbose on
  +     *  enable/disable verbose ILASM output
  +     *
  +     *@param  b  flag set to true for verbose on
        */
       public void setVerbose(boolean b) {
  -        _verbose = b;
  +        verbose = b;
       }
   
  +
       /**
  -     * turn the verbose flag into a parameter for ILASM
  -     * @return null or the appropriate command line string
  +     *  turn the verbose flag into a parameter for ILASM
  +     *
  +     *@return    null or the appropriate command line string
        */
       protected String getVerboseParameter() {
  -        return _verbose?null:"/quiet";
  +        return verbose ? null : "/quiet";
       }
   
   
  -    /** listing flag
  -     */
  -
  -    protected boolean _listing;
  -
       /**
  -     * enable/disable listing
  -     * @param b flag set to true for listing on
  +     *  enable/disable listing
  +     *
  +     *@param  b  flag set to true for listing on
        */
       public void setListing(boolean b) {
  -        _listing = b;
  +        listing = b;
       }
   
  +
       /**
  -     * turn the listing flag into a parameter for ILASM
  -     * @return the appropriate string from the state of the listing flag
  +     *  turn the listing flag into a parameter for ILASM
  +     *
  +     *@return    the appropriate string from the state of the listing flag
        */
       protected String getListingParameter() {
  -        return _listing?"/listing":"/nolisting";
  +        return listing ? "/listing" : "/nolisting";
       }
   
   
       /**
  -     * output file. If not supplied this is derived from the
  -     *  source file
  -     */
  -    protected File _outputFile;
  -
  -    /**
  -     * Set the definitions
  -     * @param list of definitions split by ; or , or even :
  +     *  Set the output file
  +     *
  +     *@param  params  The new outputFile value
        */
       public void setOutputFile(File params) {
  -        _outputFile = params;
  +        outputFile = params;
       }
   
  +
       /**
  -     * get the output file
  -     * @return the argument string or null for no argument
  +     *  get the output file
  +     *
  +     *@return    the argument string or null for no argument
        */
       protected String getOutputFileParameter() {
  -        if (_outputFile == null || _outputFile.length() == 0) {
  +        if (outputFile == null || outputFile.length() == 0) {
               return null;
           }
  -        File f = _outputFile;
  +        File f = outputFile;
           return "/output=" + f.toString();
       }
   
  -    /** resource file (.res format) to include in the app.
  -     */
  -    protected File _resourceFile;
   
       /**
  -     * Set the resource file
  -     * @param fileName path to the file. Can be relative, absolute, whatever.
  +     *  Set the resource file
  +     *
  +     *@param  fileName  path to the file. Can be relative, absolute, whatever.
        */
       public void setResourceFile(File fileName) {
  -        _resourceFile = fileName;
  +        resourceFile = fileName;
       }
   
  +
  +    /**
  +     *  Gets the resourceFileParameter attribute of the Ilasm task
  +     *
  +     *@return    The resourceFileParameter value
  +     */
       protected String getResourceFileParameter() {
  -        if (_resourceFile != null) {
  -            return "/resource=" + _resourceFile.toString();
  +        if (resourceFile != null) {
  +            return "/resource=" + resourceFile.toString();
           } else {
               return null;
           }
       }
   
  -    /** flag to control action on execution trouble
  -     */
  -    protected boolean _failOnError;
   
  -    /**set fail on error flag
  +    /**
  +     *  set fail on error flag
  +     *
  +     *@param  b  The new failOnError value
        */
       public void setFailOnError(boolean b) {
  -        _failOnError = b;
  +        failOnError = b;
       }
   
  -    /** query fail on error flag
  +
  +    /**
  +     *  query fail on error flag
  +     *
  +     *@return    The failFailOnError value
        */
       public boolean getFailFailOnError() {
  -        return _failOnError;
  +        return failOnError;
       }
   
  -    /** debug flag. Controls generation of debug information.
  -     */
  -    protected boolean _debug;
   
  -    /** set the debug flag on or off
  -     * @param f on/off flag
  +    /**
  +     *  set the debug flag on or off
  +     *
  +     *@param  f  on/off flag
        */
       public void setDebug(boolean f) {
  -        _debug = f;
  +        debug = f;
       }
   
  -    /** query the debug flag
  -     * @return true if debug is turned on
  +
  +    /**
  +     *  query the debug flag
  +     *
  +     *@return    true if debug is turned on
        */
       public boolean getDebug() {
  -        return _debug;
  +        return debug;
       }
   
  -    /** get the argument or null for no argument needed
  +
  +    /**
  +     *  get the argument or null for no argument needed
  +     *
  +     *@return    The debugParameter value
        */
       protected String getDebugParameter() {
  -        return _debug?"/debug":null;
  +        return debug ? "/debug" : null;
       }
   
  -    /** file containing private key
  -     */
  -
  -    private File _keyfile;
   
  +    /**
  +     *  Sets the keyfile attribute of the Ilasm object
  +     *
  +     *@param  keyfile  The new keyfile value
  +     */
       public void setKeyfile(File keyfile) {
  -        this._keyfile = keyfile;
  +        this.keyfile = keyfile;
       }
   
  -    /** get the argument or null for no argument needed
  +
  +    /**
  +     *  get the argument or null for no argument needed
  +     *
  +     *@return    The keyfileParameter value
        */
       protected String getKeyfileParameter() {
  -        if (_keyfile != null) {
  -            return "/keyfile:" + _keyfile.toString();
  +        if (keyfile != null) {
  +            return "/keyfile:" + keyfile.toString();
           } else {
               return null;
           }
       }
   
  -    /** any extra command options?
  -     */
  -    protected String _extraOptions;
   
       /**
        *  Sets the ExtraOptions attribute
        *
  -     * @param  extraOptions  The new ExtraOptions value
  +     *@param  extraOptions  The new ExtraOptions value
        */
       public void setExtraOptions(String extraOptions) {
  -        this._extraOptions = extraOptions;
  +        this.extraOptions = extraOptions;
       }
   
  +
       /**
        *  Gets the ExtraOptions attribute
        *
  -     * @return    The ExtraOptions value
  +     *@return    The ExtraOptions value
        */
       public String getExtraOptions() {
  -        return this._extraOptions;
  +        return this.extraOptions;
       }
   
  +
       /**
        *  get any extra options or null for no argument needed
        *
  -     * @return    The ExtraOptions Parameter to CSC
  +     *@return    The ExtraOptions Parameter to CSC
        */
       protected String getExtraOptionsParameter() {
  -        if (_extraOptions != null && _extraOptions.length() != 0) {
  -            return _extraOptions;
  +        if (extraOptions != null && extraOptions.length() != 0) {
  +            return extraOptions;
           } else {
               return null;
           }
       }
   
   
  -    /** This is the execution entry point. Build a list of files and
  -     *  call ilasm on each of them.
  -     * @throws BuildException if the assembly failed and FailOnError is true
  +    /**
  +     *  This is the execution entry point. Build a list of files and call ilasm
  +     *  on each of them.
  +     *
  +     *@throws  BuildException  if the assembly failed and FailOnError is true
        */
       public void execute()
  -            throws BuildException {
  -        if (_srcDir == null) {
  -            _srcDir = project.resolveFile(".");
  +             throws BuildException {
  +        if (srcDir == null) {
  +            srcDir = project.resolveFile(".");
           }
   
           //get dependencies list.
  -        DirectoryScanner scanner = super.getDirectoryScanner(_srcDir);
  +        DirectoryScanner scanner = super.getDirectoryScanner(srcDir);
           String[] dependencies = scanner.getIncludedFiles();
  -        log("assembling " + dependencies.length + " file" + ((dependencies.length == 1)?"":"s"));
  +        log("assembling " + dependencies.length + " file" + ((dependencies.length == 1) ? "" : "s"));
           String baseDir = scanner.getBasedir().toString();
           //add to the command
           for (int i = 0; i < dependencies.length; i++) {
  @@ -438,16 +507,18 @@
               executeOneFile(targetFile);
           }
   
  -    } // end execute
  +    }
  +    // end execute
   
   
       /**
  -     * do the work for one file by building the command line then calling it
  -     * @param targetFile name of the the file to assemble
  -     * @throws BuildException if the assembly failed and FailOnError is true
  +     *  do the work for one file by building the command line then calling it
  +     *
  +     *@param  targetFile       name of the the file to assemble
  +     *@throws  BuildException  if the assembly failed and FailOnError is true
        */
       public void executeOneFile(String targetFile)
  -            throws BuildException {
  +             throws BuildException {
           NetCommand command = new NetCommand(this, exe_title, exe_name);
           command.setFailOnError(getFailFailOnError());
           //DEBUG helper
  @@ -462,14 +533,15 @@
           command.addArgument(getKeyfileParameter());
           command.addArgument(getExtraOptionsParameter());
   
  -
  -        /* space for more argumentativeness
  -           command.addArgument();
  -           command.addArgument();
  -        */
  -
  +        /*
  +         *  space for more argumentativeness
  +         *  command.addArgument();
  +         *  command.addArgument();
  +         */
           command.addArgument(targetFile);
           //now run the command of exe + settings + file
           command.runCommand();
  -    } // end executeOneFile
  -} //class
  +    }
  +    // end executeOneFile
  +}
  +
  
  
  
  1.10      +157 -129  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  
  Index: NetCommand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NetCommand.java	25 Feb 2002 17:38:15 -0000	1.9
  +++ NetCommand.java	10 Apr 2002 00:39:20 -0000	1.10
  @@ -1,64 +1,62 @@
   /*
  - * The Apache Software License, Version 1.1
  + *  The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000,2002 The Apache Software Foundation.  All rights
  - * reserved.
  + *  Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + *  reserved.
    *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Ant", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + *  Redistribution and use in source and binary forms, with or without
  + *  modification, are permitted provided that the following conditions
  + *  are met:
  + *
  + *  1. Redistributions of source code must retain the above copyright
  + *  notice, this list of conditions and the following disclaimer.
  + *
  + *  2. Redistributions in binary form must reproduce the above copyright
  + *  notice, this list of conditions and the following disclaimer in
  + *  the documentation and/or other materials provided with the
  + *  distribution.
  + *
  + *  3. The end-user documentation included with the redistribution, if
  + *  any, must include the following acknowlegement:
  + *  "This product includes software developed by the
  + *  Apache Software Foundation (http://www.apache.org/)."
  + *  Alternately, this acknowlegement may appear in the software itself,
  + *  if and wherever such third-party acknowlegements normally appear.
  + *
  + *  4. The names "The Jakarta Project", "Ant", and "Apache Software
  + *  Foundation" must not be used to endorse or promote products derived
  + *  from this software without prior written permission. For written
  + *  permission, please contact apache@apache.org.
  + *
  + *  5. Products derived from this software may not be called "Apache"
  + *  nor may "Apache" appear in their names without prior written
  + *  permission of the Apache Group.
  + *
  + *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + *  DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + *  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + *  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + *  SUCH DAMAGE.
  + *  ====================================================================
  + *
  + *  This software consists of voluntary contributions made by many
  + *  individuals on behalf of the Apache Software Foundation.  For more
  + *  information on the Apache Software Foundation, please see
  + *  <http://www.apache.org/>.
    */
  -
  -/* build notes
  -
  -The reference CD to listen to while editing this file is
  -Underworld Everything, Everything
  -variable naming policy from Fowler's refactoring book.
  +/*
  + *  build notes
  + *  The reference CD to listen to while editing this file is
  + *  Underworld Everything, Everything
  + *  variable naming policy from Fowler's refactoring book.
    */
  -
   // place below the optional ant tasks package
   
   package org.apache.tools.ant.taskdefs.optional.dotnet;
  @@ -76,150 +74,180 @@
   import org.apache.tools.ant.taskdefs.LogStreamHandler;
   import org.apache.tools.ant.types.Commandline;
   
  -
   /**
  -This is a helper class to spawn net commands out.
  -In its initial form it contains no .net specifics, just contains
  -all the command line/exe construction stuff. However, it may be handy in future
  -to have a means of setting the path to point to the dotnet bin directory; in which
  -case the shared code should go in here.
  - @author Steve Loughran steve_l@iseran.com
  - @version 0.3
  + *  This is a helper class to spawn net commands out. In its initial form it
  + *  contains no .net specifics, just contains all the command line/exe
  + *  construction stuff. However, it may be handy in future to have a means of
  + *  setting the path to point to the dotnet bin directory; in which case the
  + *  shared code should go in here.
  + *
  + *@author     Steve Loughran steve_l@iseran.com
  + *@version    0.5
    */
   
   public class NetCommand {
   
  -    /** constructor
  -     @param owning task
  -     @param title (for logging/errors)
  -     @param executable. Leave off the '.exe. for future portability
  +    /**
  +     *  owner project
        */
  +    protected Task owner;
   
  -    public NetCommand(Task owner, String title, String program) {
  -        _owner = owner;
  -        _title = title;
  -        _program = program;
  -        _commandLine = new Commandline();
  -        _commandLine.setExecutable(_program);
  -        prepareExecutor();
  -    }
  +    /**
  +     *  executabe
  +     */
  +    protected Execute executable;
   
  -    /** owner project
  +    /**
  +     *  what is the command line
        */
  -    protected Task _owner;
  +    protected Commandline commandLine;
   
  -    /** executabe
  +    /**
  +     *  title of the command
        */
  -    protected Execute _exe;
  +    protected String title;
   
  -    /** what is the command line
  +    /**
  +     *  actual program to invoke
        */
  -    protected Commandline _commandLine;
  +    protected String program;
   
  -    /** title of the command
  +    /**
  +     *  trace flag
        */
  -    protected String _title;
  +    protected boolean traceCommandLine = false;
   
  -    /** actual program to invoke
  +    /**
  +     *  flag to control action on execution trouble
        */
  -    protected String _program;
  +    protected boolean failOnError;
   
  -    /** trace flag
  +
  +    /**
  +     *  constructor
  +     *
  +     *@param  title        (for logging/errors)
  +     *@param  owner        owner task
  +     *@param  program      app we are to run
        */
  -    protected boolean _traceCommandLine = false;
  +
  +    public NetCommand(Task owner, String title, String program) {
  +        owner = owner;
  +        title = title;
  +        program = program;
  +        commandLine = new Commandline();
  +        commandLine.setExecutable(program);
  +        prepareExecutor();
  +    }
  +
   
       /**
  -     * turn tracing on or off
  -     * @param b trace flag
  +     *  turn tracing on or off
  +     *
  +     *@param  b  trace flag
        */
       public void setTraceCommandLine(boolean b) {
  -        _traceCommandLine = b;
  +        traceCommandLine = b;
       }
   
  -    /** flag to control action on execution trouble
  -     */
  -    protected boolean _failOnError;
   
       /**
  -     * set fail on error flag
  -     * @param b fail flag -set to true to cause an exception to be raised if
  -     * the return value != 0
  +     *  set fail on error flag
  +     *
  +     *@param  b  fail flag -set to true to cause an exception to be raised if
  +     *      the return value != 0
        */
       public void setFailOnError(boolean b) {
  -        _failOnError = b;
  +        failOnError = b;
       }
   
  -    /** query fail on error flag
  +
  +    /**
  +     *  query fail on error flag
  +     *
  +     *@return    The failFailOnError value
        */
       public boolean getFailFailOnError() {
  -        return _failOnError;
  +        return failOnError;
       }
   
  +
       /**
  -     * verbose text log
  -     * @param msg string to add to log iff verbose is defined for the build
  +     *  verbose text log
  +     *
  +     *@param  msg  string to add to log iff verbose is defined for the build
        */
       protected void logVerbose(String msg) {
  -        _owner.getProject().log(msg, Project.MSG_VERBOSE);
  +        owner.getProject().log(msg, Project.MSG_VERBOSE);
       }
   
   
       /**
  -     * error text log
  -     * @param  msg  message to display as an error
  +     *  error text log
  +     *
  +     *@param  msg  message to display as an error
        */
       protected void logError(String msg) {
  -        _owner.getProject().log(msg, Project.MSG_ERR);
  +        owner.getProject().log(msg, Project.MSG_ERR);
       }
   
  +
       /**
  -     * add an argument to a command line; do nothing if the arg is null or empty string
  -     * @param  argument  The feature to be added to the Argument attribute
  +     *  add an argument to a command line; do nothing if the arg is null or
  +     *  empty string
  +     *
  +     *@param  argument  The feature to be added to the Argument attribute
        */
       public void addArgument(String argument) {
           if (argument != null && argument.length() != 0) {
  -            _commandLine.createArgument().setValue(argument);
  +            commandLine.createArgument().setValue(argument);
           }
       }
   
  +
       /**
  -     * set up the command sequence..
  +     *  set up the command sequence..
        */
       protected void prepareExecutor() {
           // default directory to the project's base directory
  -        File dir = _owner.getProject().getBaseDir();
  -        ExecuteStreamHandler handler = new LogStreamHandler(_owner,
  +        File dir = owner.getProject().getBaseDir();
  +        ExecuteStreamHandler handler = new LogStreamHandler(owner,
                   Project.MSG_INFO, Project.MSG_WARN);
  -        _exe = new Execute(handler, null);
  -        _exe.setAntRun(_owner.getProject());
  -        _exe.setWorkingDirectory(dir);
  +        executable = new Execute(handler, null);
  +        executable.setAntRun(owner.getProject());
  +        executable.setWorkingDirectory(dir);
       }
   
  +
       /**
  -     * Run the command using the given Execute instance.
  -     * @throws an exception of something goes wrong and the failOnError flag is true
  +     *  Run the command using the given Execute instance.
  +     *
  +     *@exception  BuildException  iff something goes wrong and the
  +     *      failOnError flag is true
        */
       public void runCommand()
  -            throws BuildException {
  -        int err = -1; // assume the worst
  +             throws BuildException {
  +        int err = -1;
  +        // assume the worst
           try {
  -            if (_traceCommandLine) {
  -                _owner.log(_commandLine.toString());
  +            if (traceCommandLine) {
  +                owner.log(commandLine.toString());
               } else {
                   //in verbose mode we always log stuff
  -                logVerbose(_commandLine.toString());
  +                logVerbose(commandLine.toString());
               }
  -            _exe.setCommandline(_commandLine.getCommandline());
  -            err = _exe.execute();
  +            executable.setCommandline(commandLine.getCommandline());
  +            err = executable.execute();
               if (err != 0) {
  -                if (_failOnError) {
  -                    throw new BuildException(_title + " returned: " + err, _owner.getLocation());
  +                if (failOnError) {
  +                    throw new BuildException(title + " returned: " + err, owner.getLocation());
                   } else {
  -                    _owner.log(_title + "  Result: " + err, Project.MSG_ERR);
  +                    owner.log(title + "  Result: " + err, Project.MSG_ERR);
                   }
               }
           } catch (IOException e) {
  -            throw new BuildException(_title + " failed: " + e, e, _owner.getLocation());
  +            throw new BuildException(title + " failed: " + e, e, owner.getLocation());
           }
       }
  -} //class
  +}
  +
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message