unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH]: Add Ant.
@ 2015-01-30 16:04 Ricardo Wurmus
  2015-01-30 16:21 ` Ricardo Wurmus
  2015-02-05 12:32 ` Ludovic Courtès
  0 siblings, 2 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2015-01-30 16:04 UTC (permalink / raw)
  To: guix-devel

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

Hi Guix,

this patch adds ant-minimal, a minimal configuration of Apache Ant.  Ant
can be configured with lots of optional libraries, but since most of
these libraries are built with Ant, I think it makes sense to provide a
minimal version.

A wart is that Ant (even in the minimal configuration) depends on
hamcrest-core, which can only be built with Ant.  The good news is that
it appears that hamcrest-core is only used for running the tests after
Ant is built.

I used the gnu-build-system instead of the trivial-build-system, because
using the trivial-build-system required me to write a lot more code in
order to unpack the tarball, patch shebangs, add tools to the PATH,
etc.  Using the gnu-build-system I only had to remove a few phases to
make it work.  Maybe we need a somewhat more powerful version of the
trivial-build-system.

~~ Ricardo


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

From a8cf4bbd4a8147215a84f27e4aa6247163b4fdf4 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 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 4a86f63..46ff798 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -48,6 +48,54 @@
   #:use-module (gnu packages zip)
   #:use-module (gnu packages texinfo))
 
