Re: PL/Java new build plugin

From: Kartik Ohri <kartikohri13(at)gmail(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: pljava-dev(at)lists(dot)postgresql(dot)org
Subject: Re: PL/Java new build plugin
Date: 2020-07-22 03:13:36
Message-ID: CAASLQ4Ouw1hCHVtSC5XG7Fb-GoO0YAf4_PwsQc=22CvEzhQo6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

On Wed, Jul 22, 2020 at 3:03 AM Chapman Flack <chap(at)anastigmatix(dot)net> wrote:

> On 07/21/20 17:00, Kartik Ohri wrote:
> >> I had set JAVA_HOME and ran javac -version which pointed that Java 15
> was
> > being used but I tested again to be sure.I specified the Java Home in the
> > mvn statement and ran with debug flags to see which version was running.
> > You can see around line 473 here
> > https://travis-ci.com/github/amCap1712/pljava/jobs/363479322. The
> result is
> > the same: the script engine finds nashorn but not graal.
>
> How odd. When I run the tip of test-graal here with 15-ea, I simply get
> "No suitable engine found for specified engine name or mime type".
>
> If I go to the parent-project POM and edit the nashorngone profile
> so that the two graal jars are added as dependencies of pljava-pgxs,
>

I had missed it during the merge. I had overlooked that the jars were added
as a dependency of maven-antrun. So, I added this fix but the CI failed (
https://travis-ci.com/github/amCap1712/pljava/jobs/363573395 commit SHA
8aa3e5c07108d944b66f164ad0b70082148a45b1 ) which made me realise that when
the profile is activated the plugin does not exist. The error message also
shows this. Maven looks in local and online repositories. Adding
dependencies directly to plava-pgxs's pom works. I think we could replicate
the profile in pgxs to ensure graal is only added as a dependency if needed.

then I run it again, it finds graal. The dependency-collector debug
> output now shows the dependencies:
>
> [DEBUG] org.postgresql:pljava-pgxs:jar:0.0.1-SNAPSHOT:
> [DEBUG] org.graalvm.js:js:jar:20.1.0:runtime
> [DEBUG] org.graalvm.regex:regex:jar:20.1.0:runtime
> [DEBUG] org.graalvm.truffle:truffle-api:jar:20.1.0:runtime
> [DEBUG] org.graalvm.sdk:graal-sdk:jar:20.1.0:runtime
> [DEBUG] org.ow2.asm:asm:jar:7.1:runtime
> [DEBUG] org.ow2.asm:asm-tree:jar:7.1:runtime
> [DEBUG] org.ow2.asm:asm-analysis:jar:7.1:runtime
> [DEBUG] org.ow2.asm:asm-commons:jar:7.1:runtime
> [DEBUG] org.ow2.asm:asm-util:jar:7.1:runtime
> [DEBUG] com.ibm.icu:icu4j:jar:66.1:runtime
> [DEBUG] org.graalvm.js:js-scriptengine:jar:20.1.0:runtime
> [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.1:runtime
> [DEBUG] Created new class realm
> plugin>org.postgresql:pljava-pgxs:0.0.1-SNAPSHOT
> [DEBUG] Importing foreign packages into class realm
> plugin>org.postgresql:pljava
> -pgxs:0.0.1-SNAPSHOT
> [DEBUG] Imported: < project>org.postgresql:pljava-so:1.6.0-SNAPSHOT
> [DEBUG] Populating class realm
> plugin>org.postgresql:pljava-pgxs:0.0.1-SNAPSHOT
> [DEBUG] Included: org.postgresql:pljava-pgxs:jar:0.0.1-SNAPSHOT
> [DEBUG] Included: org.graalvm.js:js:jar:20.1.0
> [DEBUG] Included: org.graalvm.regex:regex:jar:20.1.0
> [DEBUG] Included: org.graalvm.truffle:truffle-api:jar:20.1.0
> [DEBUG] Included: org.graalvm.sdk:graal-sdk:jar:20.1.0
> [DEBUG] Included: org.ow2.asm:asm:jar:7.1
> [DEBUG] Included: org.ow2.asm:asm-tree:jar:7.1
> [DEBUG] Included: org.ow2.asm:asm-analysis:jar:7.1
> [DEBUG] Included: org.ow2.asm:asm-commons:jar:7.1
> [DEBUG] Included: org.ow2.asm:asm-util:jar:7.1
> [DEBUG] Included: com.ibm.icu:icu4j:jar:66.1
> [DEBUG] Included: org.graalvm.js:js-scriptengine:jar:20.1.0
> [DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:1.1
>
> and the logging you added:
>
> [ERROR] Graal.js
> [INFO] setProjectProperty("PGSQL_BINDIR",
> ...
> [DEBUG] com(dot)oracle(dot)truffle(dot)js(dot)scriptengine(dot)GraalJSScriptEngine(at)66dfc523
>
>
> So I think the dependency info explains why your run was not finding
> graal. I remain baffled regarding how your run was managing to find
> Nashorn instead. I wonder if you downloaded a more recent 15-ea than
> I have, and there was a chorus of complaints and they put Nashorn back
> in for now?
>
I was using the latest JDK 15+32. I checked the release notes which mark
the nashorn removal as delivered. But they go only upto 15+29 till there
is no mention of nashorn again. So, I did a build again and checked again.
This time with automated travis build instead of debug and it detects only
Graal (no nashorn). Despite specifying JAVA_HOME with maven, it seems it
was using a different Java installation or I made an inadvertent error in
the JAVA_HOME due to which it used the wrong installation, :( but plausible.

I would be interested to see what a similar Travis run will do after
> making sure the graal dependencies are listed: will it then find nashorn,
> or graal?
>
I did a build with JDK 14 with the dependencies to find this out.
Interestingly, it fails when both coexist.
https://travis-ci.com/github/amCap1712/pljava/jobs/363575841 commit
SHA b5950dedc7018470e5331f20d9300344a00f40ce I think we will need to add
the profile in that case then.

(The Java 15 build failing in this case is probably because of some error I
made while merging the denashorn branch since the builds on the branch
itself were passing.)

Regards,
Kartik

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Kartik Ohri 2020-07-22 20:11:23 Re: PL/Java new build plugin
Previous Message Chapman Flack 2020-07-22 03:00:10 Re: PL/Java new build plugin