stevel      2003/09/21 15:29:54

  Modified:    src/etc/testcases/taskdefs/optional dotnet.xml
               src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        DotnetCompile.java JSharp.java
               src/testcases/org/apache/tools/ant/taskdefs/optional
                        DotnetTest.java
  Added:       src/etc/testcases/taskdefs/optional/dotnet jsharp.java
  Log:
  1. remove the default library stuff from csc & the compiler.
  2. remove the new standardlib flag needed to work around (1)
  3. added a test for the jsharp compiler, and a fix to get the task to work.
  
  Revision  Changes    Path
  1.13      +78 -58    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- dotnet.xml        16 Sep 2003 08:29:08 -0000      1.12
  +++ dotnet.xml        21 Sep 2003 22:29:54 -0000      1.13
  @@ -4,11 +4,11 @@
     <property environment="env"/>
     <property name="build.dir" location="dotnet/build"/>
     <property name="src.dir" location="dotnet"/>
  -  
  +
     <property name="out.csc" location="${src.dir}/out.cs"/>
     <property name="out.app" location="${build.dir}/out.exe"/>
  -  <property name="out.type" value="exe"/>  
  -  
  +  <property name="out.type" value="exe"/>
  +
     <target name="probe_for_apps" >
      <condition property="ilasm.found">
         <or>
  @@ -26,15 +26,24 @@
         </or>
       </condition>
      <echo> csc.found=${csc.found}</echo>
  -<!--    <condition property="vbc.found">
  +   <!-- visual basic compiler -->
  +   <condition property="vbc.found">
         <or>
           <available file="vbc"     filepath="${env.PATH}" />
           <available file="vbc.exe" filepath="${env.PATH}" />
           <available file="vbc.exe" filepath="${env.Path}" />
         </or>
  -    </condition> 
  +    </condition>
      <echo> vbc.found=${vbc.found}</echo>
  -   -->
  +   <!-- visual J# compiler -->
  +   <condition property="jsharp.found">
  +      <or>
  +        <available file="vjc"     filepath="${env.PATH}" />
  +        <available file="vjc.exe" filepath="${env.PATH}" />
  +        <available file="vjc.exe" filepath="${env.Path}" />
  +      </or>
  +    </condition>
  +   <echo> jsharp.found=${jsharp.found}</echo>
   
      <!-- Mono C# compiler -->
      <condition property="mcs.found">
  @@ -64,7 +73,7 @@
         </or>
       </condition>
      <echo> ildasm.found=${ildasm.found}</echo>
  -   
  +
      <condition property="dotnetapps.found">
         <or>
           <and>
  @@ -88,31 +97,36 @@
      </condition>
      <property name="mono.executable" value="mint"/>
     </target>
  -    
  +
     <target name="init" depends="probe_for_apps">
       <mkdir dir="${build.dir}"/>
     </target>
   
     <target name="teardown">
       <delete dir="${build.dir}"/>
  -  </target>    
  -    
  +  </target>
  +
     <target name="validate_csc" depends="init">
       <fail unless="c#.found">Needed C# compiler is missing</fail>
  -  </target>  
  -    
  +  </target>
  +
     <target name="validate_ilasm" depends="init">
       <fail unless="ilasm.found">Needed ilasm is missing</fail>
  -  </target>  
  -    
  +  </target>
  +
  +  <target name="validate_jsharp" depends="init">
  +    <fail unless="jsharp.found">No vjc on the path</fail>
  +  </target>
  +
  +
     <target name="testCSC" depends="testCSC-Mono,testCSC-MS"/>
   
     <target name="testCSC-MS" depends="validate_csc" if="csc.found">
  -    <property name="testCSC.exe" 
  +    <property name="testCSC.exe"
         location="${build.dir}/ExampleCsc.exe" />
  -    <csc 
  +    <csc
         destFile="${testCSC.exe}"
  -      targetType="exe" 
  +      targetType="exe"
         >
       </csc>
       <available property="app.created" file="${testCSC.exe}"/>
  @@ -122,25 +136,24 @@
     </target>
   
     <target name="testCSC-Mono" depends="validate_csc" if="mcs.found">
  -    <property name="testCSC.exe" 
  +    <property name="testCSC.exe"
         location="${build.dir}/ExampleCsc.exe" />
  -    <csc 
  +    <csc
         destFile="${testCSC.exe}"
  -      targetType="exe" 
  +      targetType="exe"
         executable="mcs"
         includedefaultreferences="false"
  -      standardlib="true"
         >
       </csc>
       <available property="app.created" file="${testCSC.exe}"/>
       <fail unless="app.created">No app ${testCSC.exe} created</fail>
       <exec executable="${mono.executable}" failonerror="true">
         <arg value="${testCSC.exe}"/>
  -    </exec> 
  +    </exec>
       <delete file="${testCSC.exe}"/>
     </target>
   
  -  <target name="testCSCintrinsicFileset" 
  +  <target name="testCSCintrinsicFileset"
             depends="testCSCintrinsicFileset-MS,testCSCintrinsicFileset-Mono"/>
   
     <target name="testCSCintrinsicFileset-MS" depends="validate_csc" 