+(define-public ant-minimal
+  (package
+    (name "ant")
+    (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
+     `(#:phases
+       (alist-cons-after
+        'unpack 'copy-hamcrest
+        (lambda _
+          (copy-file (assoc-ref %build-inputs "hamcrest-core")
+                     "lib/optional/hamcrest-core.jar"))
+        (alist-replace
+         'build
+         (lambda _
+           (setenv "JAVA_HOME"
+                   (assoc-ref %build-inputs "icedtea6"))
+           (system* "bash" "bootstrap.sh"
+                    (string-append "-Ddist.dir="
+                                   (assoc-ref %outputs "out"))))
+         (alist-delete
+          'configure
+          (alist-delete
+           'install
+           (alist-delete 'check (%standard-phases))))))))
+    (inputs
+     `(("icedtea6" ,icedtea6)
+       ("hamcrest-core"
+        ,(origin
+           (method url-fetch)
+           (uri "https://hamcrest.googlecode.com/files/hamcrest-core-1.3.jar")
+           (sha256
+            (base32
+             "1sfqqi8p5957hs9yik44an3lwpv8ln2a6sh9gbgli4vkx68yzzb6"))))))
+    (home-page "http://ant.apache.org")
+    (synopsis "Build tool for Java")
+    (description
+     "Ant is a platform-independent build tool for Java.")
+    (license license:asl2.0)))
+
 (define-public icedtea6
   (package
     (name "icedtea6")
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  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-05 12:32 ` Ludovic Courtès
  1 sibling, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2015-01-30 16:21 UTC (permalink / raw)
  To: guix-devel

Ricardo Wurmus writes:

> this patch adds ant-minimal, a minimal configuration of Apache Ant.  Ant
> can be configured with lots of optional libraries, but since most of
> these libraries are built with Ant, I think it makes sense to provide a
> minimal version.

A couple more things:

* the installation script copies MS DOS batch scripts to $out/bin, which
  we could do without.

* there are many launcher scripts for Ant: bash scripts, perl scripts,
  Python scripts ... Does ant-minimal need to get perl and python as
  inputs or can we do without these additional dependencies?

* to use Ant without problems ANT_HOME and JAVA_HOME really should be
  set appropriately (ANT_HOME to $out of the ant-minimal package,
  JAVA_HOME to $out of icedtea6).  Should I suggest these two paths as
  search paths by adding something like this to ant-minimal (for
  ANT_HOME) and icedtea6 (for JAVA_HOME)?

    (native-search-paths
     (list (search-path-specification
            (variable "ANT_HOME")
            (files '(".")))))


~~ Ricardo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-01-30 16:04 [PATCH]: Add Ant Ricardo Wurmus
  2015-01-30 16:21 ` Ricardo Wurmus
@ 2015-02-05 12:32 ` Ludovic Courtès
  1 sibling, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2015-02-05 12:32 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> this patch adds ant-minimal, a minimal configuration of Apache Ant.  Ant
> can be configured with lots of optional libraries, but since most of
> these libraries are built with Ant, I think it makes sense to provide a
> minimal version.

Yes.

> A wart is that Ant (even in the minimal configuration) depends on
> hamcrest-core, which can only be built with Ant.  The good news is that
> it appears that hamcrest-core is only used for running the tests after
> Ant is built.

What you did (referring to hamcrest-core.jar) is fine.  Turning off
tests in ant-minimal would also be fine, IMO; perhaps even preferable,
since that avoids another pre-build binary.  WDYT?

> I used the gnu-build-system instead of the trivial-build-system, because
> using the trivial-build-system required me to write a lot more code in
> order to unpack the tarball, patch shebangs, add tools to the PATH,
> etc.  Using the gnu-build-system I only had to remove a few phases to
> make it work.  Maybe we need a somewhat more powerful version of the
> trivial-build-system.

Makes sense.

> From a8cf4bbd4a8147215a84f27e4aa6247163b4fdf4 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 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 4a86f63..46ff798 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -48,6 +48,54 @@
>    #:use-module (gnu packages zip)
>    #:use-module (gnu packages texinfo))
>  
> +(define-public ant-minimal
> +  (package
> +    (name "ant")

s/ant/ant-minimal/

Perhaps it could additionally be made private, because users will have
no reason to use the minimal variant, no?

> +    (description
> +     "Ant is a platform-independent build tool for Java.")

Could you expound a bit, saying it’s similar to ‘make’, has build
recipes written in XML, is especially convenient for Java projects,
etc.?

I’ll reply to your other comments.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-01-30 16:21 ` Ricardo Wurmus
@ 2015-02-05 12:34   ` Ludovic Courtès
  2015-02-06 15:51     ` Ricardo Wurmus
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2015-02-05 12:34 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> A couple more things:
>
> * the installation script copies MS DOS batch scripts to $out/bin, which
>   we could do without.

Indeed.  :-)  Would be best to get rid of them.

> * there are many launcher scripts for Ant: bash scripts, perl scripts,
>   Python scripts ... Does ant-minimal need to get perl and python as
>   inputs or can we do without these additional dependencies?

By launcher scripts, do you mean the ‘ant’ command?  I suppose it’s
enough to have one of them, and the Bash version is probably the one
with the smallest disk space footprint, no?

> * to use Ant without problems ANT_HOME and JAVA_HOME really should be
>   set appropriately (ANT_HOME to $out of the ant-minimal package,
>   JAVA_HOME to $out of icedtea6).  Should I suggest these two paths as
>   search paths by adding something like this to ant-minimal (for
>   ANT_HOME) and icedtea6 (for JAVA_HOME)?
>
>     (native-search-paths
>      (list (search-path-specification
>             (variable "ANT_HOME")
>             (files '(".")))))

Since Ant is generally used via the ‘ant’ command (AIUI), what about
wrapping that command so that ANT_HOME and JAVA_HOME are set
appropriately?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-02-05 12:34   ` Ludovic Courtès
@ 2015-02-06 15:51     ` Ricardo Wurmus
  2015-02-07 22:55       ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2015-02-06 15:51 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

>> * to use Ant without problems ANT_HOME and JAVA_HOME really should be
>>   set appropriately (ANT_HOME to $out of the ant-minimal package,
>>   JAVA_HOME to $out of icedtea6).  Should I suggest these two paths as
>>   search paths by adding something like this to ant-minimal (for
>>   ANT_HOME) and icedtea6 (for JAVA_HOME)?
>>
>>     (native-search-paths
>>      (list (search-path-specification
>>             (variable "ANT_HOME")
>>             (files '(".")))))
>
> Since Ant is generally used via the ‘ant’ command (AIUI), what about
> wrapping that command so that ANT_HOME and JAVA_HOME are set
> appropriately?

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.

JAVA_HOME, however, probably should not be set.  After all, Ant works
with different JDK/JRE versions, not only IcedTea 6.

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?

~~ Ricardo

[1]: http://ant.apache.org/manual/index.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-02-06 15:51     ` Ricardo Wurmus
@ 2015-02-07 22:55       ` Ludovic Courtès
  2015-02-09 14:51         ` Ricardo Wurmus
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2015-02-07 22:55 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

>>> * to use Ant without problems ANT_HOME and JAVA_HOME really should be
>>>   set appropriately (ANT_HOME to $out of the ant-minimal package,
>>>   JAVA_HOME to $out of icedtea6).  Should I suggest these two paths as
>>>   search paths by adding something like this to ant-minimal (for
>>>   ANT_HOME) and icedtea6 (for JAVA_HOME)?
>>>
>>>     (native-search-paths
>>>      (list (search-path-specification
>>>             (variable "ANT_HOME")
>>>             (files '(".")))))
>>
>> Since Ant is generally used via the ‘ant’ command (AIUI), what about
>> wrapping that command so that ANT_HOME and JAVA_HOME are set
>> appropriately?
>
> 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.

> JAVA_HOME, however, probably should not be set.  After all, Ant works
> with different JDK/JRE versions, not only IcedTea 6.

Right.

> 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.  Also, it produces
its own ‘ant’ launcher script:

  https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/apache-ant/default.nix

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-02-07 22:55       ` Ludovic Courtès
@ 2015-02-09 14:51         ` Ricardo Wurmus
  2015-02-15 15:40           ` Andreas Enge
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2015-02-09 14:51 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-02-09 14:51         ` Ricardo Wurmus
@ 2015-02-15 15:40           ` Andreas Enge
  2015-02-15 16:13             ` Ricardo Wurmus
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Enge @ 2015-02-15 15:40 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hello,

On Sun, Feb 15, 2015 at 02:54:54PM +0100, Ricardo Wurmus wrote:
> I already packaged ant-minimal with only the most basic features
> enabled, as most additional features depend on libraries that need ant
> in order to build them.  Here's the latest version of my patch to add
> the ant-minimal package for which I'm waiting for a final OK before
> pushing

indeed, I was a bit confused since I remembered discussions about ANT_HOME,
which led me to believe that it had made it into the distribution. Please
do not hesitate to send out a ping if you do not get a reaction to a patch!

So a few comments. First of all, it builds. :-)
Then it is already enough to build my android project, apparently I do not
need a more advanced ant.

Using icedtea6 as a native input also seems to work. Actually, I set neither
ANT_HOME nor JAVA_HOME and have the impression that ant simply uses the
binaries it finds in the path.

On Mon, Feb 09, 2015 at 03:51:40PM +0100, Ricardo Wurmus wrote:
> +(define-public ant-minimal

If I understood correctly, you saw this essentially as a bootstrap-ant.
So once you add the "real" one, you may wish to hide this one with
"define" instead of "define-public".

> +     `(#: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.*)")))

Is this needed to prevent installation?

> +           ;; disable tests to avoid dependecy on hamcrest-core

Typo, missing "n" in "depende_n_cy".

> +           (substitute* "build.xml"
> +             (("depends=\"jars,test-jar\"") "depends=\"jars\""))

How does this relate do disabling tests above? Are both needed?

> +           (system* "bash" "bootstrap.sh"
> +                    (string-append "-Ddist.dir="
> +                                   (assoc-ref %outputs "out"))))

Here you may wish to check the return value with "zero?" as this is
the last command in the phase.


Then, please push! This is indeed very useful for me.

Andreas

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  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
  0 siblings, 2 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2015-02-15 16:13 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel


Andreas Enge writes:

> indeed, I was a bit confused since I remembered discussions about ANT_HOME,
> which led me to believe that it had made it into the distribution. Please
> do not hesitate to send out a ping if you do not get a reaction to a patch!

The priority of Ant dropped quickly when I discovered that I don't
actually have any use for it yet (even building IcedTea was only
motivated by my desire to build R), so I didn't mind to take a break
from anything Java-related :)

> On Mon, Feb 09, 2015 at 03:51:40PM +0100, Ricardo Wurmus wrote:
>> +(define-public ant-minimal
>
> If I understood correctly, you saw this essentially as a bootstrap-ant.
> So once you add the "real" one, you may wish to hide this one with
> "define" instead of "define-public".

Correct.  As I don't have any programmes in my queue that require Ant I
don't really know how to proceed.  We'd probably want some kind of
ant-build-system that unleashes ant and lets it churn through build.xml
or so --- I don't know if ant-minimal would be sufficient for that and
if we would want to only use it internally.

I'd prefer to leave it public for now because it's the only variant of
Ant we have at the moment.  I encourage anyone more versed in Java stuff
to continue where I left off and provide a more featured variant of Ant.

>> +     `(#: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.*)")))
>
> Is this needed to prevent installation?

Yes.  The build instructions state that everything in src/script is to
be copied to the target directory.  Since we don't need them I don't see
harm in removing them before the build starts.

>
>> +           ;; disable tests to avoid dependecy on hamcrest-core
>
> Typo, missing "n" in "depende_n_cy".

Oh, will fix it.

>> +           (substitute* "build.xml"
>> +             (("depends=\"jars,test-jar\"") "depends=\"jars\""))
>
> How does this relate do disabling tests above? Are both needed?

This target depends on the "test-jar", which checks for JUnit to be
present.  If JUnit is present (it is because it comes bundled with ant)
the tests are run --- and then they fail because hamcrest-core is
nowhere to be found.  So the least invasive change I could think of was
to remove the dependency on the "test-jar" target.

>> +           (system* "bash" "bootstrap.sh"
>> +                    (string-append "-Ddist.dir="
>> +                                   (assoc-ref %outputs "out"))))
>
> Here you may wish to check the return value with "zero?" as this is
> the last command in the phase.

Okay.

> Then, please push! This is indeed very useful for me.

I'll update this on Monday and push then.  Thanks for the review!

~~ Ricardo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-02-15 16:13             ` Ricardo Wurmus
@ 2015-02-15 16:21               ` Andreas Enge
  2015-02-16 16:38               ` Ricardo Wurmus
  1 sibling, 0 replies; 12+ messages in thread
From: Andreas Enge @ 2015-02-15 16:21 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Sun, Feb 15, 2015 at 05:13:36PM +0100, Ricardo Wurmus wrote:
> I'd prefer to leave it public for now because it's the only variant of
> Ant we have at the moment.  I encourage anyone more versed in Java stuff
> to continue where I left off and provide a more featured variant of Ant.

Okay. Maybe then simply call it "ant"? I am not sure if anybody is going
to pick up, and it is quite functional so far. If there is a need, someone
may move things around in the future.

Andreas

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2015-02-16 16:38 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

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


Andreas Enge writes:
> Then, please push! This is indeed very useful for me.

Attached is yet another version that I intend to push.  I added some
more comments as to why gnu-build-system is used and why tests are
disabled in two places.  Typos have been fixed as well.

The package is now named "ant", because I don't provide another more
fully featured variant of Ant.

~~ Ricardo


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

From e0df59826ff9d33e114ac00132c63306b8f873c5 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): New variable.
---
 gnu/packages/java.scm | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 4a86f63..ece6606 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -48,6 +48,62 @@
   #:use-module (gnu packages zip)
   #:use-module (gnu packages texinfo))
 
+(define-public ant
+  (package
+    (name "ant")
+    (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"))))
+    ;; The build procedure for Ant has little in common with the standard GNU
+    ;; build procedure, but using the trivial-build-system would require
+    ;; considerably more code to unpack the sources, patch shebangs, and so
+    ;; on.
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; no "check" target
+       #: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 dependency on hamcrest-core, which needs
+           ;; Ant to build.  This is necessary in addition to disabling the
+           ;; "check" phase, because the dependency on "test-jar" would always
+           ;; result in the tests to be run.
+           (substitute* "build.xml"
+             (("depends=\"jars,test-jar\"") "depends=\"jars\""))
+           (zero? (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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH]: Add Ant.
  2015-02-16 16:38               ` Ricardo Wurmus
@ 2015-02-16 17:08                 ` Andreas Enge
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Enge @ 2015-02-16 17:08 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Mon, Feb 16, 2015 at 05:38:59PM +0100, Ricardo Wurmus wrote:
> Attached is yet another version that I intend to push.  I added some
> more comments as to why gnu-build-system is used

I think this is overkill.

> The package is now named "ant", because I don't provide another more
> fully featured variant of Ant.

I did not test it, but I trust you it still works. So please push!

Andreas

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-02-16 17:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).