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/08/01 07:55:17 UTC

cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

stevel      2003/07/31 22:55:17

  Modified:    src/etc/testcases/taskdefs/optional dotnet.xml
               src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        CSharp.java DotnetBaseMatchingTask.java
                        DotnetCompile.java JSharp.java
                        VisualBasicCompile.java
               src/testcases/org/apache/tools/ant/taskdefs/optional
                        DotnetTest.java
  Log:
  add the ability to set the executable used in .net tasks. Why do this
  (a) so you can refer to versions off the path (useful for multiple versions)
  (b) so you can use other implementations than the windows one.
  
  Specifically, Mono Csharp compiler, msc, apparently uses the same syntax as csc if desired. We will have to test this... I suppose we could test Rotor too, but I cant be bothered
  
  Revision  Changes    Path
  1.3       +20 -5     ant/src/etc/testcases/taskdefs/optional/dotnet.xml
  
  Index: dotnet.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/optional/dotnet.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- dotnet.xml	11 Mar 2003 06:10:46 -0000	1.2
  +++ dotnet.xml	1 Aug 2003 05:55:16 -0000	1.3
  @@ -67,20 +67,35 @@
         destFile="${testCSC.exe}"
         targetType="exe" 
         >
  -      <src dir="${src.dir}" includes="**/*.cs"/>
       </csc>
       <available property="app.created" file="${testCSC.exe}"/>
       <fail unless="app.created">No app ${testCSC.exe} created</fail>
       <exec executable="${testCSC.exe}" failonerror="true" />
  +    <delete file="${testCSC.exe}"/>
     </target>
  -  
  -  
  +
  +    <target name="testCSCintrinsicFileset" depends="init">
  +      <property name="testCSC.exe"
  +        location="${build.dir}/ExampleCsc.exe"/>
  +      <csc
  +        destFile="${testCSC.exe}"
  +        targetType="exe"
  +        srcDir="."
  +        >
  +      </csc>
  +      <available property="app.created" file="${testCSC.exe}"/>
  +      <fail unless="app.created">No app ${testCSC.exe} created</fail>
  +      <exec executable="${testCSC.exe}" failonerror="true"/>
  +      <delete file="${testCSC.exe}"/>
  +    </target>
  +
     <target name="testCSCdll" depends="init">
  -    <property name="testCSC.dll" 
  +    <property name="testCSC.dll"
         location="${build.dir}/Example2.dll" />
       <csc 
         destFile="${testCSC.dll}"
  -      targetType="library" 
  +      targetType="library"
  +      executable="csc"
         >
         <src dir="${src.dir}" includes="example2.cs"/>
       </csc>
  
  
  
  1.35      +2 -8      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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- CSharp.java	18 Jul 2003 14:21:22 -0000	1.34
  +++ CSharp.java	1 Aug 2003 05:55:16 -0000	1.35
  @@ -199,6 +199,7 @@
        */
   
       public CSharp() {
  +        clear();
       }
   
       /**
  @@ -213,7 +214,7 @@
           unsafe = false;
           noconfig = false;
           definitions = null;
  -
  +        setExecutable("csc");
       }
   
   
  @@ -426,13 +427,6 @@
           return ";";
       }
   
  -    /**
  -     * compiler is 'csc'
  -     * @return
  -     */
  -    public String getCompilerExeName() {
  -        return "csc";
  -    }
   
       /**
        * extension is '.cs'
  
  
  
  1.6       +1 -1      ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java
  
  Index: DotnetBaseMatchingTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DotnetBaseMatchingTask.java	18 Jul 2003 14:21:22 -0000	1.5
  +++ DotnetBaseMatchingTask.java	1 Aug 2003 05:55:16 -0000	1.6
  @@ -137,7 +137,7 @@
               = getSrcDir() != null || filesets.size() == 0;
           if (scanImplicitFileset) {
               //scan for an implicit fileset if there was a srcdir set
  -            //or there was no srcDir set but the @
  +            //or there was no srcDir set but there was no contained classes
               if (getSrcDir() == null) {
                   //if there is no src dir here, set it
                   setSrcDir(getProject().resolveFile("."));
  
  
  
  1.11      +30 -7     ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java
  
  Index: DotnetCompile.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DotnetCompile.java	18 Jul 2003 14:21:22 -0000	1.10
  +++ DotnetCompile.java	1 Aug 2003 05:55:16 -0000	1.11
  @@ -155,6 +155,12 @@
       protected Vector resources = new Vector();
   
       /**
  +     *  executable
  +     */
  +
  +    protected String executable;
  +
  +    /**
        *  Fix .NET reference inclusion. .NET 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
  @@ -791,6 +797,26 @@
       }
   
       /**
  +     * what is the executable?
  +     * @return
  +     */
  +    protected String getExecutable() {
  +        return executable;
  +    }
  +
  +    /**
  +     * set the name of the program, overriding the defaults.
  +     * Can be used to set the full path to a program, or to switch
  +     * to an alternate implementation of the command, such as the Mono or Rotor
  +     * versions -provided they use the same command line arguments as the
  +     * .NET framework edition
  +     * @param executable
  +     */
  +    public void setExecutable(String executable) {
  +        this.executable = executable;
  +    }
  +
  +    /**
        *  test for a string containing something useful
        *
        *@param  s  string in
  @@ -809,6 +835,9 @@
           if (outputFile != null && outputFile.isDirectory()) {
               throw new BuildException("destFile cannot be a directory");
           }
  +        if(getExecutable()==null) {
  +            throw new BuildException("There is no executable defined for this task");
  +        }
       }
   
       /**
  @@ -863,12 +892,6 @@
       public abstract String getReferenceDelimiter();
   
       /**
  -     * Get the name of the compiler executable.
  -     * @return The name of the compiler executable.
  -     */
  -    public abstract String getCompilerExeName() ;
  -
  -    /**
        * Get the extension of filenames to compile.
        * @return The string extension of files to compile.
        */
  @@ -963,7 +986,7 @@
        * @return a command prefilled with the exe name and task name
        */
       protected NetCommand createNetCommand() {
  -        NetCommand command = new NetCommand(this, getTaskName(), getCompilerExeName());
  +        NetCommand command = new NetCommand(this, getTaskName(), getExecutable());
           return command;
       }
   
  
  
  
  1.4       +5 -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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JSharp.java	4 Jul 2003 14:04:55 -0000	1.3
  +++ JSharp.java	1 Aug 2003 05:55:16 -0000	1.4
  @@ -84,7 +84,11 @@
        */
       boolean secureScoping = false;
   
  +    public JSharp() {
  +        setExecutable("vjc");
  +    }
   
  +    
       public void setBaseAddress(String baseAddress) {
           this.baseAddress = baseAddress;
       }
  @@ -116,13 +120,7 @@
           return ";";
       }
   
  -    /**
  -     * Get the name of the compiler executable.
  -     * @return The name of the compiler executable.
  -     */
  -    public String getCompilerExeName() {
  -        return "vjc";
  -    }
  +
   
       /**
        * Get the extension of filenames to compile.
  
  
  
  1.7       +2 -9      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- VisualBasicCompile.java	18 Jul 2003 14:21:23 -0000	1.6
  +++ VisualBasicCompile.java	1 Aug 2003 05:55:16 -0000	1.7
  @@ -107,7 +107,7 @@
        * Constructor for VisualBasicCompile.
        */
       public VisualBasicCompile() {
  -        super();
  +        clear();
       }
   
       /**
  @@ -121,6 +121,7 @@
           optionExplicit = false;
           optionStrict = false;
           removeIntChecks = false;
  +        setExecutable("vbc");
       }
   
       /**
  @@ -347,14 +348,6 @@
        */
       protected String createResourceParameter(DotnetResource resource) {
           return resource.getVbStyleParameter();
  -    }
  -
  -    /**
  -     * Get the name of the compiler executable.
  -     * @return The name of the compiler executable.
  -     */
  -    public String getCompilerExeName() {
  -        return "vbc";
       }
   
       /**
  
  
  
  1.3       +8 -0      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java
  
  Index: DotnetTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DotnetTest.java	11 Mar 2003 06:08:11 -0000	1.2
  +++ DotnetTest.java	1 Aug 2003 05:55:16 -0000	1.3
  @@ -109,6 +109,14 @@
       /**
        * A unit test for JUnit
        */
  +    public void testCSCintrinsicFileset() throws Exception {
  +        executeTarget("testCSCintrinsicFileset");
  +    }
  +
  +
  +    /**
  +     * A unit test for JUnit
  +     */
       public void testCSCdll() throws Exception {
           executeTarget("testCSCdll");
       }
  
  
  

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


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:

