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 1k1CM1-0008PD-E1 for pljava-dev@arkaria.postgresql.org; Thu, 30 Jul 2020 17:28:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k1CM0-0007O5-0c for pljava-dev@arkaria.postgresql.org; Thu, 30 Jul 2020 17:28:28 +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 1k1CLz-0007Ns-RU for pljava-dev@lists.postgresql.org; Thu, 30 Jul 2020 17:28:27 +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 1k1CLx-0000z5-LC for pljava-dev@lists.postgresql.org; Thu, 30 Jul 2020 17:28:26 +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=QWxLYEE4x8TiKQCej6u0Z8dAnV/hM1IsHofynSJrgWQ=; b=KMVnKPrzx71X7iLVIxZ/Y9Rep4 VEZdMtKXD/nO5Gww3OLYk0nRYjRTZHiJsix5JVc1UEYwYt7ZLQ0kCv2N1/ZhmWX6wqQDzINape2+1 qQ8KGcEYTc/vef4z7LLYZMhe1J5gL44bYmxXefc6310HvigyCwZZJpvQwztuVGWGI9G5Yl/9Lg8kC AtKZL7WmbgSLuNhcb9MMk67qfAkejyXiFsbVruovasTf4BGdD2g5AXDJ3GAQzEVmJ6k9rxYpLEYbL P3/28ZuhoUcTuMr2AILRV6rEq8S7yF9T8DZ9v8Ejmuni8U7JISRVkiwg3RcwEmW2FYAJLwAyrUdp1 8g5cRfjQ==; Received: from [184.19.31.139] (port=43461) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1k1CLv-00131I-OP; Thu, 30 Jul 2020 13:28:24 -0400 Subject: Re: PL/Java new build plugin To: Kartik Ohri References: <5F18C58F.8060204@anastigmatix.net> <5F19C36C.70905@anastigmatix.net> <5F1C6F06.2020809@anastigmatix.net> <5F1CE067.2060107@anastigmatix.net> <5F1F88E0.2050305@anastigmatix.net> <5F20E585.6010703@anastigmatix.net> <5F22DF79.2090701@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F230337.3040406@anastigmatix.net> Date: Thu, 30 Jul 2020 13:28:23 -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/30/20 11:37, Kartik Ohri wrote: > To clarify, I have exposed the instance and written the snippet using > Doxia sink to generate the html file in the pom.xml. I meant that we could > factor out the sink part in a default method in an interface and expose it > to javascript for providing an alternate implementation if wanted. It is > this part I am unsure of how to do. Ah, got it. Right now, nothing is jumping out at me as an obvious way to supply a default implementation for a generic report. (Not even thinking of the mechanics of doing it just now, only the wider question of what such a default method would do.) I would say that's a bit of refactoring that isn't needed now, but some future day if there has been some experience using the mojo to script both Javadoc and some other sort of report, what turns out to be common between those uses might supply ideas for a refactoring then. I am a little disappointed that the Sink methods return void instead of the sink, so they can't be used fluently; if I were looking for one simple way to make the script snippet end up prettier, I might consider writing a wrapper class that's like Sink but with methods returning this, so the script can be written in a fluent style. However, writing such a wrapper for an interface with nearly 200 methods sounds like a job for an extremely boring rainy day, definitely not a priority for right now. If I were writing such a wrapper, I might also consider wrapping each foo()/foo_() pair of start/end methods as a single method that takes a lambda generating the content inside, so misnesting would not be possible. (If I'm not mistaken, there's a bit of misnesting in your snippets, sectionTitle_ before link_ ... a nicer API would leave no need to think about that.) But probably there are better areas to polish right now. A generic scripting mojo can't really know "you're going to want the jar path for a dependency named pljava-api, I'll put that in a variable for you"; it just needs to expose some way to get the project object so the script can do such lookups. I am probably also passing the Javadoc -d option the wrong way (hardcoding ${basedir}/target/site/apidocs). Probably should just tack on "apidocs" to report.getReportOutputDirectory() (using something like toPath().resolve("apidocs") so the tacking-on is platform-aware. Likewise, what I was passing to -encoding and -docencoding should probably come from report.getInputEncoding() and report.getOutputEncoding(), respectively. All that should be straightforward with the report instance exposed. Hmm, but those encoding methods are protected; the script might not have access. Accessible versions might have to be supplied. Regards, -Chap