Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4S7Q-0002X4-SC for pljava-dev@arkaria.postgresql.org; Sat, 08 Aug 2020 16:54:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k4S7P-0004dq-EH for pljava-dev@arkaria.postgresql.org; Sat, 08 Aug 2020 16:54:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4S7P-0004dj-33 for pljava-dev@lists.postgresql.org; Sat, 08 Aug 2020 16:54:51 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k4S7M-0001nB-Cv for pljava-dev@lists.postgresql.org; Sat, 08 Aug 2020 16:54:50 +0000 Received: by mail-ed1-x535.google.com with SMTP id bs17so3472029edb.1 for ; Sat, 08 Aug 2020 09:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yFeEcAVbEM/8GJDbU7AYYIwntBmFWxsTxIb5lNQRnCo=; b=RtcY0o5Qa5kNQ8L4rYckuCU8OVpMz+1vpHhIyxNju6RMHLYbZ8p/07sgYwqQ768sww ORIjTouW4xqrFr6WFkGivhcLmuUyexTsAO04f+xjxxphpazkDzaqrjtkvFnZbBBMFprs bftpYcrsXOzWJtLg4zGu+KCtahuq/NJNr/Wwr157A8wVMGsNdqdTtv5m5ZEqYJ4RfVxq +qZw0aYC3wDuN8CX+COg+AZNmR2AE6tt3vDophASewX4aA9oE4uiNdgBOqq7GA9DTQSy viNQXGuoWCDg1hMyXgugfAGs2Paov1YRYSCa9O0og2MW4v2Cz8jCv/BrCLRhyXI9gwcc du6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yFeEcAVbEM/8GJDbU7AYYIwntBmFWxsTxIb5lNQRnCo=; b=sx09GgGG7b08n9GrgqEKKvRuWloMlqFvGX4khNefkfBuGGLmMABavYwAgi565xlSZZ NDJEbJ9QQXfED3Af4q0kQD0lthz5M1OHhyoBGW9Ue0V3fig0p62CTClvNseX/Xz9KeAM TAESFcfVQbBfxjxAfGiIWufsj+kMHq608AEW9yRWE94xjzSdsD3rnV8YpAHsUiY6KKtd 86TXlko6qXjTp03ATt0Xw2w3fZbyb6EGwbFaNIIwN0r7tW7zXNoGLrqrAG8NTPG68E1C SB8HS8iYPmJjVmcJSbexHK8nBK1HhD7UZ3FirBNbn7FuaVGBTb7YXCbhGlxi0kr9ou8+ 8EeQ== X-Gm-Message-State: AOAM532+hKkfZp4NC2yRThJR3b0nvqq8eLyOLhR9N5pdEONXrbEYg1pz 8LpVhW2BrocnjtswzlMZs3NnPSAcq2I7/ZmG8us= X-Google-Smtp-Source: ABdhPJxZt4nvTB1QMi7VTAs9NfiQghRBjSWQQ5NJNwvjaR2pKvj4NKMdCPLz2083nkP+vlKxq4RXmrkWOcRPC3ncMdY= X-Received: by 2002:aa7:d145:: with SMTP id r5mr13570994edo.323.1596905686105; Sat, 08 Aug 2020 09:54:46 -0700 (PDT) MIME-Version: 1.0 References: <5F22DF79.2090701@anastigmatix.net> <5F230337.3040406@anastigmatix.net> <5F232EBB.9030208@anastigmatix.net> <5F278CCE.1090006@anastigmatix.net> <5F2897AF.9040909@anastigmatix.net> <5F2A29E4.2000803@anastigmatix.net> <5F2EB313.8090706@anastigmatix.net> <5F2EC4F4.3080608@anastigmatix.net> In-Reply-To: <5F2EC4F4.3080608@anastigmatix.net> From: Kartik Ohri Date: Sat, 8 Aug 2020 22:24:27 +0530 Message-ID: Subject: Re: the ReportScriptingMojo To: Chapman Flack Cc: pljava-dev@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000029034105ac609428" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000029034105ac609428 Content-Type: text/plain; charset="UTF-8" On Sat, Aug 8, 2020 at 8:59 PM Chapman Flack wrote: > 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 buildPaths(List 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 > Yeah, it is a good idea to have these methods. I'll work on this soon. Regards, Kartik --00000000000029034105ac609428 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Aug 8, 2020 at 8:59 PM Chapman Fl= ack <chap@anastigmatix.net&= gt; wrote:
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<= br> 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<= br> 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<= br> 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

Yeah, it is a good idea to have t= hese methods. I'll work on this soon.
Regards,
Kart= ik
--00000000000029034105ac609428--