jmod and jlink support

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

jmod and jlink support

Craig Pell
Has there been discussion or a bug filed regarding adding tasks to
support jmod and jlink?  Now that there is no longer a separate JRE and
the new method of distributing standalone Java applications requires
jlink, this seems increasingly important.

I’ve written tasks (and corresponding tests and documentation) for both
of them, for my own personal use, but I didn’t want to make a pull
request without knowing if this has been addressed already.

I wasn’t sure whether the code is required to be Java 8 compatible.  At
the very least, I need to use the java.util.spi.ToolProvider class to
access jmod and jlink functionality, but if Java 8 compatibility is
necessary, I can always do it with reflection.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: jmod and jlink support

Stefan Bodewig
Hi Craig

On 2018-11-26, Craig Pell wrote:

> Has there been discussion or a bug filed regarding adding tasks to
> support jmod and jlink?  Now that there is no longer a separate JRE
> and the new method of distributing standalone Java applications
> requires jlink, this seems increasingly important.

At least I'm not aware of anybody actively working on either - and I
agreee it would be good to have tasks for them. Others?

There is a deprecated jlink task for an ancient tool which may cause a
bit of confusion.

> I wasn’t sure whether the code is required to be Java 8 compatible.

If it is not, then the release manager will need to build Ant with
something more recent than Java 8. As long as this still allows to set
the javac -target to 8, this is probably fine.

Ant has included tasks that have been conditional on recent JDKs for a
long time. I.e. we've had tasks that required Java 5 to compile even
back when the base line was Java 1.3.

You can take a look at the build file for 1.8.4 to see how we handled it
back then: https://github.com/apache/ant/blob/rel/1.8.4/build.xml#L174
is the starting point to see how/where we dealt with those classes.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: jmod and jlink support

Craig Pell
>> Has there been discussion or a bug filed regarding adding tasks to
>> support jmod and jlink?  Now that there is no longer a separate JRE
>> and the new method of distributing standalone Java applications
>> requires jlink, this seems increasingly important.
>
> There is a deprecated jlink task for an ancient tool which may cause a
> bit of confusion.

My task is simply named <link>.  And I’ve added a short note at the
start of <jlink>’s documentation, referring readers to <link>.

>> I wasn’t sure whether the code is required to be Java 8 compatible.
>
> If it is not, then the release manager will need to build Ant with
> something more recent than Java 8. As long as this still allows to set
> the javac -target to 8, this is probably fine.
>
> Ant has included tasks that have been conditional on recent JDKs for a
> long time. I.e. we've had tasks that required Java 5 to compile even
> back when the base line was Java 1.3.
>
> You can take a look at the build file for 1.8.4 to see how we handled it
> back then: https://github.com/apache/ant/blob/rel/1.8.4/build.xml#L174
> is the starting point to see how/where we dealt with those classes.

I added a "needs.jdk9+" selector (and added use of it to the
conditional-patterns aggregate selector).  But bootstrap.sh ignores it
and attempts to build all files in the ‘taskdefs’ package, so I never
get a chance to see the selector in action.

Should I modify bootstrap.sh and bootstrap.bat to exclude the newer
tasks if using a Java version less than 9?

Or am I misunderstanding the goal?  Are you suggesting that future
versions of Ant should just be built with Java 9 (or later)?  If so,
that would suggest that the "needs.jdk9+" selector is not needed, right?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: jmod and jlink support

Gintautas Grigelionis
On Fri, 30 Nov 2018 at 19:25, Craig Pell <[hidden email]> wrote:

> Or am I misunderstanding the goal?  Are you suggesting that future
> versions of Ant should just be built with Java 9 (or later)?  If so,
> that would suggest that the "needs.jdk9+" selector is not needed, right?
>

I believe the goal is to compile Java 9+ classes when JRE 9+ is available,
and thus avoid branching.
So the selector only works when JRE 8 is used, which is the current
baseline, but custom versions of Ant can be built.
See
https://builds.apache.org/view/A/view/Ant/job/Ant-Build-Matrix-master-Linux/
Reply | Threaded
Open this post in threaded view
|

Re: jmod and jlink support

Stefan Bodewig
In reply to this post by Craig Pell
Hi Craig

On 2018-11-30, Craig Pell wrote:

>>> Has there been discussion or a bug filed regarding adding tasks to
>>> support jmod and jlink?  Now that there is no longer a separate JRE
>>> and the new method of distributing standalone Java applications
>>> requires jlink, this seems increasingly important.

>> There is a deprecated jlink task for an ancient tool which may cause a
>> bit of confusion.

> My task is simply named <link>.  And I’ve added a short note at the
> start of <jlink>’s documentation, referring readers to <link>.

Sounds good.

>>> I wasn’t sure whether the code is required to be Java 8 compatible.

>> If it is not, then the release manager will need to build Ant with
>> something more recent than Java 8. As long as this still allows to set
>> the javac -target to 8, this is probably fine.

>> Ant has included tasks that have been conditional on recent JDKs for a
>> long time. I.e. we've had tasks that required Java 5 to compile even
>> back when the base line was Java 1.3.

>> You can take a look at the build file for 1.8.4 to see how we handled it
>> back then: https://github.com/apache/ant/blob/rel/1.8.4/build.xml#L174
>> is the starting point to see how/where we dealt with those classes.

> I added a "needs.jdk9+" selector (and added use of it to the
> conditional-patterns aggregate selector).  But bootstrap.sh ignores it
> and attempts to build all files in the ‘taskdefs’ package, so I never
> get a chance to see the selector in action.

You will see it when you build with Java8.

> Should I modify bootstrap.sh and bootstrap.bat to exclude the newer
> tasks if using a Java version less than 9?

This is what the selector is supposed to do. No need to touch any of the
scripts. One thing that I should have mentioned, the classes that
require Java 9 must not live inside the taskdefs package directly
(rather in org.apache.tools.ant.taskdefs.optional or similar) so that
bootstrap won't trip over it.

> Or am I misunderstanding the goal?  Are you suggesting that future
> versions of Ant should just be built with Java 9 (or later)?

No.

The baseline for Ant 1.10.x is supposed to be Java 8 and it must be
possible to build Ant there. But when we create binary releases we try
to build all optional parts as well. Which in this case means the
release manager will need to build using Java 9.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: jmod and jlink support

Craig Pell
>> Should I modify bootstrap.sh and bootstrap.bat to exclude the newer
>> tasks if using a Java version less than 9?
>
> This is what the selector is supposed to do. No need to touch any of the
> scripts. One thing that I should have mentioned, the classes that
> require Java 9 must not live inside the taskdefs package directly
> (rather in org.apache.tools.ant.taskdefs.optional or similar) so that
> bootstrap won't trip over it.

That was what I needed to know!  It now builds in Java 8, 9, 10, and 11.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]