You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by st...@apache.org on 2003/09/24 02:58:29 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet CSharp.java Ilasm.java Ildasm.java ImportTypelib.java JSharp.java VisualBasicCompile.java WsdlToDotnet.java

stevel      2003/09/23 17:58:29

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        CSharp.java Ilasm.java Ildasm.java
                        ImportTypelib.java JSharp.java
                        VisualBasicCompile.java WsdlToDotnet.java
  Log:
  doc updates in the tasks, for autogenerated docs
  
  Revision  Changes    Path
  1.37      +43 -67    ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  
  Index: CSharp.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- CSharp.java	20 Sep 2003 16:40:42 -0000	1.36
  +++ CSharp.java	24 Sep 2003 00:58:29 -0000	1.37
  @@ -75,81 +75,57 @@
   /**
    *  Compiles C# 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>
  - *
  + * csc.exe must be on the execute path, unless another executable
  + * or the full path to that executable is specified in the <tt>executable</tt>
  + * parameter
  + * <p>
  + * All parameters are optional: &lt;csc/&gt; should suffice to produce a debug
  + * build of all *.cs files. However, naming an <tt>destFile</tt>stops the
  + * csc compiler from choosing an output name from random, and
  + * allows the dependency checker to determine if the file is out of date.
  + * <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>
  + *  Specifying the output file with <tt>destFile</tt> seems prudent. <p>
    *
  - *        </table>
  + * <p>
  + * For more complex source trees, nested <tt>src</tt> elemements can be
  + * supplied. When such an element is present, the implicit fileset is ignored.
  + * This makes sense, when you think about it :)
  + * <p>
  + *
  + * References to external files can be made through the references attribute,
  + * or (since Ant1.6), via nested &lt;reference&gt; filesets. With the latter,
  + * the timestamps of the references are also used in the dependency
  + * checking algorithm.
  + * <p>
  + *
  + * Example
  + *
  + * <pre>&lt;csc
  + * 	optimize=&quot;true&quot;
  + * 	debug=&quot;false&quot;
  + * 	docFile=&quot;documentation.xml&quot;
  + * 	warnLevel=&quot;4&quot;
  + * 	unsafe=&quot;false&quot;
  + * 	targetType=&quot;exe&quot;
  + * 	incremental=&quot;false&quot;
  + * 	mainClass = &quot;MainApp&quot;
  + * 	destFile=&quot;NetApp.exe&quot;
  + * 	&gt;
  + * 	     &lt;src dir="src" includes="*.cs" /&gt;
  + *       &lt;reference file="${testCSC.dll}" /&gt;
  + *       &lt;define name="RELEASE" /&gt;
  + *       &lt;define name="DEBUG" if="debug.property"/&gt;
  + *       &lt;define name="def3" unless="def3.property"/&gt;
  + *    &lt;/csc&gt;
  + * </pre>
    *
    *
  - * @author      Steve Loughran steve_l@iseran.com
  - * @version     0.5
  + * @author      Steve Loughran
    * @ant.task    name="csc" category="dotnet"
    * @since Ant 1.3
    */
  
  
  
  1.32      +8 -6      ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
  
  Index: Ilasm.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- Ilasm.java	23 Sep 2003 06:28:33 -0000	1.31
  +++ Ilasm.java	24 Sep 2003 00:58:29 -0000	1.32
  @@ -69,9 +69,11 @@
   import org.apache.tools.ant.types.FileSet;
   
   /**
  - *  Assembles .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>
  + * Assembles .NET Intermediate Language files.
  + * ilasm.exe must be on the execute path, unless another executable
  + * or the full path to that executable is specified in the <tt>executable</tt>
  + * parameter
  + *  <p>
    *
    *  <p>
    *
  @@ -86,9 +88,9 @@
    *  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. You can also use nested &lt;src&gt filesets to refer to source.
  - *
  - * @author     Steve Loughran steve_l@iseran.com
  - * @version    0.6
  + * <p>
  + * 
  + * @author     Steve Loughran
    * @ant.task    name="ilasm" category="dotnet"
    */
   
  
  
  
  1.5       +18 -3     ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java
  
  Index: Ildasm.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Ildasm.java	23 Sep 2003 06:28:33 -0000	1.4
  +++ Ildasm.java	24 Sep 2003 00:58:29 -0000	1.5
  @@ -56,6 +56,7 @@
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Task;
  +import org.apache.tools.ant.Project;
   import org.apache.tools.ant.util.FileUtils;
   
   import java.io.File;
  @@ -352,16 +353,26 @@
       }
   
       /**
  -     *
  -     * @return
  +     * Test for disassembly being needed; use existence and granularity
  +     * correct date stamps
  +     * @return true iff a rebuild is required.
        */
       private boolean isDisassemblyNeeded() {
           if (!destFile.exists()) {
  +            log("Destination file does not exist: a build is required",
  +                    Project.MSG_VERBOSE);
               return true;
           }
           long sourceTime = sourceFile.lastModified();
           long destTime = destFile.lastModified();
  -        return sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity());
  +        if(sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity())) {
  +            log("Source file is newer than the dest file: a rebuild is required",
  +                    Project.MSG_VERBOSE);
  +            return true;
  +        } else {
  +            log("The .il file is up to date", Project.MSG_VERBOSE);
  +            return false;
  +        }
   
       }
       /**
  @@ -370,6 +381,9 @@
        */
       public void execute() throws BuildException {
           validate();
  +        if(!isDisassemblyNeeded()) {
  +            return;
  +        }
           NetCommand command = new NetCommand(this, "ildasm", executable);
           command.setFailOnError(true);
           //fill in args
  @@ -423,6 +437,7 @@
           } catch (BuildException e) {
               //forcibly delete the output file in case of trouble
               if (destFile.exists()) {
  +                log("Deleting destination file as it may be corrupt");
                   destFile.delete();
               }
               //then rethrow the exception
  
  
  
  1.7       +43 -7     ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/ImportTypelib.java
  
  Index: ImportTypelib.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/ImportTypelib.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ImportTypelib.java	20 Sep 2003 16:40:42 -0000	1.6
  +++ ImportTypelib.java	24 Sep 2003 00:58:29 -0000	1.7
  @@ -57,16 +57,28 @@
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.util.FileUtils;
   
   import java.io.File;
   
   /**
  - * Wrapper to .NET's tlbimport; imports a tlb file to a NET assembly
  + * Import a COM type library into the .NET framework.
  + * <p>
  + *
  + * This task is a wrapper to .NET's tlbimport; it imports a tlb file to a NET assembly
    * by generating a binary assembly (.dll) that contains all the binding
  - * metadata. Uses date timestamps to minimise rebuilds.
  + * metadata. It uses date timestamps to minimise rebuilds.
  + * <p>
  + * Example
  + * <pre>
  + *     &lt;importtypelib
  + *       srcfile="xerces.tlb"
  + *       destfile="xerces.dll"
  + *       namespace="Apache.Xerces"/&gt;
  + * </pre>
    * @since Ant 1.6
    * @author steve loughran
  - * @ant.task    name="ImportTypelib" category="dotnet"
  + * @ant.task category="dotnet"
    */
   public class ImportTypelib extends Task {
   
  @@ -162,7 +174,7 @@
               throw new BuildException(
                       "destination file is a directory");
           }
  -        if (srcFile != null || !srcFile.exists()) {
  +        if (srcFile == null || !srcFile.exists()) {
               throw new BuildException(
                       "source file does not exist");
           }
  @@ -176,6 +188,31 @@
       }
   
       /**
  +     * Test for disassembly being needed; use existence and granularity
  +     * correct date stamps
  +     * @return true iff a rebuild is required.
  +     */
  +    private boolean isExecuteNeeded() {
  +        if (!destFile.exists()) {
  +            log("Destination file does not exist: a build is required",
  +                    Project.MSG_VERBOSE);
  +            return true;
  +        }
  +        long sourceTime = srcFile.lastModified();
  +        long destTime = destFile.lastModified();
  +        if (sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity())) {
  +            log("Source file is newer than the dest file: a rebuild is required",
  +                    Project.MSG_VERBOSE);
  +            return true;
  +        } else {
  +            log("The output file is up to date", Project.MSG_VERBOSE);
  +            return false;
  +        }
  +
  +    }
  +
  +
  +    /**
        * Create a typelib command
        * @exception BuildException if something goes wrong with the build
        */
  @@ -185,9 +222,7 @@
               + " to assembly " + destFile
               + " in namespace " + namespace, Project.MSG_VERBOSE);
           //rebuild unless the dest file is newer than the source file
  -        if (srcFile.exists() && destFile.exists()
  -            && srcFile.lastModified() <= destFile.lastModified()) {
  -            log("The typelib is up to date", Project.MSG_VERBOSE);
  +        if(!isExecuteNeeded()) {
               return;
           }
   
  @@ -205,5 +240,6 @@
               command.addArgument("/unsafe");
           }
           command.addArgument(extraOptions);
  +        command.runCommand();
       }
   }
  
  
  
  1.7       +7 -7      ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/JSharp.java
  
  Index: JSharp.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/JSharp.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JSharp.java	23 Sep 2003 06:28:33 -0000	1.6
  +++ JSharp.java	24 Sep 2003 00:58:29 -0000	1.7
  @@ -60,14 +60,16 @@
    * Compile J# source down to a managed .NET application.
    * <p>
    * J# is not Java. But it is the language closest to Java in the .NET framework.
  - * This task compiles jsharp source (assumes a .jsl extension, incidentally), and
  + * This task compiles jsharp source (.java files), and
    * generates a .NET managed exe or dll.
    * <p>
  - * See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vjsharp/html/vjoriMicrosoftVisualJ.asp
  - * for vjc command options in glory detail.
  + *
  + * @see <A=ref="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vjsharp/html/vjoriMicrosoftVisualJ.asp">
  + * Visual J++ online documentation</a>
  + *
    * @author Steve Loughran
    * @since ant1.6
  - * @ant.task    name="jsharpc" category="dotnet"
  + * @ant.task category="dotnet"
    */
   public class JSharp extends DotnetCompile {
   
  @@ -122,14 +124,12 @@
           return ";";
       }
   
  -
  -
       /**
        * Get the extension of filenames to compile.
        * @return The string extension of files to compile.
        */
       public String getFileExtension() {
  -        return ".jsl";
  +        return ".java";
       }
   
       /**
  
  
  
  1.9       +41 -2     ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java
  
  Index: VisualBasicCompile.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- VisualBasicCompile.java	20 Sep 2003 16:40:42 -0000	1.8
  +++ VisualBasicCompile.java	24 Sep 2003 00:58:29 -0000	1.9
  @@ -59,13 +59,52 @@
   
   /**
    * This task compiles Visual Basic.NET source into executables or modules.
  - * The task will only work on win2K until other platforms support vbc.exe or
  - * an equivalent. VBC.exe must be on the execute path, too.
  + * The task requires vbc.exe on the execute path, unless it or an equivalent
  + * program is specified in the <tt>executable</tt> parameter
    *
    * <p>
    * All parameters are optional: &lt;vbc/&gt; should suffice to produce a debug
    * build of all *.vb files.
    *
  + * <p>
  +
  + * The task is a directory based task, so attributes like
  + * <tt>includes=&quot;**\/*.vb&quot;</tt> and
  + * <tt>excludes=&quot;broken.vb&quot;</tt> can be used to control
  + * the files pulled in. By default,
  + * all *.vb files from the project folder down are included in the command.
  + * When this happens the destFile -if not specified-
  + * is taken as the first file in the list, which may be somewhat hard to control.
  +   Specifying the output file with <tt>destfile</tt> is prudent.
  + </p>
  + <p>
  + * Also, dependency checking only works if destfile is set.
  + *
  + * As with &lt;csc&gt; nested <tt>src</tt> filesets of source,
  + * reference filesets, definitions and resources can be provided.
  + *
  + * <p>
  + * Example
  + * </p>
  + * <pre>&lt;vbc
  + *   optimize=&quot;true&quot;
  + *   debug=&quot;false&quot;
  + *   warnLevel=&quot;4&quot;
  + *   targetType=&quot;exe&quot;
  + *   definitions=&quot;RELEASE&quot;
  + *   excludes=&quot;src/unicode_class.vb&quot;
  + *   mainClass = &quot;MainApp&quot;
  + *   destFile=&quot;NetApp.exe&quot;
  + *   optionExplicit=&quot;true&quot;
  + *   optionCompare=&quot;text&quot;
  + *   references="System.Xml,System.Web.Xml"
  + *   &gt;
  + *          &lt;reference file="${testCSC.dll}" /&gt;
  + *          &lt;define name="RELEASE" /&gt;
  + *          &lt;define name="DEBUG" if="debug.property"/&gt;
  + *          &lt;define name="def3" unless="def2.property"/&gt;
  + *   &lt;/vbc&gt;
  + </pre>
    * @author Brian Felder bfelder@providence.org
    * @author Steve Loughran
    * @ant.task    name="vbc" category="dotnet"
  
  
  
  1.17      +13 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java
  
  Index: WsdlToDotnet.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- WsdlToDotnet.java	23 Sep 2003 06:28:33 -0000	1.16
  +++ WsdlToDotnet.java	24 Sep 2003 00:58:29 -0000	1.17
  @@ -60,11 +60,23 @@
   /**
    * Converts a WSDL file or URL resource into a .NET language.
    *
  + * Why add a wrapper to the MS WSDL tool?
  + * So that you can verify that your web services, be they written with Axis or
  + *anyone else's SOAP toolkit, work with .NET clients.
  + *
  + *This task is dependency aware when using a file as a source and destination;
  + *so if you &lt;get&gt; the file (with <code>usetimestamp="true"</code>) then
  + *you only rebuild stuff when the WSDL file is changed. Of course,
  + *if the server generates a new timestamp every time you ask for the WSDL,
  + *this is not enough...use the &lt;filesmatch&gt; &lt;condition&gt; to
  + *to byte for byte comparison against a cached WSDL file then make
  + *the target conditional on that test failing.
  +
    * See "Creating an XML Web Service Proxy", "wsdl.exe" docs in
    * the framework SDK documentation
    * @author      Steve Loughran 
    * @version     0.5
  - * @ant.task    name="wsdltodotnet" category="dotnet"
  + * @ant.task    category="dotnet"
    * @since       Ant 1.5
    */
   
  
  
  

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