ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/compilers DefaultCompilerAdapter.java
Date Fri, 29 Oct 2004 07:43:17 GMT
bodewig     2004/10/29 00:43:16

  Modified:    .        Tag: ANT_16_BRANCH build.xml
               src/main/org/apache/tools/ant/taskdefs/compilers Tag:
                        ANT_16_BRANCH DefaultCompilerAdapter.java
  Log:
  merge
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.392.2.36 +12 -27    ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ant/build.xml,v
  retrieving revision 1.392.2.35
  retrieving revision 1.392.2.36
  diff -u -r1.392.2.35 -r1.392.2.36
  --- build.xml	27 Jul 2004 14:25:09 -0000	1.392.2.35
  +++ build.xml	29 Oct 2004 07:43:16 -0000	1.392.2.36
  @@ -363,28 +363,6 @@
   
     <!--
          ===================================================================
  -         Set up a preset def for javac depending on
  -         the java version
  -       ===================================================================
  -  -->
  -
  -  <target name="javac.preset" depends="javac.preset.1.5+,javac.preset.1.5-"/>
  -  <target name="javac.preset.1.5+" depends="check_for_optional_packages"
  -          if="jdk1.5+">
  -    <presetdef name="javac.preset">
  -      <javac source="${javac.source}"/>
  -    </presetdef>
  -  </target>
  -  <target name="javac.preset.1.5-" depends="check_for_optional_packages"
  -          unless="jdk1.5+">
  -    <presetdef name="javac.preset">
  -      <javac/>
  -    </presetdef>
  -  </target>
  -
  -
  -  <!--
  -       ===================================================================
            Check to see what optional dependencies are available
          ===================================================================
     -->
  @@ -534,6 +512,7 @@
           <!-- absolute paths in CLASSPATH -->
           <contains string="${java.class.path}"
                     substring="${build.tests.resolved}"/>
  +        <istrue value="${junit.fork}"/>
         </or>
       </condition>
   
  @@ -616,17 +595,18 @@
          ===================================================================
     -->
     <target name="build"
  -          depends="prepare, check_for_optional_packages, javac.preset"
  +          depends="prepare, check_for_optional_packages"
             description="--> compiles the source code">
       <mkdir dir="${build.dir}"/>
       <mkdir dir="${build.classes}"/>
       <mkdir dir="${build.lib}"/>
   
  -    <javac.preset srcdir="${java.dir}"
  +    <javac srcdir="${java.dir}"
              destdir="${build.classes}"
              debug="${debug}"
              deprecation="${deprecation}"
              target="${javac.target}"
  +           source="${javac.source}"
              optimize="${optimize}" >
         <classpath refid="classpath"/>
   
  @@ -672,7 +652,7 @@
             </or>
           </not>
         </selector>
  -    </javac.preset>
  +    </javac>
   
       <copy todir="${build.classes}">
         <fileset dir="${java.dir}">
  @@ -905,6 +885,10 @@
             depends="compile-tests"
             description="--> creates the Apache Ant Test Utilties jar">
   
  +    <fail unless="junit.present">
  +      We cannot build the test jar unless JUnit is present,
  +      as JUnit is needed to compile the test classes.
  +    </fail>
       <jar destfile="${build.lib}/${name}-testutil.jar"
            basedir="${build.tests}">
         <patternset refid="useful.tests"/>
  @@ -1371,15 +1355,16 @@
     <target name="compile-tests" depends="build" if="junit.present">
       <mkdir dir="${build.tests}"/>
   
  -    <javac.preset srcdir="${tests.dir}"
  +    <javac srcdir="${tests.dir}"
              destdir="${build.tests}"
              debug="${debug}"
              target="${javac.target}"
  +           source="${javac.source}"
              deprecation="${deprecation}" >
         <classpath refid="tests-classpath"/>
   
         <selector refid="conditional-patterns"/>
  -    </javac.preset>
  +    </javac>
   
       <!-- Used by AntlibTest.testAntlibResource: -->
       <jar jarfile="${build.tests}/org/apache/tools/ant/taskdefs/test2-antlib.jar">
  
  
  
  No                   revision
  No                   revision
  1.41.2.7  +23 -1     ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  
  Index: DefaultCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
  retrieving revision 1.41.2.6
  retrieving revision 1.41.2.7
  diff -u -r1.41.2.6 -r1.41.2.7
  --- DefaultCompilerAdapter.java	9 Mar 2004 17:01:38 -0000	1.41.2.6
  +++ DefaultCompilerAdapter.java	29 Oct 2004 07:43:16 -0000	1.41.2.7
  @@ -296,7 +296,15 @@
           setupJavacCommandlineSwitches(cmd, true);
           if (attributes.getSource() != null && !assumeJava13()) {
               cmd.createArgument().setValue("-source");
  -            cmd.createArgument().setValue(attributes.getSource());
  +            String source = attributes.getSource();
  +            if (assumeJava14() && 
  +                (source.equals("1.1") || source.equals("1.2"))) {
  +                // support for -source 1.1 and -source 1.2 has been
  +                // added with JDK 1.4.2
  +                cmd.createArgument().setValue("1.3");
  +            } else {
  +                cmd.createArgument().setValue(source);
  +            }
           }
           return cmd;
       }
  @@ -503,6 +511,20 @@
                   && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3))
               || ("extJavac".equals(attributes.getCompilerVersion())
                   && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3));
  +    }
  +
  +    /**
  +     * Shall we assume JDK 1.4 command line switches?
  +     * @since Ant 1.6.3
  +     */
  +    protected boolean assumeJava14() {
  +        return "javac1.4".equals(attributes.getCompilerVersion())
  +            || ("classic".equals(attributes.getCompilerVersion())
  +                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4))
  +            || ("modern".equals(attributes.getCompilerVersion())
  +                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4))
  +            || ("extJavac".equals(attributes.getCompilerVersion())
  +                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4));
       }
   
   }
  
  
  

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


Mime
View raw message