> On Tue, 05 Aug 2003, Steve Loughran <st...@iseran.com> wrote:
> 
> 
>>CSC doesnt need trailing semicolons though it handles it.
> 
> 
> OK, I've removed it.
> 
> 
>>I filed a bugrep with them,
> 
> 
> "them" being the Mono devs, yes?
> 
> 
>>because if they cannot handle empty reference strings then
>>
>>/ref a.dll;;b.dll will probably also break.
> 
> 
> What would be the expected behavior to you?  Simply ignore it?

yep.


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


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 05 Aug 2003, Steve Loughran <st...@iseran.com> wrote:

> CSC doesnt need trailing semicolons though it handles it.

OK, I've removed it.

> I filed a bugrep with them,

"them" being the Mono devs, yes?

> because if they cannot handle empty reference strings then
> 
> /ref a.dll;;b.dll will probably also break.

What would be the expected behavior to you?  Simply ignore it?

Stefan

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


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:

> On Fri, 01 Aug 2003, Steve Loughran <st...@iseran.com> wrote:
> 
> 
>>The tasks have a list of standard references to pull in, taken from
>>the .NET framework set. We need to say 'if the platform!=.NET then
>>have no default references'. You can turn off default references
>>explicitly, but the implicit behaviour will be broken as it refers
>>to stuff that mono lacks.
> 
> 
> Look at my commit for dotnet.xml, this one lists all the correct
> references (Mono get's installed into /usr/lib by the rpms Ximian,
> errm, Novell?, provides).
> 
> I then get an error
> 
>       [csc] error CS0006: Cannot find assembly `'
> 
> when I run that target.  It seems as if mcs didn't like the trailing ;
> on the references arg, but I didn't dare to change DotnetCompile class
> as I don't know whether csc will need exactly that ;.

CSC doesnt need trailing semicolons though it handles it. Guess that is 
a diff from the mono impl and the MS impl. I filed a bugrep with them, 
because if they cannot handle empty reference strings then

/ref a.dll;;b.dll will probably also break.





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


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 01 Aug 2003, Steve Loughran <st...@iseran.com> wrote:

> The tasks have a list of standard references to pull in, taken from
> the .NET framework set. We need to say 'if the platform!=.NET then
> have no default references'. You can turn off default references
> explicitly, but the implicit behaviour will be broken as it refers
> to stuff that mono lacks.

Look at my commit for dotnet.xml, this one lists all the correct
references (Mono get's installed into /usr/lib by the rpms Ximian,
errm, Novell?, provides).

I then get an error

      [csc] error CS0006: Cannot find assembly `'

