unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH]: Add Ant.
Date: Mon, 9 Feb 2015 15:51:40 +0100	[thread overview]
Message-ID: <idjiofb6sub.fsf@bimsb-sys02.mdc-berlin.net> (raw)
In-Reply-To: <87fvahz5ze.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]


Ludovic Courtès writes:
>> According to the docs[1],
>>
>>     "ANT_HOME is used by the launcher script for finding the
>>      libraries. JAVA_HOME is used by the launcher for finding the
>>      JDK/JRE to use."
>>
>> So, it would indeed make sense to modify the "launcher script"
>> (whichever this is, probably "ant") to set ANT_HOME before continuing.
>> I'm not a Java person, though, so I don't know if this is considered
>> bad.
>
> I think this would be fine.

I just ran "ant" after setting JAVA_HOME but without setting ANT_HOME,
and it appeared to work just fine.  I don't really have anything to test
this with at the moment, but it seems to me that maybe ANT_HOME isn't
required after all.

>> I even wonder if we should make icedtea6 a build-time input only to
>> compile the libraries, so that one would not need to have icedtea6
>> installed at all.  Or should there be multiple variants of Java packages
>> akin to what we do with Python modules?  I must admit that I find this
>> rather confusing.  How closely do we have to tie Java applications /
>> libraries to a particular version of the JDK?  Are there any insights
>> you could share about how it's done in Nix?
>
> This commit from Nixpkgs gives some insight:
>
> commit 54d172141435d61813666ccb6dbfe8a58a9ce896
> Author: Eelco Dolstra <eelco.dolstra@logicblox.com>
> Date:   Fri Jan 3 13:29:06 2014 +0100
>
>     ant: Update to 1.9.3
>     
>     Also, Ant no longer has a build-time dependency on a particular JDK.
>     It finds the JDK via $JAVA_HOME or $PATH (by looking up javac).  This
>     way, we don't need to have separate packages like apacheAntOpenJDK and
>     apacheAntOracleJDK.  It also seems reasonable: after all, installing
>     GNU Make doesn't give you a C compiler either.  It does mean that
>     instead of
>     
>       buildInputs = [ ant ];
>     
>     you now need to write something like
>     
>       buildInputs = [ ant jdk ];
>
> However, the Nixpkgs does not actually build Ant; it just reuses
> pre-built binaries, which may not be what we want.

Would it be okay if we moved icedtea6 from inputs to native-inputs?  Ant
cannot run without Java, but which Java version should be used depends
on JAVA_HOME.  To compile the Ant libraries we only need *some* JDK at
build time, so I think making this a native input is appropriate.

Attached is an updated patch.

What do you think?

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-Ant.patch --]
[-- Type: text/x-patch, Size: 2643 bytes --]

From 977facdd8e70f4d8c0016e39ca87f53060464099 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 30 Jan 2015 16:57:13 +0100
Subject: [PATCH] gnu: Add Ant.

* gnu/packages/java.scm (ant-minimal): New variable.
---
 gnu/packages/java.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 4a86f63..80ef21a 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -48,6 +48,55 @@
   #:use-module (gnu packages zip)
   #:use-module (gnu packages texinfo))
 
+(define-public ant-minimal
+  (package
+    (name "ant-minimal")
+    (version "1.9.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://www.apache.org/dist/ant/source/apache-ant-"
+                    version "-src.tar.gz"))
+              (sha256
+               (base32
+                "09kf5s1ir0rdrclsy174bsvbdcbajza9fja490w4mmvcpkw3zpak"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; Tests require hamcrest-core, which needs Ant to build.
+       #:phases
+       (alist-cons-after
+        'unpack 'remove-scripts
+        ;; Remove bat / cmd scripts for DOS as well as the antRun and runant
+        ;; wrappers.
+        (lambda _
+          (for-each delete-file
+                    (find-files "src/script"
+                                "(.*\\.(bat|cmd)|runant.*|antRun.*)")))
+        (alist-replace
+         'build
+         (lambda _
+           (setenv "JAVA_HOME"
+                   (assoc-ref %build-inputs "icedtea6"))
+           ;; disable tests to avoid dependecy on hamcrest-core
+           (substitute* "build.xml"
+             (("depends=\"jars,test-jar\"") "depends=\"jars\""))
+           (system* "bash" "bootstrap.sh"
+                    (string-append "-Ddist.dir="
+                                   (assoc-ref %outputs "out"))))
+         (alist-delete
+          'configure
+          (alist-delete 'install %standard-phases))))))
+    (native-inputs
+     `(("icedtea6" ,icedtea6)))
+    (home-page "http://ant.apache.org")
+    (synopsis "Build tool for Java")
+    (description
+     "Ant is a platform-independent build tool for Java.  It is similar to
+make but is implemented using the Java language, requires the Java platform,
+and is best suited to building Java projects.  Ant uses XML to describe the
+build process and its dependencies, whereas Make uses Makefile format.")
+    (license license:asl2.0)))
+
 (define-public icedtea6
   (package
     (name "icedtea6")
-- 
2.1.0


  reply	other threads:[~2015-02-09 14:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 16:04 [PATCH]: Add Ant Ricardo Wurmus
2015-01-30 16:21 ` Ricardo Wurmus
2015-02-05 12:34   ` Ludovic Courtès
2015-02-06 15:51     ` Ricardo Wurmus
2015-02-07 22:55       ` Ludovic Courtès
2015-02-09 14:51         ` Ricardo Wurmus [this message]
2015-02-15 15:40           ` Andreas Enge
2015-02-15 16:13             ` Ricardo Wurmus
2015-02-15 16:21               ` Andreas Enge
2015-02-16 16:38               ` Ricardo Wurmus
2015-02-16 17:08                 ` Andreas Enge
2015-02-05 12:32 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=idjiofb6sub.fsf@bimsb-sys02.mdc-berlin.net \
    --to=ricardo.wurmus@mdc-berlin.de \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).