Re: the ScriptingMojo

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: Kartik Ohri <kartikohri13(at)gmail(dot)com>
Cc: pljava-dev(at)lists(dot)postgresql(dot)org
Subject: Re: the ScriptingMojo
Date: 2020-08-26 22:04:32
Message-ID: 5F46DC70.1080404@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

On 08/26/20 15:25, Chapman Flack wrote:

> If the nar-maven-plugin is also generating such files when it uses MSVC
> to build, then probably it also has some classes to help generating those
> files (or it uses a dependency that has some classes to help generating
> those files). It might not be too bad to end up adding that as a dependency
> of the PGXS plugin (added by a profile conditioned on Windows os) in order
> to reuse that part of its code, if it is accessible.

That stuff seems to be here, and accessible:

https://maven-nar.github.io/apidocs/com/github/maven_nar/cpptasks/ide/ProjectWriter.html

... but I have never really watched the nar-maven-plugin closely enough
on Windows to see if it even creates such a file for pljava, or just passes
everything on the command line. I don't know enough about MSVC to know if
the project file is mandatory.

In your commit cb0ceb9 I see that maybe you could get by with only the
command line.

Of course I would handle the /DNDEBUG, /DWindows, /DWIN32, and
/DPLJAVA_SO_VERSION=1.6.0-SNAPSHOT by defines.add (without the /D)
and overriding formatDefines to supply /D rather than -D. And really,
the PLJAVA_SO_VERSION=project.version should be among the base defines
supplied to any template.

I would rather have the probing be done in the probe method; it could
just have an OS name parameter and return a boolean.

"Windows-MinGW-w64" : {
probe : function(os) {
return os.startsWith('Windows') && System.gete...GW64");

"Windows-MSVC" : {
probe : function(os) {
return os.startsWith('Windows') && System.gete...VCINSTALLDIR");

or something like that, where the outer container of the templates would
be a [ ] rather than a { } so there would be a reliable order for probing
the templates. The driving code could just go down the list calling
probe(os) until one returned true, and use that one.

Regards,
-Chap

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Chapman Flack 2020-08-26 22:18:42 Re: the ScriptingMojo
Previous Message Chapman Flack 2020-08-26 19:25:02 Re: the ScriptingMojo