Browse Source

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 <steve_l@iseran.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269485 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
aa8f01df3c
4 changed files with 177 additions and 55 deletions
  1. +2
    -0
      WHATSNEW
  2. +48
    -11
      docs/manual/OptionalTasks/dotnet.html
  3. +106
    -23
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  4. +21
    -21
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java

+ 2
- 0
WHATSNEW View File

@@ -143,6 +143,8 @@ Other changes:
* <fixrlf> can now with CR only line-ends and can use an arbitraty * <fixrlf> can now with CR only line-ends and can use an arbitraty
between 2 and 80. between 2 and 80.


* The .NET tasks have been adapted to the beta2 release of the framework.

Fixed bugs: Fixed bugs:
----------- -----------




+ 48
- 11
docs/manual/OptionalTasks/dotnet.html View File

@@ -6,7 +6,6 @@


<body bgcolor="#ffffff"> <body bgcolor="#ffffff">
<h1>.NET classes for Ant</h1> <h1>.NET classes for Ant</h1>
<p>By Steve Loughran; steve_l@iseran.com</p>


<h2>Vision</h2> <h2>Vision</h2>
<p> <p>
@@ -54,7 +53,6 @@ removed from the build.xml files.</p>
<li>Type Library Exporter (TlbExp.exe) .dll -&gt; .tlb</li> <li>Type Library Exporter (TlbExp.exe) .dll -&gt; .tlb</li>
<li>TlbImp.exe Type Library Importer </li> <li>TlbImp.exe Type Library Importer </li>
<li>RegAsm.exe Assembly Registration Tool .dll -&gt; .reg | registration</li> <li>RegAsm.exe Assembly Registration Tool .dll -&gt; .reg | registration</li>
<li>WebServiceUtil -SOAP proxy import, SDL generation tool</li>
</ol> </ol>


<h2>Ant Wrapper for net tasks</h2> <h2>Ant Wrapper for net tasks</h2>
@@ -97,7 +95,7 @@ and behaviours. Probability: 100%. Impact: 2 days.</li>
To use the net tasks one needs To use the net tasks one needs
<ul> <ul>


<li> A Win2K box (or any other platform which supports the .net build tools)</li>
<li> A Windows box (or any other platform which supports the .net build tools)</li>


<li> JavaVM - Java1.1 or later; Java1.3 recommended.</li> <li> JavaVM - Java1.1 or later; Java1.3 recommended.</li>


@@ -118,6 +116,15 @@ version crimson.jar and jaxp.jar.</li>
<hr> <hr>
<h2> Change Log </h2> <h2> Change Log </h2>


<h4>Version 0.4</h4>
This is the beta-2 revision of the tasks.
<ol>
<li>ILASM: pulled the owner attribute, added keyfile for giving binaries a strong name
(MD5 hash of the checksum)
<li>CSC: added win32res , noConfig, utf8output, fullpaths
<li>CSC:
</ol>
<h4>Version 0.3</h4> <h4>Version 0.3</h4>


The changes here reflect Beta-1 of the dotnet SDK and experience of use in The changes here reflect Beta-1 of the dotnet SDK and experience of use in
@@ -244,6 +251,11 @@ Specifying the output file with <b>'outfile'</b> seems prudent. </p>
<td valign="top">Should a failed compile halt the build?</td> <td valign="top">Should a failed compile halt the build?</td>
<td valign="top">&quot;true&quot;(default) or &quot;false&quot;</td> <td valign="top">&quot;true&quot;(default) or &quot;false&quot;</td>
</tr> </tr>
<tr>
<td valign="top">fullpaths</td>
<td valign="top">print the full path of files on on errors</td>
</tr>
<tr> <tr>
<td valign="top">includes</td> <td valign="top">includes</td>
<td valign="top">comma separated list of patterns of files that must be <td valign="top">comma separated list of patterns of files that must be
@@ -274,6 +286,13 @@ Specifying the output file with <b>'outfile'</b> seems prudent. </p>
<td valign="top">name of main class for executables</td> <td valign="top">name of main class for executables</td>
<td valign="top">&quot;com.example.project.entrypoint&quot;</td> <td valign="top">&quot;com.example.project.entrypoint&quot;</td>
</tr> </tr>
<tr>
<td valign="top">noConfig</td>
<td valign="top">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</td>
<td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
</tr>
<tr> <tr>
<td valign="top">optimize</td> <td valign="top">optimize</td>
<td valign="top">optimisation flag</td> <td valign="top">optimisation flag</td>
@@ -308,7 +327,12 @@ Specifying the output file with <b>'outfile'</b> seems prudent. </p>
</tr> </tr>
<tr> <tr>
<td valign="top">unsafe</td> <td valign="top">unsafe</td>
<td valign="top">enable unsafe code</td>
<td valign="top">enable the <b>unsafe</b> keyword</td>
<td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
</tr>
<tr>
<td valign="top">utf8output</td>
<td valign="top">require all compiler output to be in utf-8 format</td>
<td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td> <td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
</tr> </tr>
<tr> <tr>
@@ -322,6 +346,12 @@ Specifying the output file with <b>'outfile'</b> seems prudent. </p>
<td valign="top">filename of icon to include</td> <td valign="top">filename of icon to include</td>
<td valign="top">&quot;res/myicon.ico&quot;</td> <td valign="top">&quot;res/myicon.ico&quot;</td>
</tr> </tr>
<tr>
<td valign="top">win32res</td>
<td valign="top">filename of a win32 resource (.RES)file to include
This is not a .NET resource, but it what windows is used to.</td>
<td valign="top">&quot;res/myapp.res&quot;</td>
</tr>


</table> </table>
<p> <p>
@@ -344,7 +374,7 @@ Example
<hr> <hr>
<h2> Task: ilasm </h2> <h2> Task: ilasm </h2>
<p>Task to assemble .net 'Intermediate Language' files. <p>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. an equivalent. ilasm.exe must be on the execute path too.
</p> </p>
<p> <p>
@@ -399,7 +429,8 @@ manually specified with <b>outfile</b>
<tr> <tr>
<td valign="top">extraOptions</td> <td valign="top">extraOptions</td>
<td valign="top">Any extra options which aren't explicitly <td valign="top">Any extra options which aren't explicitly
supported by the ilasm task </td>
supported by the ilasm task, primarily because they
arent really documented: use ilasm /? to see them</td>
<td></td> <td></td>
</tr> </tr>
@@ -408,6 +439,11 @@ manually specified with <b>outfile</b>
<td valign="top">Should a failed compile halt the build?</td> <td valign="top">Should a failed compile halt the build?</td>
<td valign="top">&quot;true&quot;(default)</td> <td valign="top">&quot;true&quot;(default)</td>
</tr> </tr>
<tr>
<td valign="top">fullpaths</td>
<td valign="top">Should error text provide the full path to files</td>
<td valign="top">&quot;true&quot;(default)</td>
</tr>
<tr> <tr>
<td valign="top">includes</td> <td valign="top">includes</td>
<td valign="top">comma separated list of patterns of files that must be <td valign="top">comma separated list of patterns of files that must be
@@ -418,6 +454,12 @@ manually specified with <b>outfile</b>
<td valign="top">the name of a file. Each line of this file is <td valign="top">the name of a file. Each line of this file is
taken to be an include pattern</td> taken to be an include pattern</td>
</tr> </tr>
<tr>
<td valign="top">keyfile</td>
<td valign="top">the name of a file containing a private key, with which
the assembly output is checksumed and then MD5 signed
to have a <i>strong name</i></td>
</tr>
<tr> <tr>
<td valign="top">listing</td> <td valign="top">listing</td>
<td valign="top">Produce a listing (off by default). Listings go to the <td valign="top">Produce a listing (off by default). Listings go to the
@@ -429,11 +471,6 @@ manually specified with <b>outfile</b>
<td valign="top">filename of output</td> <td valign="top">filename of output</td>
<td valign="top">&quot;example.exe&quot;</td> <td valign="top">&quot;example.exe&quot;</td>
</tr> </tr>
<tr>
<td valign="top">owner</td>
<td valign="top">restrict disassembly by setting the 'owner' string</td>
<td valign="top">&quot;secret&quot;</td>
</tr>
<tr> <tr>
<td valign="top">resourceFile</td> <td valign="top">resourceFile</td>
<td valign="top">name of resource file to include</td> <td valign="top">name of resource file to include</td>