when I run that target.  It seems as if mcs didn't like the trailing ;
on the references arg, but I didn't dare to change DotnetCompile class
as I don't know whether csc will need exactly that ;.

Stefan

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


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:

> On 1 Aug 2003, <st...@apache.org> wrote:
> 
> 
>>  (b) so you can use other implementations than the windows one.
> 
> 
> Great!
> 
> I have Mono (0.25) installed on my Linux box and was trying to free
> some time to see whether I could get <csc> (the only task I'd
> currently be interested in) to work with it, it seems it is no longer
> needed.
> 
> 
>>  Specifically, Mono Csharp compiler, msc, apparently uses the same
>>  syntax as csc if desired. We will have to test this...
> 
> 
> Let me know what I can do to help.

Actually, thinking about it, we have one more little issue.

The tasks have a list of standard references to pull in, taken from the 
.NET framework set. We need to say 'if the platform!=.NET then have no 
default references'. You can turn off default references explicitly, but
the implicit behaviour will be broken as it refers to stuff that mono lacks.


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


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:

> On 1 Aug 2003, <st...@apache.org> wrote:
> 
> 
>>  (b) so you can use other implementations than the windows one.
> 
> 
> Great!
> 
> I have Mono (0.25) installed on my Linux box and was trying to free
> some time to see whether I could get <csc> (the only task I'd
> currently be interested in) to work with it, it seems it is no longer
> needed.

I havent tested it...in theory the commands should just work with 
executable="msc", though we need to do a set of tests to see what really 
happens.



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


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional DotnetTest.java

Posted by Stefan Bodewig <bo...@apache.org>.
On 1 Aug 2003, <st...@apache.org> wrote:

>   (b) so you can use other implementations than the windows one.

Great!

I have Mono (0.25) installed on my Linux box and was trying to free
some time to see whether I could get <csc> (the only task I'd
currently be interested in) to work with it, it seems it is no longer
needed.

>   Specifically, Mono Csharp compiler, msc, apparently uses the same
>   syntax as csc if desired. We will have to test this...

Let me know what I can do to help.

Stefan

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