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 1jwnJG-0006ku-Et for pljava-dev@arkaria.postgresql.org; Sat, 18 Jul 2020 13:55:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jwnJF-0004Cl-FA for pljava-dev@arkaria.postgresql.org; Sat, 18 Jul 2020 13:55:25 +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 1jwnJF-0004Ce-A8 for pljava-dev@lists.postgresql.org; Sat, 18 Jul 2020 13:55:25 +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 1jwnJD-00087m-AC for pljava-dev@lists.postgresql.org; Sat, 18 Jul 2020 13:55:24 +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=Saq8v1C91Z5DeO4A8RMHMBCatK+rw3lj6fTpSGaWsMw=; b=lllfrDXE8oRSQwiIjBDDUBE5Pl 6TCs7G+A6DYDMM0rH8v4Us2Hf23h5T9TPABlj+JBLYcBMm+DfQRHkofensSYh8Z7jTZafCc8to/t6 YpL+DiAnKqwn5hl4l/HVOnpK+vU7I88Ykvxr2ArCLBqIYg7ZeESo6HPu0A5wushOA50JTG2UZ4skr OvnU7/e5VSKZJv8PjMFo/03ENgZt1e3pjUYSwDJYxCl8yjIHRiKFYORaV10HGEsBCxU69+smSyr1j TokOluJOwfvqhIYHkACflDq+0WtFi80UAF7kxJsyvoZz3SdBIaJ8i6uX/JETsaoo3g+H9SGaiOL7Y 4aqWQruQ==; Received: from [184.19.31.139] (port=46568) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jwnJB-009ONC-PN; Sat, 18 Jul 2020 09:55:22 -0400 Subject: Re: PL/Java new build plugin To: Kartik Ohri References: <5F0734AD.7060001@anastigmatix.net> <5F077926.2050806@anastigmatix.net> <5F07C2D5.5050904@anastigmatix.net> <5F0D35BA.30904@anastigmatix.net> <5F0E3972.5070609@anastigmatix.net> <5F0F2DA2.5090603@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F12FF49.6090906@anastigmatix.net> Date: Sat, 18 Jul 2020 09:55:21 -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 On 07/18/20 09:04, Kartik Ohri wrote: > Therefore, we might need to do something similar as well to extract the > script from the script tag. That would surprise me. I think a lot of the details of how the maven-antrun-plugin works are matters of history: Ant was there first, then maven-antrun-plugin wanted to run it from maven and ended up creating a temporary build xml file to do it, and so on. I think if you were starting from scratch writing a Maven plugin to allow scripts, you'd just have its configuration section in the pom accept one element that is a mimetype and another element that's a string, and go to the ScriptEngineManager and say "please give me an engine for this mimetype so I can eval this string". And the only tricky bit for Maven is making sure the ScriptEngineManager will be able to find the engine on its class path. > PS: One thing struck me that the javascript blocks seem to unnecessary if > this is the case. The scripting plugin is wrapping the java functions in > javascript and then parsing a javascript block to execute it. If it is > possible to use the jshell as a scripting engine from the mojo, we could > eliminate the javascript thing and script in Java instead. However, there I like the jshell very much, but it is quite a different beast. By default it starts up a second entire JVM and sends it snippets to run and gets results back. It can be started with "-execution local" to move that evaluation environment inside the current JVM, but that brings its own complications. Out of the box, it isn't visible as a javax.script engine; it's launched a whole different way. That being said, there is somebody who figured out how to write a ScriptEngine wrapper for it [1], which I consider very deep magic. Which still brings us back where we were; if we develop a mojo that can accept a mimetype and a block of text, and get the script engine for that mimetype and run the block of text, then if we want to script bits in JS we can, and if we want to script bits in Java we can, just by declaring dependencies on the right script engines and using the right mimetypes. Regards, -Chap