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 1k4QnL-0007MD-Fa for pljava-dev@arkaria.postgresql.org; Sat, 08 Aug 2020 15:30:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k4QnJ-0005TM-4v for pljava-dev@arkaria.postgresql.org; Sat, 08 Aug 2020 15:30:01 +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 1k4QnJ-0005T4-00 for pljava-dev@lists.postgresql.org; Sat, 08 Aug 2020 15:30:01 +0000 Received: from anastigmatix.net ([68.171.219.55]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4QnG-00018H-Rh for pljava-dev@lists.postgresql.org; Sat, 08 Aug 2020 15:30:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Iqqb91x+2N/S6YppBw8qXF0HTIzdzZHsZe6lEH9rkdw=; b=S5kix2XEUntGn8rzWkHMyvGzTJ 4Zoui4CDpigZwaabYSCBNqbtLAVDDXZMHo663/Ynbp5pF598bpzBcTtk8Tr1Y5N2SsJsK8sAbOCY5 af7LNGjCFfW9Km5Glbstcq7csnp2xSpUpV3US22zqGquEba3LJrZAHsbGd+CtT/Xd/lOa+QUBc4zi Wnlk8fHD1q6m+EfycXrWCV44DSuDdPAcIBwZadiJVrZayhef+XvwI8l51HpnmvARwFqUfuljD2zdx TgrqOZhlV5VC1ArLxcK/eiXBbZnJNViLEpxZpDo424PbHChBWS9DHLhhlrvY9JI2ZhbCwhwUKg7Rk c+vN6G7Q==; Received: from [184.19.31.139] (port=57797) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1k4QnF-009vTW-0Y; Sat, 08 Aug 2020 11:29:57 -0400 Subject: the ReportScriptingMojo To: Kartik Ohri 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> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F2EC4F4.3080608@anastigmatix.net> Date: Sat, 8 Aug 2020 11:29:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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