Subject: [PATCH 05/22] gnu: Add groovy-xml.

From: Julien Lepiller <[email-masked]>
Date: Tue, 1 May 2018 17:44:32 +0200

* gnu/packages/groovy.scm (groovy-xml): New variable.
---
 gnu/packages/groovy.scm | 50 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/groovy.scm b/gnu/packages/groovy.scm
index ff777a01d..ba1c30505 100644
--- a/gnu/packages/groovy.scm
+++ b/gnu/packages/groovy.scm
@@ -248,3 +248,53 @@ other groovy submodules.")))
     (synopsis "Groovy test submodule")
     (description "This package contains the test submodules used to test
 other groovy submodules.")))
+
+(define groovy-xml
+  (package
+    (inherit groovy-bootstrap)
+    (name "groovy-xml")
+    (arguments
+     `(#:jar-name "groovy-xml.jar"
+       #:jdk ,icedtea-8
+       #:test-dir "src/test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'chdir
+           (lambda _
+             (chdir "subprojects/groovy-xml")))
+         (replace 'build
+           (lambda _
+             (mkdir-p "build/classes")
+             (mkdir-p "build/jar")
+             (and
+               (zero? (apply system* "java" "-cp" (getenv "CLASSPATH")
+                               "org.codehaus.groovy.tools.FileSystemCompiler"
+                               "-d" "build/classes"
+                               "-j"; joint compilation
+                               (find-files "src/main"
+                                           ".*\\.(groovy|java)$")))
+               (zero? (system* "jar" "-cf" "build/jar/groovy-xml.jar"
+                               "-C" "build/classes" ".")))))
+         (replace 'check
+           (lambda _
+             (mkdir-p "build/test-classes")
+             (substitute* "build.xml"
+               (("depends=\"compile-tests\"") "depends=\"\"")
+               (("}/java") "}/groovy"))
+             (and
+               (zero? (apply system* "java" "-cp"
+                             (string-append (getenv "CLASSPATH") ":build/classes")
+                             "org.codehaus.groovy.tools.FileSystemCompiler"
+                             "-d" "build/test-classes"
+                             "-j"
+                             (append
+                               (find-files "src/test"
+                                           ".*\\.(groovy|java)$"))))
+               (zero? (system* "ant" "check"))))))))
+    (native-inputs
+     `(("groovy-bootstrap" ,groovy-bootstrap)
+       ("groovy-test" ,groovy-test)
+       ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
+       ,@(package-native-inputs groovy-java-bootstrap)))
+    (synopsis "Groovy XML")
+    (description "This package contains XML-related utilities for groovy.")))
-- 
2.17.0