+ 106
- 23
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java View File

@@ -222,9 +222,10 @@ public class CSharp
} }
/** /**
* Fix C# reference inclusion.
* C# is really dumb in how it handles inclusion. You have to list * C# is really dumb in how it handles inclusion. You have to list
* every 'assembly' -read DLL that is imported. So already you are * 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 * 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, * why the compiler cant find classes on the path or in a directory,
* is a mystery. * is a mystery.
@@ -236,27 +237,43 @@ public class CSharp
* Casing is chosen to match that of the file system <i>exactly</i> * Casing is chosen to match that of the file system <i>exactly</i>
* so may work on a unix box too. * 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 * get default reference list
* @return null or a string of references. * @return null or a string of references.
@@ -608,6 +625,67 @@ public class CSharp
else else
return null; 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 /** defines list
* something like 'RELEASE;WIN32;NO_SANITY_CHECKS;;SOMETHING_ELSE' * something like 'RELEASE;WIN32;NO_SANITY_CHECKS;;SOMETHING_ELSE'
@@ -720,6 +798,7 @@ public class CSharp
_additionalModules=null; _additionalModules=null;
_includeDefaultReferences=true; _includeDefaultReferences=true;
_extraOptions=null; _extraOptions=null;
_fullpaths=true;
} }
/** /**
@@ -760,8 +839,12 @@ public class CSharp
command.addArgument(getOutputFileParameter()); command.addArgument(getOutputFileParameter());
command.addArgument(getIncludeDefaultReferencesParameter()); command.addArgument(getIncludeDefaultReferencesParameter());
command.addArgument(getDefaultReferenceParameter()); command.addArgument(getDefaultReferenceParameter());
command.addArgument(getWin32ResParameter());
command.addArgument(getUtf8OutpuParameter());
command.addArgument(getNoConfigParameter());
command.addArgument(getFullPathsParameter());
command.addArgument(getExtraOptionsParameter()); command.addArgument(getExtraOptionsParameter());
//get dependencies list. //get dependencies list.
DirectoryScanner scanner = super.getDirectoryScanner(_srcDir); DirectoryScanner scanner = super.getDirectoryScanner(_srcDir);
String[] dependencies = scanner.getIncludedFiles(); String[] dependencies = scanner.getIncludedFiles();


+ 21
- 21
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java View File

@@ -144,11 +144,9 @@ public class Ilasm
_listing = false; _listing = false;
_verbose=false; _verbose=false;
_debug=true; _debug=true;
_owner=null;
_outputFile=null; _outputFile=null;
_failOnError=true; _failOnError=true;
_resourceFile=null; _resourceFile=null;
_owner=null;
_extraOptions=null; _extraOptions=null;
} }


@@ -212,10 +210,6 @@ public class Ilasm
return null; return null;
} }
/** owner string is a slightly trivial barrier to disassembly
*/
protected String _owner;
/** /**
* Sets the Owner attribute * Sets the Owner attribute
@@ -224,21 +218,9 @@ public class Ilasm
*/ */
public void setOwner(String s) { 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 /** test for a string containing something useful
* @param string to test * @param string to test
* @returns true if the argument is not null or empty * @returns true if the argument is not null or empty
@@ -373,6 +355,24 @@ public class Ilasm
return _debug?"/debug":null; 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? /** any extra command options?
*/ */
protected String _extraOptions; protected String _extraOptions;
@@ -446,9 +446,9 @@ public class Ilasm
command.addArgument(getTargetTypeParameter()); command.addArgument(getTargetTypeParameter());
command.addArgument(getListingParameter()); command.addArgument(getListingParameter());
command.addArgument(getOutputFileParameter()); command.addArgument(getOutputFileParameter());
command.addArgument(getOwnerParameter());
command.addArgument(getResourceFileParameter()); command.addArgument(getResourceFileParameter());
command.addArgument(getVerboseParameter()); command.addArgument(getVerboseParameter());
command.addArgument(getKeyfileParameter());
command.addArgument(getExtraOptionsParameter()); command.addArgument(getExtraOptionsParameter());




Loading…
Cancel
Save