if="csc.found">
  @@ -167,14 +180,13 @@
         srcDir="."
         executable="mcs"
         includedefaultreferences="false"
  -      standardlib="true"
         >
       </csc>
       <available property="app.created" file="${testCSC.exe}"/>
       <fail unless="app.created">No app ${testCSC.exe} created</fail>
       <exec executable="${mono.executable}" failonerror="true">
         <arg value="${testCSC.exe}"/>
  -    </exec> 
  +    </exec>
       <delete file="${testCSC.exe}"/>
     </target>
   
  @@ -183,7 +195,7 @@
     <target name="testCSCdll-MS" depends="validate_csc" if="csc.found">
       <property name="testCSC.dll"
         location="${build.dir}/Example2.dll" />
  -    <csc 
  +    <csc
         destFile="${testCSC.dll}"
         targetType="library"
         executable="csc"
  @@ -193,33 +205,32 @@
       <available property="dll.created" file="${testCSC.dll}"/>
       <fail unless="dll.created">No file ${testCSC.dll} created</fail>
     </target>
  -  
  +
     <target name="testCSCdll-Mono" depends="validate_csc" if="mcs.found">
       <property name="testCSC.dll"
         location="${build.dir}/Example2.dll" />
  -    <csc 
  +    <csc
         destFile="${testCSC.dll}"
         targetType="library"
         executable="mcs"
         includedefaultreferences="false"
  -      standardlib="true"
         >
         <src dir="${src.dir}" includes="example2.cs"/>
       </csc>
       <available property="dll.created" file="${testCSC.dll}"/>
       <fail unless="dll.created">No file ${testCSC.dll} created</fail>
     </target>
  -  
  +
     <target name="testCscReferences"
       depends="testCscReferences-MS,testCscReferences-Mono"/>
   
     <target name="testCscReferences-MS" depends="validate_csc,testCSCdll-MS"
             if="csc.found">
  -    <property name="testCscReferences.exe" 
  +    <property name="testCscReferences.exe"
         location="${build.dir}/ExampleCsc2.exe" />
  -    <csc 
  +    <csc
         destFile="${testCscReferences.exe}"
  -      targetType="exe" 
  +      targetType="exe"
         >
         <src file="${src.dir}/example.cs"/>
         <reference file="${testCSC.dll}" />
  @@ -231,17 +242,16 @@
       <fail unless="refapp.created">No app ${testCscReferences.exe} 
created</fail>
       <exec executable="${testCscReferences.exe}" failonerror="true" />
     </target>
  -  
  +
     <target name="testCscReferences-Mono" 
depends="validate_csc,testCSCdll-Mono"
             if="mcs.found">
  -    <property name="testCscReferences.exe" 
  +    <property name="testCscReferences.exe"
         location="${build.dir}/ExampleCsc2.exe" />
  -    <csc 
  +    <csc
         destFile="${testCscReferences.exe}"
  -      targetType="exe" 
  +      targetType="exe"
         executable="mcs"
         includedefaultreferences="false"
  -      standardlib="true"
         >
         <src file="${src.dir}/example.cs"/>
         <reference file="${testCSC.dll}" />
  @@ -253,13 +263,13 @@
       <fail unless="refapp.created">No app ${testCscReferences.exe} 
