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 1jvCdx-0000Iv-0j for pljava-dev@arkaria.postgresql.org; Tue, 14 Jul 2020 04:34:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jvCdw-0001Lb-1c for pljava-dev@arkaria.postgresql.org; Tue, 14 Jul 2020 04:34:12 +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 1jvCdv-0001LR-IA for pljava-dev@lists.postgresql.org; Tue, 14 Jul 2020 04:34:11 +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 1jvCdp-00028L-4l for pljava-dev@lists.postgresql.org; Tue, 14 Jul 2020 04:34:10 +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=m/cIk1V99knR0iluVMr87VTsaIqcGJy5TKeq9uCnuuA=; b=c4df80E7kDVYAwDdYlOEFlTN5f Y1DadNwxqowsgcdcoUOd5i7+iKcAJEJJQ3Y0a52HqGYL+FgyW4Kg83Xl9cgXoecSSMVeTgFUopoie H+qWIyxIQovAA8WqTGS2sfXjlAiIBzbTnP6OVAFZRYDb+pjKqXBcI8GaTqOsgHnp7RciV6ITh4s5o 3OLlJPRminJtxLftZY1vSB0QRCkbr8uJyu2ry8fTEorHhD45BybwKDTxa1HP9xxeNw6QHx85fcdAX we4pO2ZozfNym58tKhEROoiaqox3i4+09vFal0piIyq1zP0gqUJi2bEiVKu0pQwvOdp8q22D+CWeY pELXVFhw==; Received: from [184.19.31.139] (port=35380) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jvCdm-007zTJ-VZ; Tue, 14 Jul 2020 00:34:03 -0400 Subject: Re: PL/Java new build plugin To: Kartik Ohri References: <5F04FA65.5000600@anastigmatix.net> <5F071CFC.9090306@anastigmatix.net> <5F072647.50301@anastigmatix.net> <5F0734AD.7060001@anastigmatix.net> <5F077926.2050806@anastigmatix.net> <5F07C2D5.5050904@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F0D35BA.30904@anastigmatix.net> Date: Tue, 14 Jul 2020 00:34:02 -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/13/20 12:05, Kartik Ohri wrote: > I have incorporated your comments in the code. I read about the scripting > engine but the details were scarce. Do you have any resources to learn > about it ? Hi, The basics of getting a script engine to work are pretty straightforward; you can look here [1] in the class that goes in the self-installer jar and runs a script to resolve installation path names. You can have a MIME type like application/javascript and ask the ScriptEngineManager to get an engine that handles that MIME type, and if there's one around, the manager gives you it. You can put things into its symbol table by names so scripts can refer to them, and you can have it eval a script, and you can get values back from its symbol table that the script may have set. There are additional possibilities I didn't use there. If the script engine that the manager gives you is instanceof Invocable, then you don't have to just feed it scripts to eval: you can feed it a script that defines various functions, and after that you can use it to just invoke the functions whenever needed. If you have some Java interface in mind, and the script defined the right set of functions, you can ask the engine to generate a Java class that implements the interface, which you can use in Java any way you want. Calls to the interface methods go to the functions in the script. We might very well want to use that. > How should I proceed with my work ? As of now, I am able to set the > properties. The next step seems to be to begin replacing nar > plugin's functionality. I think it would probably be helpful to work on script engine integration next. I wouldn't really want to tackle replacing nar functionality without it. There is also another way script engine functionality would be helpful: I would like this plugin to also include a mojo that implements MavenReport [2], maybe by extending AbstractMavenReport, and would essentially have one configuration option, a script. I would like that because I am really very tired of maven-javadoc-plugin. This is timely because I have just made a PR that adds a bunch of new code in pljava-packaging, enough that I would now like javadoc for that, and I am fighting with the maven-javadoc-plugin again. 5ee9b6b was already at least one full day of working around bugs in that plugin, and 395ac0d was another full day of the same, and I am not interested in spending another. The thing is, running the javadoc tool really isn't that hard! Running it and passing it the right arguments ought to be about four lines of script, and they would be right there in the POM for anybody to look at who wondered why it did or did not do something. ... By the way, if you have a moment for a break in between other things, I would be happy if you could look at the pull request I just put in [3]. I don't have an easy way to test it on Windows, and I wouldn't be surprised if some details in init() or start(), for example, might need adjustment there. Regards, -Chap [1] https://github.com/tada/pljava/blob/b0330f7/org/gjt/cuspy/JarX.java#L544 [2] https://maven.apache.org/guides/plugin/guide-java-report-plugin-development.html [3] https://github.com/tada/pljava/pull/287