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 Sj.java
Date Thu, 24 Feb 2005 20:25:57 GMT
bodewig     2005/02/24 12:25:57

  Modified:    .        Tag: ANT_16_BRANCH WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/compilers Tag:
                        ANT_16_BRANCH DefaultCompilerAdapter.java Sj.java
  Log:
  Merge JDK 1.5 special handling and Symantec fix from HEAD
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.503.2.183 +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.182
  retrieving revision 1.503.2.183
  diff -u -r1.503.2.182 -r1.503.2.183
  --- WHATSNEW	22 Feb 2005 18:32:40 -0000	1.503.2.182
  +++ WHATSNEW	24 Feb 2005 20:25:57 -0000	1.503.2.183
  @@ -216,6 +216,9 @@
   * NPE when when <presetdef> tries to configure a task that
     cannot be instantiated. Bugzilla Report 33689.
   
  +* <javac debug="false"> created an invalid command line when running
  +  the Symantec Java compiler.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===================================
   
  
  
  
  No                   revision
  No                   revision
  1.41.2.10 +56 -5     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.9
  retrieving revision 1.41.2.10
  diff -u -r1.41.2.9 -r1.41.2.10
  --- DefaultCompilerAdapter.java	28 Jan 2005 16:39:21 -0000	1.41.2.9
  +++ DefaultCompilerAdapter.java	24 Feb 2005 20:25:57 -0000	1.41.2.10
  @@ -261,8 +261,8 @@
               } else {
                   cmd.createArgument().setValue("-g");
               }
  -        } else if (!assumeJava11()) {
  -            cmd.createArgument().setValue("-g:none");
  +        } else if (getNoDebugArgument() != null) {
  +            cmd.createArgument().setValue(getNoDebugArgument());
           }
           if (optimize) {
               cmd.createArgument().setValue("-O");
  @@ -297,14 +297,37 @@
           if (attributes.getSource() != null && !assumeJava13()) {
               cmd.createArgument().setValue("-source");
               String source = attributes.getSource();
  -            if (assumeJava14() && 
  -                (source.equals("1.1") || source.equals("1.2"))) {
  +            if ((assumeJava14() || assumeJava15())
  +                && (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
  +                // added with JDK 1.4.2 - and isn't present in 1.5.0 either
                   cmd.createArgument().setValue("1.3");
               } else {
                   cmd.createArgument().setValue(source);
               }
  +        } else if (assumeJava15() && attributes.getTarget() != null) {
  +            String t = attributes.getTarget();
  +            if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3")
  +                || t.equals("1.4")) {
  +                String s = t;
  +                if (t.equals("1.1")) {
  +                    // 1.5.0 doesn't support -source 1.1
  +                    s = "1.2";
  +                }
  +                attributes.log("", Project.MSG_WARN);
  +                attributes.log("          WARNING", Project.MSG_WARN);
  +                attributes.log("", Project.MSG_WARN);
  +                attributes.log("The -source switch defaults to 1.5 in JDK 1.5.",
  +                               Project.MSG_WARN);
  +                attributes.log("If you specify -target " + t
  +                               + " you now must also specify -source " + s
  +                               + ".", Project.MSG_WARN);
  +                attributes.log("Ant will implicitly add -source " + s
  +                               + " for you.  Please change your build file.",
  +                               Project.MSG_WARN);
  +                cmd.createArgument().setValue("-source");
  +                cmd.createArgument().setValue(s);
  +            }
           }
           return cmd;
       }
  @@ -523,5 +546,33 @@
                   && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4));
       }
   
  +    /**
  +     * Shall we assume JDK 1.5 command line switches?
  +     * @return true if JDK 1.5
  +     * @since Ant 1.6.3
  +     */
  +    protected boolean assumeJava15() {
  +        return "javac1.5".equals(attributes.getCompilerVersion())
  +            || ("classic".equals(attributes.getCompilerVersion())
  +                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5))
  +            || ("modern".equals(attributes.getCompilerVersion())
  +                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5))
  +            || ("extJavac".equals(attributes.getCompilerVersion())
  +                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5));
  +    }
  +
  +    /**
  +     * The argument the compiler wants to see if the debug attribute
  +     * has been set to false.
  +     *
  +     * <p>A return value of <code>null</code> means no argument at all.</p>
  +     *
  +     * @return "-g:none" unless we expect to invoke a JDK 1.1 compiler.
  +     *
  +     * @since Ant 1.6.3
  +     */
  +    protected String getNoDebugArgument() {
  +        return assumeJava11() ? null : "-g:none";
  +    }
   }
   
  
  
  
  1.8.2.5   +10 -2     ant/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java
  
  Index: Sj.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java,v
  retrieving revision 1.8.2.4
  retrieving revision 1.8.2.5
  diff -u -r1.8.2.4 -r1.8.2.5
  --- Sj.java	9 Mar 2004 17:01:38 -0000	1.8.2.4
  +++ Sj.java	24 Feb 2005 20:25:57 -0000	1.8.2.5
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -45,6 +45,14 @@
               executeExternalCompile(cmd.getCommandline(), firstFileName) == 0;
       }
   
  -
  +    /**
  +     * Returns null since sj either has -g for debug=true or no
  +     * argument at all.
  +     *
  +     * @since Ant 1.6.3
  +     */
  +    protected String getNoDebugArgument() {
  +        return null;
  +    }
   }
   
  
  
  

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


Mime
View raw message