From aa8f01df3ca1287a3cab4e27edb8093384748c92 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 7 Aug 2001 06:19:25 +0000 Subject: [PATCH] update .NET tasks for the beta2 release changes -removed 'owner' attribute from ILASM (it just prints a warning and is stripped from the docs) -changed the referenced dlls to the beta-2 set -added some options to csc: fullpaths win32res noconfig utf8output Submitted by: Steve Loughran git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269485 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 + docs/manual/OptionalTasks/dotnet.html | 59 ++++++-- .../ant/taskdefs/optional/dotnet/CSharp.java | 129 ++++++++++++++---- .../ant/taskdefs/optional/dotnet/Ilasm.java | 42 +++--- 4 files changed, 177 insertions(+), 55 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 958612423..0c6aa8286 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -143,6 +143,8 @@ Other changes: * can now with CR only line-ends and can use an arbitraty between 2 and 80. +* The .NET tasks have been adapted to the beta2 release of the framework. + Fixed bugs: ----------- diff --git a/docs/manual/OptionalTasks/dotnet.html b/docs/manual/OptionalTasks/dotnet.html index a5bc540bb..2d710e6a7 100644 --- a/docs/manual/OptionalTasks/dotnet.html +++ b/docs/manual/OptionalTasks/dotnet.html @@ -6,7 +6,6 @@

.NET classes for Ant

-

By Steve Loughran; steve_l@iseran.com

Vision

