You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jk...@apache.org on 2019/08/25 09:44:46 UTC

[ant] branch master updated: Fixed regression on javac version selection in case build.compiler property is set.

This is an automated email from the ASF dual-hosted git repository.

jkf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new aac25de  Fixed regression on javac version selection in case build.compiler property is set.
     new 5387d84  Merge branch 'master' of https://gitbox.apache.org/repos/asf/ant
aac25de is described below

commit aac25de91c3301f445445dea835cdfe5f9121891
Author: jkf <jm...@famkruithof.net>
AuthorDate: Sun Aug 25 11:42:58 2019 +0200

    Fixed regression on javac version selection in case build.compiler property is set.
---
 .../taskdefs/compilers/DefaultCompilerAdapter.java | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
index c996e38..ec2d9d8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
@@ -796,8 +796,7 @@ public abstract class DefaultCompilerAdapter
      */
     @Deprecated
     protected boolean assumeJava9() {
-        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
-                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9);
+        return assumeJava9Plus() && !assumeJava10Plus();
     }
 
     /**
@@ -806,9 +805,9 @@ public abstract class DefaultCompilerAdapter
      * @since Ant 1.10.2
      */
     protected boolean assumeJava9Plus() {
-        return "javac1.9".equals(attributes.getCompilerVersion())
-            || "javac9".equals(attributes.getCompilerVersion())
-            || assumeJava10Plus();
+        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
+                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9)
+                || assumeJava10Plus();
     }
 
     /**
@@ -817,7 +816,11 @@ public abstract class DefaultCompilerAdapter
      * @since Ant 1.10.7
      */
     protected boolean assumeJava10Plus() {
-        return "javac10+".equals(attributes.getCompilerVersion());
+        return "javac10+".equals(attributes.getCompilerVersion())
+                || (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_10)
+                    && ("classic".equals(attributes.getCompilerVersion())
+                    || "modern".equals(attributes.getCompilerVersion())
+                    || "extJavac".equals(attributes.getCompilerVersion())));
     }
     
     /**
@@ -825,7 +828,12 @@ public abstract class DefaultCompilerAdapter
      * @since Ant 1.8.3
      */
     private boolean assumeJavaXY(final String javacXY, final String javaEnvVersionXY) {
-        return javacXY.equals(attributes.getCompilerVersion());
+        String compilerVersion = attributes.getCompilerVersion();
+        return javacXY.equals(compilerVersion) ||
+                (JavaEnvUtils.isJavaVersion(javaEnvVersionXY)
+                        && ("classic".equals(compilerVersion)
+                        || "modern".equals(compilerVersion)
+                        || "extJavac".equals(compilerVersion)));
     }
 
     /**


Re: [ant] branch master updated: Fixed regression on javac version selection in case build.compiler property is set.

Posted by Martijn <jm...@famkruithof.net>.
Hi,

yes indeed, fork true, executable pointing to jdk 11, ant running on top 
of jdk 8. I do intend to have a look at that.

Br Martijn


Op 25-8-2019 om 14:00 schreef Jaikiran Pai:
> Thank you Martijn, your commit does indeed fixes the issues I was
> running into.
>
> On 25/08/19 3:18 PM, Martijn Kruithof wrote:
>> This still leaves an issue,
>>
>> If ant is run using java 8 and an external compiler java 11 is used,
>> the correct compiler version is not determined, this is also the case
>> in the ant 1.10.6 release.
> Do you mean using the "executable" attribute of the javac task to point
> to an external compiler?
>
> -Jaikiran
>
>
>> On 25-08-19 11:44, jkf@apache.org wrote:
>>> This is an automated email from the ASF dual-hosted git repository.
>>>
>>> jkf pushed a commit to branch master
>>> in repository https://gitbox.apache.org/repos/asf/ant.git
>>>
>>>
>>> The following commit(s) were added to refs/heads/master by this push:
>>>        new aac25de  Fixed regression on javac version selection in
>>> case build.compiler property is set.
>>>        new 5387d84  Merge branch 'master' of
>>> https://gitbox.apache.org/repos/asf/ant
>>> aac25de is described below
>>>
>>> commit aac25de91c3301f445445dea835cdfe5f9121891
>>> Author: jkf <jm...@famkruithof.net>
>>> AuthorDate: Sun Aug 25 11:42:58 2019 +0200
>>>
>>>       Fixed regression on javac version selection in case
>>> build.compiler property is set.
>>> ---
>>>    .../taskdefs/compilers/DefaultCompilerAdapter.java | 22
>>> +++++++++++++++-------
>>>    1 file changed, 15 insertions(+), 7 deletions(-)
>>>
>>> diff --git
>>> a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>>> b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>>>
>>> index c996e38..ec2d9d8 100644
>>> ---
>>> a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>>> +++
>>> b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>>> @@ -796,8 +796,7 @@ public abstract class DefaultCompilerAdapter
>>>         */
>>>        @Deprecated
>>>        protected boolean assumeJava9() {
>>> -        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
>>> -                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9);
>>> +        return assumeJava9Plus() && !assumeJava10Plus();
>>>        }
>>>          /**
>>> @@ -806,9 +805,9 @@ public abstract class DefaultCompilerAdapter
>>>         * @since Ant 1.10.2
>>>         */
>>>        protected boolean assumeJava9Plus() {
>>> -        return "javac1.9".equals(attributes.getCompilerVersion())
>>> -            || "javac9".equals(attributes.getCompilerVersion())
>>> -            || assumeJava10Plus();
>>> +        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
>>> +                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9)
>>> +                || assumeJava10Plus();
>>>        }
>>>          /**
>>> @@ -817,7 +816,11 @@ public abstract class DefaultCompilerAdapter
>>>         * @since Ant 1.10.7
>>>         */
>>>        protected boolean assumeJava10Plus() {
>>> -        return "javac10+".equals(attributes.getCompilerVersion());
>>> +        return "javac10+".equals(attributes.getCompilerVersion())
>>> +                ||
>>> (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_10)
>>> +                    &&
>>> ("classic".equals(attributes.getCompilerVersion())
>>> +                    || "modern".equals(attributes.getCompilerVersion())
>>> +                    ||
>>> "extJavac".equals(attributes.getCompilerVersion())));
>>>        }
>>>              /**
>>> @@ -825,7 +828,12 @@ public abstract class DefaultCompilerAdapter
>>>         * @since Ant 1.8.3
>>>         */
>>>        private boolean assumeJavaXY(final String javacXY, final String
>>> javaEnvVersionXY) {
>>> -        return javacXY.equals(attributes.getCompilerVersion());
>>> +        String compilerVersion = attributes.getCompilerVersion();
>>> +        return javacXY.equals(compilerVersion) ||
>>> +                (JavaEnvUtils.isJavaVersion(javaEnvVersionXY)
>>> +                        && ("classic".equals(compilerVersion)
>>> +                        || "modern".equals(compilerVersion)
>>> +                        || "extJavac".equals(compilerVersion)));
>>>        }
>>>          /**
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>

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


Re: [ant] branch master updated: Fixed regression on javac version selection in case build.compiler property is set.

Posted by Jaikiran Pai <ja...@apache.org>.
Thank you Martijn, your commit does indeed fixes the issues I was
running into.

On 25/08/19 3:18 PM, Martijn Kruithof wrote:
> This still leaves an issue,
>
> If ant is run using java 8 and an external compiler java 11 is used,
> the correct compiler version is not determined, this is also the case
> in the ant 1.10.6 release.

Do you mean using the "executable" attribute of the javac task to point
to an external compiler?

-Jaikiran


>
> On 25-08-19 11:44, jkf@apache.org wrote:
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> jkf pushed a commit to branch master
>> in repository https://gitbox.apache.org/repos/asf/ant.git
>>
>>
>> The following commit(s) were added to refs/heads/master by this push:
>>       new aac25de  Fixed regression on javac version selection in
>> case build.compiler property is set.
>>       new 5387d84  Merge branch 'master' of
>> https://gitbox.apache.org/repos/asf/ant
>> aac25de is described below
>>
>> commit aac25de91c3301f445445dea835cdfe5f9121891
>> Author: jkf <jm...@famkruithof.net>
>> AuthorDate: Sun Aug 25 11:42:58 2019 +0200
>>
>>      Fixed regression on javac version selection in case
>> build.compiler property is set.
>> ---
>>   .../taskdefs/compilers/DefaultCompilerAdapter.java | 22
>> +++++++++++++++-------
>>   1 file changed, 15 insertions(+), 7 deletions(-)
>>
>> diff --git
>> a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>> b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>>
>> index c996e38..ec2d9d8 100644
>> ---
>> a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>> +++
>> b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
>> @@ -796,8 +796,7 @@ public abstract class DefaultCompilerAdapter
>>        */
>>       @Deprecated
>>       protected boolean assumeJava9() {
>> -        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
>> -                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9);
>> +        return assumeJava9Plus() && !assumeJava10Plus();
>>       }
>>         /**
>> @@ -806,9 +805,9 @@ public abstract class DefaultCompilerAdapter
>>        * @since Ant 1.10.2
>>        */
>>       protected boolean assumeJava9Plus() {
>> -        return "javac1.9".equals(attributes.getCompilerVersion())
>> -            || "javac9".equals(attributes.getCompilerVersion())
>> -            || assumeJava10Plus();
>> +        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
>> +                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9)
>> +                || assumeJava10Plus();
>>       }
>>         /**
>> @@ -817,7 +816,11 @@ public abstract class DefaultCompilerAdapter
>>        * @since Ant 1.10.7
>>        */
>>       protected boolean assumeJava10Plus() {
>> -        return "javac10+".equals(attributes.getCompilerVersion());
>> +        return "javac10+".equals(attributes.getCompilerVersion())
>> +                ||
>> (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_10)
>> +                    &&
>> ("classic".equals(attributes.getCompilerVersion())
>> +                    || "modern".equals(attributes.getCompilerVersion())
>> +                    ||
>> "extJavac".equals(attributes.getCompilerVersion())));
>>       }
>>             /**
>> @@ -825,7 +828,12 @@ public abstract class DefaultCompilerAdapter
>>        * @since Ant 1.8.3
>>        */
>>       private boolean assumeJavaXY(final String javacXY, final String
>> javaEnvVersionXY) {
>> -        return javacXY.equals(attributes.getCompilerVersion());
>> +        String compilerVersion = attributes.getCompilerVersion();
>> +        return javacXY.equals(compilerVersion) ||
>> +                (JavaEnvUtils.isJavaVersion(javaEnvVersionXY)
>> +                        && ("classic".equals(compilerVersion)
>> +                        || "modern".equals(compilerVersion)
>> +                        || "extJavac".equals(compilerVersion)));
>>       }
>>         /**
>>

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


Re: [ant] branch master updated: Fixed regression on javac version selection in case build.compiler property is set.

Posted by Martijn Kruithof <jk...@apache.org>.
This still leaves an issue,

If ant is run using java 8 and an external compiler java 11 is used, the 
correct compiler version is not determined, this is also the case in the 
ant 1.10.6 release.

On 25-08-19 11:44, jkf@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
>
> jkf pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/ant.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
>       new aac25de  Fixed regression on javac version selection in case build.compiler property is set.
>       new 5387d84  Merge branch 'master' of https://gitbox.apache.org/repos/asf/ant
> aac25de is described below
>
> commit aac25de91c3301f445445dea835cdfe5f9121891
> Author: jkf <jm...@famkruithof.net>
> AuthorDate: Sun Aug 25 11:42:58 2019 +0200
>
>      Fixed regression on javac version selection in case build.compiler property is set.
> ---
>   .../taskdefs/compilers/DefaultCompilerAdapter.java | 22 +++++++++++++++-------
>   1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
> index c996e38..ec2d9d8 100644
> --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
> +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
> @@ -796,8 +796,7 @@ public abstract class DefaultCompilerAdapter
>        */
>       @Deprecated
>       protected boolean assumeJava9() {
> -        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
> -                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9);
> +        return assumeJava9Plus() && !assumeJava10Plus();
>       }
>   
>       /**
> @@ -806,9 +805,9 @@ public abstract class DefaultCompilerAdapter
>        * @since Ant 1.10.2
>        */
>       protected boolean assumeJava9Plus() {
> -        return "javac1.9".equals(attributes.getCompilerVersion())
> -            || "javac9".equals(attributes.getCompilerVersion())
> -            || assumeJava10Plus();
> +        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
> +                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9)
> +                || assumeJava10Plus();
>       }
>   
>       /**
> @@ -817,7 +816,11 @@ public abstract class DefaultCompilerAdapter
>        * @since Ant 1.10.7
>        */
>       protected boolean assumeJava10Plus() {
> -        return "javac10+".equals(attributes.getCompilerVersion());
> +        return "javac10+".equals(attributes.getCompilerVersion())
> +                || (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_10)
> +                    && ("classic".equals(attributes.getCompilerVersion())
> +                    || "modern".equals(attributes.getCompilerVersion())
> +                    || "extJavac".equals(attributes.getCompilerVersion())));
>       }
>       
>       /**
> @@ -825,7 +828,12 @@ public abstract class DefaultCompilerAdapter
>        * @since Ant 1.8.3
>        */
>       private boolean assumeJavaXY(final String javacXY, final String javaEnvVersionXY) {
> -        return javacXY.equals(attributes.getCompilerVersion());
> +        String compilerVersion = attributes.getCompilerVersion();
> +        return javacXY.equals(compilerVersion) ||
> +                (JavaEnvUtils.isJavaVersion(javaEnvVersionXY)
> +                        && ("classic".equals(compilerVersion)
> +                        || "modern".equals(compilerVersion)
> +                        || "extJavac".equals(compilerVersion)));
>       }
>   
>       /**
>