public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chapman Flack <[email protected]>
To: Kartik Ohri <[email protected]>
Cc: [email protected]
Subject: the ReportScriptingMojo
Date: Sat, 8 Aug 2020 11:29:56 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAASLQ4M0uvNj0EyMWWNsizT1KtnWx0WFbk89ud9EVHZbu12LMg@mail.gmail.com>
References: <CAASLQ4Mva7dAXiS_c9OLhV4VzNHF=XNKJosuS5gtZTB6b4TW1Q@mail.gmail.com>
	<[email protected]>
	<CAASLQ4POay=ZLsdOb02n6NqwTn7MGyyWQprcCEo2Wm6Y6rStEw@mail.gmail.com>
	<[email protected]>
	<CAASLQ4Ny+VWWH=_AR+=7gjXinUScybraOJxBUaG5AmLZmx+NPQ@mail.gmail.com>
	<[email protected]>
	<CAASLQ4OknEQTpSeoBfyAZR1na-EyL+AtN9t0fPGyv5DfWJOSWA@mail.gmail.com>
	<CAASLQ4NHROvOq-rUz6Jn0dUd7oAq3_P655WNeqKksNBqFtAGgw@mail.gmail.com>
	<CAASLQ4OCLUYXpkk0tTioz8=zc4UEbAm-Whgp_5K7uy-5hZdjKA@mail.gmail.com>
	<[email protected]>
	<CAASLQ4M8cN20L7cyVEgks9qdnfsXH4ci7iQbmyi4v_y0W85eLA@mail.gmail.com>
	<[email protected]>
	<CAASLQ4MLFnD3v_fqrUj+Bwc9MSBG-ATet3J7UXebzXHTH_si3A@mail.gmail.com>
	<[email protected]>
	<CAASLQ4O5Wfk1hH6nO_1PDUbRcpUywvTxq7e99aCJ4RPeMmssAw@mail.gmail.com>
	<[email protected]>
	<CAASLQ4M0uvNj0EyMWWNsizT1KtnWx0WFbk89ud9EVHZbu12LMg@mail.gmail.com>

Hi Kartik,

There are a couple more methods it might be useful for getScriptEngine
to load into a script engine by default.

If you look in the javadoc script for pljava-examples, there's a test
for whether the saxon-examples profile is active.

It's an easy test, but I can foresee it showing up in compiling scripts
as well, so a simple boolean isProfileActive(String id) method is probably
worth supplying.

If supplying one from PGXSUtils, I would probably also have the method
check that the argument profile name is even a known profile in the POM,
and warn if it isn't. That would catch cases where somebody edits a POM
and deletes a profile, not realizing a script was checking for it.
I think all the known profiles are in project.getModel().getProfiles().




You'll also see the -examples script generates the -classpath argument
by stringing together project.compileClasspathElements. That works for
-examples because the -examples code isn't modular.

I did not change the scripts in pljava/ and pljava-api/ because those
are modular code, and need to generate a --module-path instead. In
general, Maven's compileClasspathElements might include both: elements
that belong on the module path, elements that belong on the class path
because they aren't modules.

So that suggests a useful method like

Map<String,String> buildPaths(List<String> elements)

where you could pass it a list of elements (from compileClasspathElements
or runtimeClasspathElements, etc.) and get back a map m such that
m['classpath'] has all the elements that aren't modules, and
m['modulepath'] has the elements that are (both with pathSeparator between
elements).

An element is a module if it is a directory and has a module-info.class,
or it is a jar and either contains a module-info.class or has an
Automatic-Module-Name entry in its manifest.

Such a method would also be a good place for checking that no element
contains pathSeparator as part of its name, as that would lead to a
malformed path,

Regards,
-Chap





view thread (78+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: the ReportScriptingMojo
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox