Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 35818 invoked from network); 24 Sep 2003 00:58:39 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 24 Sep 2003 00:58:39 -0000 Received: (qmail 19517 invoked by uid 500); 24 Sep 2003 00:58:14 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 19470 invoked by uid 500); 24 Sep 2003 00:58:14 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 19432 invoked by uid 500); 24 Sep 2003 00:58:14 -0000 Received: (qmail 19417 invoked from network); 24 Sep 2003 00:58:14 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 24 Sep 2003 00:58:14 -0000 Received: (qmail 35689 invoked by uid 1365); 24 Sep 2003 00:58:29 -0000 Date: 24 Sep 2003 00:58:29 -0000 Message-ID: <20030924005829.35688.qmail@minotaur.apache.org> From: stevel@apache.org To: ant-cvs@apache.org Subject: 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 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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.

- * - * All parameters are optional: <csc/> 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.

- * + * csc.exe must be on the execute path, unless another executable + * or the full path to that executable is specified in the executable + * parameter + *

+ * All parameters are optional: <csc/> should suffice to produce a debug + * build of all *.cs files. However, naming an destFilestops the + * csc compiler from choosing an output name from random, and + * allows the dependency checker to determine if the file is out of date. + *

* The task is a directory based task, so attributes like includes="*.cs" * and excludes="broken.cs" 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 'outfile' seems prudent.

- * - *

- * - * TODO - *

    - *
  1. is incremental build still broken in beta-1? - *
  2. is Win32Icon broken? - *
  3. all the missing options - *
- *

- * - * History - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * Specifying the output file with destFile seems prudent.

* - *

- * 0.3 - * - * Beta 1 edition - * - * To avoid having to remember which assemblies to include, the task - * automatically refers to the main dotnet libraries in Beta1. - *
- * 0.2 - * - * Slightly different - * - * Split command execution to a separate class; - *
- * 0.1 - * - * "I can't believe it's so rudimentary" - * - * First pass; minimal builds only support; - *
+ *

+ * For more complex source trees, nested src elemements can be + * supplied. When such an element is present, the implicit fileset is ignored. + * This makes sense, when you think about it :) + *

+ * + * References to external files can be made through the references attribute, + * or (since Ant1.6), via nested <reference> filesets. With the latter, + * the timestamps of the references are also used in the dependency + * checking algorithm. + *

+ * + * Example + * + *

<csc
  + * 	optimize="true"
  + * 	debug="false"
  + * 	docFile="documentation.xml"
  + * 	warnLevel="4"
  + * 	unsafe="false"
  + * 	targetType="exe"
  + * 	incremental="false"
  + * 	mainClass = "MainApp"
  + * 	destFile="NetApp.exe"
  + * 	>
  + * 	     <src dir="src" includes="*.cs" />
  + *       <reference file="${testCSC.dll}" />
  + *       <define name="RELEASE" />
  + *       <define name="DEBUG" if="debug.property"/>
  + *       <define name="def3" unless="def3.property"/>
  + *    </csc>
  + * 
* * - * @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.

+ * 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 executable + * parameter + *

* *

* @@ -86,9 +88,9 @@ * The task is a directory based task, so attributes like includes="*.il" * and excludes="broken.il" can be used to control the files pulled * in. You can also use nested <src> filesets to refer to source. - * - * @author Steve Loughran steve_l@iseran.com - * @version 0.6 + *

+ * + * @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. + *

+ * + * 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. + *

+ * Example + *

  + *     <importtypelib
  + *       srcfile="xerces.tlb"
  + *       destfile="xerces.dll"
  + *       namespace="Apache.Xerces"/>
  + * 
* @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. *

* 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. *

- * 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 + * Visual J++ online documentation + * * @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 executable parameter * *

* All parameters are optional: <vbc/> should suffice to produce a debug * build of all *.vb files. * + *

+ + * The task is a directory based task, so attributes like + * includes="**\/*.vb" and + * excludes="broken.vb" 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 destfile is prudent. +

+

+ * Also, dependency checking only works if destfile is set. + * + * As with <csc> nested src filesets of source, + * reference filesets, definitions and resources can be provided. + * + *

+ * Example + *

+ *
<vbc
  + *   optimize="true"
  + *   debug="false"
  + *   warnLevel="4"
  + *   targetType="exe"
  + *   definitions="RELEASE"
  + *   excludes="src/unicode_class.vb"
  + *   mainClass = "MainApp"
  + *   destFile="NetApp.exe"
  + *   optionExplicit="true"
  + *   optionCompare="text"
  + *   references="System.Xml,System.Web.Xml"
  + *   >
  + *          <reference file="${testCSC.dll}" />
  + *          <define name="RELEASE" />
  + *          <define name="DEBUG" if="debug.property"/>
  + *          <define name="def3" unless="def2.property"/>
  + *   </vbc>
  + 
* @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 <get> the file (with usetimestamp="true") 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 <filesmatch> <condition> 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