Hello Stefan,

On 08/02/22 1:15 am, Stefan Bodewig wrote:
On 2022-02-07, Jaikiran Pai wrote:

So the launch scripts (the Linux one and the .bat for Windows one)
have both been updated to set this system property only for Java 18
and 19. I expect this to be a temporary thing till the new API is
available. Once the new API is available, I think we should just get
rid of this setting of system property even for Java 18 and 19 (since
I don't expect many to be using these releases once the newer versions
are available).
You are more optimistic than me WRT a replacement API. :-)

If you believe this is just going to be an issue for two or three
releases then I can live with a lenghty if. I want to avoid that we need
to cut a new release with every new Java EA just because the replacement
API still hasn't been added.

You have a valid point. In fact, if I had completed these changes a few weeks back and proposed a release of Ant, it would have had changes only for Java 18 (and nothing for Java 19). That would have meant another round of changes plus a release once we saw the Java 19 EA available. So although I think the new API might be available in some release soon, I haven't seen any discussion or plans about it yet. So I think it's better and safer to go with the approach that you suggest in one of the mails, to enumerate the exact set of Java versions where we don't want to set this system property.


Ultimately the one I committed ant.bat now launches the Java command
twice and expects it to dump certain property values, which are then
used by "find" to see if the version is 18 or 19.
Ouch

Would

jrunscript -e 
"print(java.lang.System.getProperty('java.specification.version'))"

work? TBH I'm not sure jrunscript is available in a JRE rather than a
JDK for versions where there actually is a difference.

Hadn't heard of jrunscript before. I'll experiment a bit.

Also findstr[1] looks as if you could use it to bring the number of
extra jvm executions down to one as it should allow regexes so

find "java.specification.version = 1[89]"

may work - unless Java 20 still comes without the replacement API as it
looks as if the regex subset supported by findstr doesn't include
alternatives.

I had thought of findstr at one point, but wasn't sure if I should use it. More than a decade back, findstr was used in one of the launch scripts of JBoss application server. (During those days) it turned out that the findstr command wasn't available in all versions of Windows and there ended up being a question on the JBoss forums almost every other day on the launch script failure. To an extent that it had a FAQ page of its own. I don't know if findstr not being available in all Windows versions should be a concern in 2022, but I'll read up and investigate a bit.

With these changes the CI builds which run Ant tests against Java 18,
19 and previous version like Java 17 now work fine. However, like I
said my scripting skills are minimal, so if any of these changes in
these scripts can be done in a better way, please feel free to do
so. I would do it myself, but it's going to take me trial and error
methods to get it right :)
It would be completely unfair to place the burden on you. I can live
with the current solution even though I'm not happy with it. I might
find a bit of time to experiment this week, but I can't promise
anything.

I too will experiment with some of the suggestions you and others have provided in this discussion and see how better we can improve this.

-Jaikiran



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

Reply via email to