@@ -54,7 +53,6 @@ removed from the build.xml files.

  • Type Library Exporter (TlbExp.exe) .dll -> .tlb
  • TlbImp.exe Type Library Importer
  • RegAsm.exe Assembly Registration Tool .dll -> .reg | registration
  • -
  • WebServiceUtil -SOAP proxy import, SDL generation tool
  • Ant Wrapper for net tasks

    @@ -97,7 +95,7 @@ and behaviours. Probability: 100%. Impact: 2 days. To use the net tasks one needs
      -
    • A Win2K box (or any other platform which supports the .net build tools)
    • +
    • A Windows box (or any other platform which supports the .net build tools)
    • JavaVM - Java1.1 or later; Java1.3 recommended.
    • @@ -118,6 +116,15 @@ version crimson.jar and jaxp.jar.

      Change Log

      +

      Version 0.4

      +This is the beta-2 revision of the tasks. +
        +
      1. ILASM: pulled the owner attribute, added keyfile for giving binaries a strong name +(MD5 hash of the checksum) +
      2. CSC: added win32res , noConfig, utf8output, fullpaths +
      3. CSC: +
      +

      Version 0.3

      The changes here reflect Beta-1 of the dotnet SDK and experience of use in @@ -244,6 +251,11 @@ Specifying the output file with 'outfile' seems prudent.

      Should a failed compile halt the build? "true"(default) or "false" + + fullpaths + print the full path of files on on errors + + includes comma separated list of patterns of files that must be @@ -274,6 +286,13 @@ Specifying the output file with 'outfile' seems prudent.

      name of main class for executables "com.example.project.entrypoint" + + noConfig + a flag which tells the compiler not + to read in the compiler settings files 'csc.rsp' in its + bin directory and then the local directory + "true" or "false"(default) + optimize optimisation flag @@ -308,7 +327,12 @@ Specifying the output file with 'outfile' seems prudent.

      unsafe - enable unsafe code + enable the unsafe keyword + "true" or "false"(default) + + + utf8output + require all compiler output to be in utf-8 format "true" or "false"(default) @@ -322,6 +346,12 @@ Specifying the output file with 'outfile' seems prudent.

      filename of icon to include "res/myicon.ico" + + win32res + filename of a win32 resource (.RES)file to include + This is not a .NET resource, but it what windows is used to. + "res/myapp.res" +

      @@ -344,7 +374,7 @@ Example


      Task: ilasm

      Task to assemble .net 'Intermediate Language' files. -The task will only work on win2K until other platforms support csc.exe or +The task will only work on windows until other platforms support csc.exe or an equivalent. ilasm.exe must be on the execute path too.

      @@ -399,7 +429,8 @@ manually specified with outfile extraOptions Any extra options which aren't explicitly - supported by the ilasm task + supported by the ilasm task, primarily because they + arent really documented: use ilasm /? to see them @@ -408,6 +439,11 @@ manually specified with outfile Should a failed compile halt the build? "true"(default) + + fullpaths + Should error text provide the full path to files + "true"(default) + includes comma separated list of patterns of files that must be @@ -418,6 +454,12 @@ manually specified with outfile the name of a file. Each line of this file is taken to be an include pattern + + keyfile + the name of a file containing a private key, with which + the assembly output is checksumed and then MD5 signed + to have a strong name + listing Produce a listing (off by default). Listings go to the @@ -429,11 +471,6 @@ manually specified with outfile filename of output "example.exe" - - owner - restrict disassembly by setting the 'owner' string - "secret" - resourceFile name of resource file to include diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java index 921bc733e..54b5150cd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java @@ -222,9 +222,10 @@ public class CSharp } /** + * 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 + * 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. @@ -236,27 +237,43 @@ public class CSharp * Casing is chosen to match that of the file system exactly * so may work on a unix box too. */ - protected static final String DEFAULT_REFERENCE_LIST - ="System.dll;System.Drawing.dll;System.Data.dll;"+ - "System.Diagnostics.dll;"+ - "System.DirectoryServices.dll;"+ - "System.IO.dll;"+ - "System.Management.dll;"+ - "System.Messaging.dll;"+ - "System.Net.dll;"+ - "System.Runtime.Remoting.dll;"+ - "System.Runtime.Serialization.Formatters.Soap.dll;"+ - "System.Security.dll;"+ - "System.ServiceProcess.dll;"+ - "System.Text.RegularExpressions.dll;"+ - "System.Timers.dll;"+ - "System.Web.dll;"+ - "System.Web.Services.dll;"+ - "System.WinForms.dll;"+ - "System.XML.dll;"+ - "System.XML.Serialization.dll;"+ - "Microsoft.ComServices.dll;"; - + + protected static final String DEFAULT_REFERENCE_LIST= + "Accessibility.dll;"+ + "cscompmgd.dll;"+ + "CustomMarshalers.dll;"+ + "IEExecRemote.dll;"+ + "IEHost.dll;"+ + "IIEHost.dll;"+ + "ISymWrapper.dll;"+ + "Microsoft.JScript.dll;"+ + "Microsoft.VisualBasic.dll;"+ + "Microsoft.VisualC.dll;"+ + "Microsoft.Vsa.dll;"+ + "Mscorcfg.dll;"+ + "RegCode.dll;"+ + "System.Configuration.Install.dll;"+ + "System.Data.dll;"+ + "System.Design.dll;"+ + "System.DirectoryServices.dll;"+ + "System.EnterpriseServices.dll;"+ + "System.dll;"+ + "System.Drawing.Design.dll;"+ + "System.Drawing.dll;"+ + "System.Management.dll;"+ + "System.Messaging.dll;"+ + "System.Runtime.Remoting.dll;"+ + "System.Runtime.Serialization.Formatters.Soap.dll;"+ + "System.Security.dll;"+ + "System.ServiceProcess.dll;"+ + "System.Web.dll;"+ + "System.Web.RegularExpressions.dll;"+ + "System.Web.Services.dll;"+ + "System.Windows.Forms.dll;"+ + "System.XML.dll;"; + + + /** * get default reference list * @return null or a string of references. @@ -608,6 +625,67 @@ public class CSharp 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. + */ + public void setWin32Res(File fileName) { + _win32res = fileName; + } + + /** + * get the argument or null for no argument needed + * + * @return The Win32Icon Parameter to CSC + */ + protected String getWin32ResParameter() { + 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. + */ + public void setUtf8Output(boolean enabled) { + _utf8output=enabled; + } + + protected String getUtf8OutpuParameter() { + return _utf8output?"/utf8output":null; + } + + protected boolean _noconfig=false; + + protected void setNoConfig(boolean enabled) { + _noconfig=enabled; + } + + protected String getNoConfigParameter() { + return _noconfig?"/noconfig":null; + } + + // /fullpaths + protected boolean _fullpaths=false; + + public void setFullPaths(boolean enabled) { + _fullpaths=enabled; + } + + protected String getFullPathsParameter() { + return _fullpaths?"/fullpaths":null; + } /** defines list * something like 'RELEASE;WIN32;NO_SANITY_CHECKS;;SOMETHING_ELSE' @@ -720,6 +798,7 @@ public class CSharp _additionalModules=null; _includeDefaultReferences=true; _extraOptions=null; + _fullpaths=true; } /** @@ -760,8 +839,12 @@ public class CSharp command.addArgument(getOutputFileParameter()); command.addArgument(getIncludeDefaultReferencesParameter()); command.addArgument(getDefaultReferenceParameter()); + command.addArgument(getWin32ResParameter()); + command.addArgument(getUtf8OutpuParameter()); + command.addArgument(getNoConfigParameter()); + command.addArgument(getFullPathsParameter()); command.addArgument(getExtraOptionsParameter()); - + //get dependencies list. DirectoryScanner scanner = super.getDirectoryScanner(_srcDir); String[] dependencies = scanner.getIncludedFiles(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java index cb8d8bc4a..c612a459e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java @@ -144,11 +144,9 @@ public class Ilasm _listing = false; _verbose=false; _debug=true; - _owner=null; _outputFile=null; _failOnError=true; _resourceFile=null; - _owner=null; _extraOptions=null; } @@ -212,10 +210,6 @@ public class Ilasm return null; } - /** owner string is a slightly trivial barrier to disassembly - */ - - protected String _owner; /** * Sets the Owner attribute @@ -224,21 +218,9 @@ public class Ilasm */ public void setOwner(String s) { - _owner=s; + log("This option is not supported by ILASM as of Beta-2, and will be ignored",Project.MSG_WARN); } - - /** - * Gets the Owner switch for ilasm - * - * @return The Owner string - */ - protected String getOwnerParameter() { - if(notEmpty(_owner)) - return "/owner="+_owner; - else - return null; - } - + /** test for a string containing something useful * @param string to test * @returns true if the argument is not null or empty @@ -373,6 +355,24 @@ public class Ilasm return _debug?"/debug":null; } + /** file containing private key + */ + + private File _keyfile; + + public void setKeyfile(File keyfile) { + this._keyfile=keyfile; + } + + /** get the argument or null for no argument needed + */ + protected String getKeyfileParameter() { + if(_keyfile!=null) + return "/keyfile:"+_keyfile.toString(); + else + return null; + } + /** any extra command options? */ protected String _extraOptions; @@ -446,9 +446,9 @@ public class Ilasm command.addArgument(getTargetTypeParameter()); command.addArgument(getListingParameter()); command.addArgument(getOutputFileParameter()); - command.addArgument(getOwnerParameter()); command.addArgument(getResourceFileParameter()); command.addArgument(getVerboseParameter()); + command.addArgument(getKeyfileParameter()); command.addArgument(getExtraOptionsParameter());