created</fail>
       <exec executable="${mono.executable}" failonerror="true">
         <arg value="${testCscReferences.exe}"/>
  -    </exec> 
  +    </exec>
     </target>
   
     <target name="testILASM"  depends="validate_ilasm"  if="ilasm.found">
  -    <property name="testILASM.exe" 
  +    <property name="testILASM.exe"
         location="${build.dir}/ExampleIlasm.exe" />
  -    <ilasm 
  +    <ilasm
         destFile="${testILASM.exe}"
         targetType="exe"
         >
  @@ -268,29 +278,29 @@
       <available property="ilasm.created" file="${testILASM.exe}"/>
       <fail unless="ilasm.created">No app ${testILASM.exe} created</fail>
       <exec executable="${testILASM.exe}" failonerror="true" />
  -  </target>  
  +  </target>
   
     <!-- not including this in the test as it creates an exe in the src dir -->
  -  
  +
     <target name="testIlasmNoDestFile"  depends="validate_ilasm">
  -    <ilasm 
  -      targetType="exe" 
  +    <ilasm
  +      targetType="exe"
         >
         <src dir="${src.dir}" includes="**/*.il"/>
       </ilasm>
  -  </target>    
  -  
  +  </target>
  +
     <!-- just here to look at fileset refid conversion by hand -->
     <target name="echoFileset">
  -    <fileset id="ilasm" dir="${src.dir}" includes="**/*.il" /> 
  +    <fileset id="ilasm" dir="${src.dir}" includes="**/*.il" />
       <property name="ilasm.string" refid="ilasm"/>
       <echo>${ilasm.string}</echo>
     </target>
  -  
  +
     <target name="testILDASM"   depends="testILASM" if="ildasm.found">
  -    <property name="testILDASM.il" 
  +    <property name="testILDASM.il"
         location="${build.dir}/ExampleIldasm.il" />
  -    <ildasm 
  +    <ildasm
         srcFile="${testILASM.exe}"
         destFile="${testILDASM.il}"
         metadata="true"
  @@ -300,15 +310,25 @@
         />
       <available property="ildasm.created" file="${testILDASM.il}"/>
       <fail unless="ildasm.created">No file ${testILDASM.il} created</fail>
  -  </target>  
  +  </target>
   
     <!-- this is an error -->
     <target name="testILDASM_empty"   depends="validate_ilasm" >
  -    <ildasm/> 
  -  </target>  
  -  <target name="testILDASM_empty"   depends="validate_ilasm" >
  -    <ildasm/> 
  -  </target>  
  -  
  +    <ildasm/>
  +  </target>
  +
  +  <target name="jsharp" depends="init" if="jsharp.found" >
  +    <property name="jsharp.exe"
  +      location="${build.dir}/jsharp.exe" />
  +    <jsharpc
  +        destFile="${jsharp.exe}"
  +        targetType="exe"
  +        >
  +      <src dir="dotnet" includes="*.java"/>
  +    </jsharpc>
  +    <exec executable="${jsharp.exe}" failonerror="true" />
  +  </target>
  +
  +
   </project>
   
  
  
  
  1.17      +1 -100    
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DotnetCompile.java        21 Sep 2003 20:20:03 -0000      1.16
  +++ DotnetCompile.java        21 Sep 2003 22:29:54 -0000      1.17
  @@ -160,46 +160,6 @@
   
       protected String executable;
   
  -    protected Boolean standardLib;
  -
  -    /**
  -     *  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
  -     *  .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. To reduce the need to be explicit, here is a
  -     *  long list of the core libraries used in Beta-1 of .NET omitting the
  -     *  blatantly non portable (MS.win32.interop) and the .designer 
libraries.
  -     *  (ripping out Com was tempting) Casing is chosen to match that of the
  -     *  file system <i>exactly</i> so may work on a unix box too. there is no
  -     *  need to reference mscorlib.dll, because it is always there
  -     */
  -
  -    protected static final String[] DEFAULT_REFERENCE_LIST_DOTNET_10 = 
{"Accessibility.dll",
  -            "cscompmgd.dll",
  -            "CustomMarshalers.dll",
  -            "Mscorcfg.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"};
  -
       protected static final String REFERENCE_OPTION = "/reference:";
   
       /**
  @@ -349,22 +309,6 @@
   
   
       /**
  -     *  get default reference list
  -     *
  -     [EMAIL PROTECTED]    null or a string of references.
  -     */
  -    protected String getDefaultReferenceParameter() {
  -        if (includeDefaultReferences) {
  -            StringBuffer s = new StringBuffer("/reference:");
  -            s.append(getDefaultReferenceList());
  -            return new String(s);
  -        } else {
  -            return null;
  -        }
  -    }
  -
  -
  -    /**
        * If true, automatically includes the common assemblies
        * in dotnet, and tells the compiler to link in mscore.dll.
        *
  @@ -394,11 +338,7 @@
        [EMAIL PROTECTED]    The Parameter to CSC
        */
       protected String getIncludeDefaultReferencesParameter() {
  -        if (standardLib == null) {
  -            return "/nostdlib" + (includeDefaultReferences ? "-" : "+");
  -        } else {
  -            return null;
  -        }
  +        return "/nostdlib" + (includeDefaultReferences ? "-" : "+");
       }
   
   
  @@ -827,29 +767,6 @@
       }
   
       /**
  -     * turn standard lib support on or off.
  -     * Setting this in either direction overrides anything set in 
defaultreferences.
  -     * @param standardLib
  -     */
  -    public void setStandardLib(Boolean standardLib) {
  -        this.standardLib = standardLib;
  -    }
  -
  -
  -    /**
  -     *  get the include default references flag or null for no argument 
needed
  -     *
  -     [EMAIL PROTECTED]    The Parameter to CSC
  -     */
  -    protected String getStandardLibParameter() {
  -        if (standardLib != null) {
  -            return "/nostdlib" + (standardLib.booleanValue() ? "-" : "+");
  -        } else {
  -            return null;
  -        }
  -    }
  -
  -    /**
        *  test for a string containing something useful
        *
        [EMAIL PROTECTED]  s  string in
  @@ -874,20 +791,6 @@
       }
   
       /**
  -     * Based on DEFAULT_REFERENCE_LIST and getReferenceDelimiter(),
  -     * build the appropriate reference string for the compiler.
  -     * @return The properly delimited reference list.
  -     */
  -    public String getDefaultReferenceList() {
  -        StringBuffer referenceList = new StringBuffer();
  -        for (int index = 0; index < DEFAULT_REFERENCE_LIST_DOTNET_10.length; 
index++) {
  -            referenceList.append(DEFAULT_REFERENCE_LIST_DOTNET_10[index]);
  -            referenceList.append(getReferenceDelimiter());
  -        }
  -        return referenceList.toString();
  -    }
  -
  -    /**
        * Get the pattern for files to compile.
        * @return The compilation file pattern.
        */
  @@ -941,8 +844,6 @@
           command.addArgument("/nologo");
           command.addArgument(getAdditionalModulesParameter());
           command.addArgument(getDebugParameter());
  -        command.addArgument(getDefaultReferenceParameter());
  -        command.addArgument(getStandardLibParameter());
           command.addArgument(getDefinitionsParameter());
           command.addArgument(getExtraOptionsParameter());
           command.addArgument(getMainClassParameter());
  
  
  
  1.5       +1 -1      
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JSharp.java       1 Aug 2003 05:55:16 -0000       1.4
  +++ JSharp.java       21 Sep 2003 22:29:54 -0000      1.5
  @@ -136,7 +136,7 @@
        */
       protected void addCompilerSpecificOptions(NetCommand command) {
           if (pureJava) {
  -            command.addArgument("/x");
  +            command.addArgument("/x:all");
           }
           if (secureScoping) {
               command.addArgument("/securescoping");
  
  
  
  1.5       +6 -1      
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DotnetTest.java   6 Sep 2003 07:09:59 -0000       1.4
  +++ DotnetTest.java   21 Sep 2003 22:29:54 -0000      1.5
  @@ -151,6 +151,11 @@
                   "invalid");
       }
   
  -
  +    /**
  +     * test we can handle jsharp (if found)
  +     */
  +    public void testJsharp() throws Exception {
  +        executeTarget("jsharp");
  +    }
   }
   
  
  
  
  1.1                  
ant/src/etc/testcases/taskdefs/optional/dotnet/jsharp.java
  
  Index: jsharp.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "Ant" and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
   
  
  /**
   * this is a j# class, not a java one.
   */
  public class jsharp {
      
      public static void main(String args[]) {
                System.out.println("hello, I look like Java, but I'm really 
J#");
      }
      
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to