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 1kBdGA-00085A-48 for pljava-dev@arkaria.postgresql.org; Fri, 28 Aug 2020 12:13:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kBdG9-0008Kx-4w for pljava-dev@arkaria.postgresql.org; Fri, 28 Aug 2020 12:13:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBdG8-0008Kq-Ll for pljava-dev@lists.postgresql.org; Fri, 28 Aug 2020 12:13:33 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBdG1-0002D1-Ht for pljava-dev@lists.postgresql.org; Fri, 28 Aug 2020 12:13:31 +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=BCgyQBQGZEsDlyFPGFw66K7QKBYKkAqUE+DpcAsgKJ0=; b=ualVaF5t3pyw1wNLFGcVF61zRy 7USpU/njMEurN+wfATdxli+Qa2bdUi5dAuUP1GSTOinohDbpRwr/8gua0u5JPL8EMBTWgSqGjFszE Jj5xpX1wHEoKENsul3sm8e1tvz5HEANBpmSMUfZFb+pgcFaMcWGmzlxXQdmna6s7uBXeIujvgNOEt ctWFzUSJaJi5VPZILJf7QD45FznzB0DE2tCYh6VTn/wc6b+eAVFrb6zlKuKn2BUS2VcNfkEzJicVI Ff0dC2OJJWtklfLXZajF6w9KWSUHWu7ZLbeU2qxCTXx+XFBv+CghZnth0pr/S/himleIu1GT5JU9F SczUJA7Q==; Received: from [184.19.31.139] (port=54242) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kBdFy-003wo3-D1; Fri, 28 Aug 2020 08:13:23 -0400 Subject: Re: the ScriptingMojo To: Kartik Ohri References: <5F41943D.9080707@anastigmatix.net> <5F427604.5010103@anastigmatix.net> <5F42A71F.8000002@anastigmatix.net> <5F459B6E.3020803@anastigmatix.net> <5F45EE7F.5020609@anastigmatix.net> <5F46B70E.6070601@anastigmatix.net> <5F46DC70.1080404@anastigmatix.net> <5F484E53.1010209@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F48F4E1.4020400@anastigmatix.net> Date: Fri, 28 Aug 2020 08:13: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 08/27/20 23:59, Kartik Ohri wrote: >> How about compile() and link() returning int, and just returning the >> exit status of the command, so the common code can compare to zero >> or throw MojoFailureException. Just info()ing it isn't enough; yes, >> the build would probably fail at a later step, but it wouldn't be >> immediately clear where it had gone wrong. >> > Regarding this, I was thinking if we could return a ProcessBuilder rather > and execute the command in the common code. The only issue I thought that > may arise is when we try to PIPE the output of the ProcessBuilder because I > am sure how that is done. What do you think ? I think that when reading the piped output from the process, the different platform implementations will want to process it differently, because the messages from different compilers will match different patterns. That might involve having runCommand take another parameter that is a filter for messages, and each implementation would pass its own filter. That means it is probably easier to continue invoking runCommand within the implementation. But returning the exit code so the common code can check it and throw MojoFailureException would be easy. It occurs to me that now that the pljava.libjvmdefault business is implemented in the script, it would be worth testing to make sure it works on all platforms. After #289 is merged, that would just mean passing the -Dpljava.libjvmdefault="$libjvm" on the mvn command line (after computing the right $libjvm), and removing the pljava.libjvm_location settings from [1] and [2], and making sure everything still passes. Also, unit testing. Have you added jUnit tests in a Maven-built project before? It is fairly straightforward; you can add some Java files under src/test/java and if Maven finds any there, it will build them and run them as tests. There are, so far, very few examples in the PL/Java codebase, so there is not a very high existing bar for you to meet, but it would be worthwhile to start the ball rolling by having at least one file in pljava-pgxs/src/test/java with a small handful of tests in it. An existing example you can look at is in pljava-api/src/test/java. One good candidate for testing would be getPgConfigPropertyAsList. It should be tested on some systematically-constructed examples as well as on a real-world example like [3]. Regards, -Chap [1] https://github.com/tada/pljava/blob/943152b/.travis.yml#L112 [2] https://github.com/tada/pljava/blob/943152b/appveyor.yml#L130 [3] https://travis-ci.com/github/amCap1712/pljava/jobs/378459461#L2217