From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] Add ant-build-system. Date: Fri, 15 Jan 2016 16:01:47 +0100 Message-ID: <87k2naantw.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK5sx-0004jS-S7 for guix-devel@gnu.org; Fri, 15 Jan 2016 10:02:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK5st-0002ML-Qo for guix-devel@gnu.org; Fri, 15 Jan 2016 10:01:55 -0500 In-Reply-To: (Ricardo Wurmus's message of "Wed, 6 Jan 2016 12:38:09 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ricardo Wurmus Cc: "guix-devel@gnu.org" Ricardo Wurmus skribis: > I=E2=80=99ve used it successfully to package the Java projects hamcrest-c= ore, > junit, osgi-annotation, osgi-core, log4j-api, and javax-mail. Nice. > It=E2=80=99s especially useful in cases where a project does *not* use An= t and > would otherwise require building with Maven or recursively calling javac > on all source files (as currently done for swt), because it can generate > a simple Ant build file with all the right targets. This cuts a lot of > boilerplate from Java packages. The idea of generating a =E2=80=98build.xml=E2=80=99 file is quite unexpect= ed, but I see that it=E2=80=99s useful. > The build.xml it generates contains a target =E2=80=9Ctouch=E2=80=9D whic= h is run before > wrapping up the compiled .class files in a jar archive; this target > ensures that the timestamps of all archived files are reset, so the > produced jars can be (and in case of the above-mentioned packages) > deterministic. Cool. What should we do about packages that do provide a =E2=80=98build.xml=E2=80= =99? I suppose their jars will most likely include timestamps by default, right? If that is the case, maybe we should instead add an additional phase that would, say, unpack all the installed tarballs, reset timestamps, and repack them? > From 284f79ae6ba584603e58228c7c9ee73ac135912d Mon Sep 17 00:00:00 2001 > From: Ricardo Wurmus > Date: Tue, 29 Dec 2015 16:56:49 +0100 > Subject: [PATCH] build: Add Ant build system. > > * guix/build-system/ant.scm: New file. > * guix/build/ant-build-system: New file. > * Makefile.am (MODULES): Add new files. > * doc/guix.texi (Build Systems): Document ant-build-system. [...] > +(define (default-build.xml jar-name prefix) > + "Create a simple build.xml with standard targets for Ant." > + (let ((file (open-output-file "build.xml"))) Slightly better to use: (call-with-output-file "build.xml" (lambda (port) ;; =E2=80=A6 )) because it makes sure the port is closed whenever the dynamic extent of the body is left. > +(define* (configure #:key inputs outputs (jar-name #f) > + #:allow-other-keys) > + (when jar-name > + (default-build.xml jar-name > + (string-append (assoc-ref outputs "out") The second =E2=80=98default-build.xml=E2=80=99 argument should be aligned u= nder the first. > +(define* (install #:key (make-flags '()) #:allow-other-keys) > + (zero? (apply system* `("ant" "install" ,@make-flags)))) Should we add a post-install phase or something that makes sure that .jar files are always installed in the same place, say under lib/java, similar to the =E2=80=98validate-documentation-location=E2=80=99? Thank you! Ludo=E2=80=99.