1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
3 ;;; Copyright © 2019 Tobias Geerinck-Rice <me@tobias.gr>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages groovy)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix git-download)
25 #:use-module (guix utils)
26 #:use-module (guix build-system ant)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages java)
29 #:use-module (gnu packages xml))
31 (define java-groovy-bootstrap
33 (name "java-groovy-bootstrap")
39 (url "https://github.com/apache/groovy.git")
40 (commit (string-append
42 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
44 (file-name (git-file-name name version))
46 (base32 "1q4cplimr18j93zz92kgq8b6wdv0p9svr7cdr47q8b2mbjpd0x3j"))
48 (search-patches "groovy-add-exceptionutilsgenerator.patch"))))
49 (build-system ant-build-system)
51 `(#:jar-name "groovy.jar"
52 #:source-dir "src/main:subprojects/groovy-test/src/main/java"
56 #:main-class "groovy.ui.GroovyMain"
58 (modify-phases %standard-phases
59 (add-before 'build 'fix-java8
60 ;; Fix "Reference to plus is ambiguous"
62 (substitute* "src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java"
64 "(List<T>)toList(left)"))
66 (add-before 'build 'generate-parsers
68 (with-directory-excursion "src/main/org/codehaus/groovy/antlr/java"
69 (invoke "antlr" "java.g"))
70 (with-directory-excursion "src/main/org/codehaus/groovy/antlr"
72 (with-directory-excursion "parser"
73 (invoke "antlr" "../groovy.g")))
75 (add-before 'build 'generate-exception-utils
77 (invoke "javac" "-cp" (getenv "CLASSPATH")
78 "config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java")
79 (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
81 "org.codehaus.groovy.ExceptionUtilsGenerator"
82 "build/classes/org/codehaus/groovy/runtime/ExceptionUtils.class")
85 `(("java-junit" ,java-junit)
86 ("java-hamcrest-core" ,java-hamcrest-core)
88 ("java-jmock-1" ,java-jmock-1)
89 ("java-xmlunit-legacy" ,java-xmlunit-legacy)))
91 `(("java-commons-cli" ,java-commons-cli)
92 ("java-asm" ,java-asm)
93 ("java-classpathx-servletapi" ,java-classpathx-servletapi)
94 ("java-xstream" ,java-xstream)
95 ("java-jansi" ,java-jansi)
96 ("java-jline-2" ,java-jline-2)))
97 (home-page "http://groovy-lang.org/")
98 (synopsis "Groovy's java bootstrap")
99 (description "This package contains the java bootstrap that is used to build
101 (license license:asl2.0)))
103 (define groovy-bootstrap
105 (inherit java-groovy-bootstrap)
106 (name "groovy-bootstrap")
108 `(#:jar-name "groovy.jar"
110 ;Requires groovy-xml and logback-classic which are circular dependencies
113 (modify-phases %standard-phases
114 (add-before 'build 'fix-java8
115 ;; Fix "Reference to plus is ambiguous"
117 (substitute* "src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java"
118 (("toList\\(left\\)")
119 "(List<T>)toList(left)"))
121 (add-before 'build 'generate-parser
123 (with-directory-excursion "src/main/org/codehaus/groovy/antlr/java"
124 (invoke "antlr" "java.g"))
125 (with-directory-excursion "src/main/org/codehaus/groovy/antlr"
127 (with-directory-excursion "parser"
128 (invoke "antlr" "../groovy.g")))
130 (add-before 'build 'generate-exception-utils
132 (invoke "javac" "-cp" (getenv "CLASSPATH")
133 "config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java")
134 (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
136 "org.codehaus.groovy.ExceptionUtilsGenerator"
137 "target/classes/org/codehaus/groovy/runtime/ExceptionUtils.class")
139 (add-before 'build 'generate-dgminfo
141 (mkdir-p "target/classes/org/codehaus/groovy/runtime")
142 (mkdir-p "target/classes/META-INF")
143 (invoke "javac" "-cp" (getenv "CLASSPATH")
144 "src/main/org/codehaus/groovy/tools/DgmConverter.java")
145 (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
147 "org.codehaus.groovy.tools.DgmConverter")
149 (add-before 'build 'copy-resources
151 (with-directory-excursion "src/main"
152 (for-each (lambda (file)
153 (mkdir-p (string-append "../../target/classes/"
156 (string-append "../../target/classes/"
158 (find-files "." ".*.(txt|properties|xml|html)")))
162 (mkdir-p "build/jar")
163 (apply invoke "java" "-cp" (getenv "CLASSPATH")
164 "org.codehaus.groovy.tools.FileSystemCompiler"
165 "-d" "target/classes"
166 "-j"; joint compilation
167 (find-files "src/main"
168 ".*\\.(groovy|java)$"))
169 (invoke "jar" "-cf" "build/jar/groovy.jar"
170 "-C" "target/classes" ".")
173 `(("java-apache-ivy" ,java-apache-ivy)
174 ,@(package-inputs java-groovy-bootstrap)))
176 `(("java-groovy-bootstrap" ,java-groovy-bootstrap)
177 ,@(package-native-inputs java-groovy-bootstrap)))
178 (synopsis "Groovy compiler")
179 (description "This package contains the first version of the Groovy compiler.
180 Although already usable, it doesn't contain the groovy library yet. This package
181 is used to build the groovy submodules written in groovy.")))
183 (define groovy-tests-bootstrap
185 (inherit groovy-bootstrap)
186 (name "groovy-tests-bootstrap")
188 `(#:jar-name "groovy-tests-bootstrap.jar"
190 #:tests? #f; no tests
192 (modify-phases %standard-phases
195 (mkdir-p "build/classes")
196 (mkdir-p "build/jar")
197 (apply invoke "java" "-cp" (getenv "CLASSPATH")
198 "org.codehaus.groovy.tools.FileSystemCompiler"
200 "-j"; joint compilation
202 (find-files "src/test" "TestSupport.java")
203 (find-files "src/test" "HeadlessTestSupport.java")
204 (find-files "src/test" "XmlAssert.java")))
205 (invoke "jar" "-cf" "build/jar/groovy-tests-bootstrap.jar"
206 "-C" "build/classes" ".")
209 `(("groovy-test" ,groovy-test)
210 ,@(package-inputs groovy-bootstrap)))
212 `(("groovy-bootstrap" ,groovy-bootstrap)
213 ,@(package-native-inputs java-groovy-bootstrap)))
214 (synopsis "Groovy test classes")
215 (description "This package contains three classes required for testing
216 other groovy submodules.")))
220 (inherit groovy-bootstrap)
223 `(#:jar-name "groovy-test.jar"
225 #:test-dir "subprojects/groovy-test/src/test"
227 (modify-phases %standard-phases
230 (mkdir-p "build/classes")
231 (mkdir-p "build/jar")
232 (apply invoke "java" "-cp" (getenv "CLASSPATH")
233 "org.codehaus.groovy.tools.FileSystemCompiler"
234 "-d" "build/classes" "-j"; joint compilation
235 (find-files "subprojects/groovy-test/src/main"
236 ".*\\.(groovy|java)$"))
237 (invoke "jar" "-cf" "build/jar/groovy-test.jar"
238 "-C" "build/classes" ".")
242 (mkdir-p "build/test-classes")
243 (substitute* "build.xml"
244 (("depends=\"compile-tests\"") "depends=\"\"")
245 (("}/java") "}/groovy"))
246 (apply invoke "java" "-cp"
247 (string-append (getenv "CLASSPATH") ":build/classes")
248 "org.codehaus.groovy.tools.FileSystemCompiler"
249 "-d" "build/test-classes" "-j"
250 (append (find-files "subprojects/groovy-test/src/test"
251 ".*\\.(groovy|java)$")))
252 (invoke "ant" "check")
255 `(("groovy-bootstrap" ,groovy-bootstrap)
256 ,@(package-native-inputs java-groovy-bootstrap)))
257 (synopsis "Groovy test submodule")
258 (description "This package contains the test submodules used to test
259 other groovy submodules.")))
263 (inherit groovy-bootstrap)
266 `(#:jar-name "groovy-xml.jar"
268 #:test-dir "src/test"
270 (modify-phases %standard-phases
271 (add-before 'configure 'chdir
273 (chdir "subprojects/groovy-xml")
277 (mkdir-p "build/classes")
278 (mkdir-p "build/jar")
279 (apply invoke "java" "-cp" (getenv "CLASSPATH")
280 "org.codehaus.groovy.tools.FileSystemCompiler"
281 "-d" "build/classes" "-j"; joint compilation
282 (find-files "src/main" ".*\\.(groovy|java)$"))
283 (invoke "jar" "-cf" "build/jar/groovy-xml.jar"
284 "-C" "build/classes" ".")
288 (mkdir-p "build/test-classes")
289 (substitute* "build.xml"
290 (("depends=\"compile-tests\"") "depends=\"\"")
291 (("}/java") "}/groovy"))
292 (apply invoke "java" "-cp"
293 (string-append (getenv "CLASSPATH") ":build/classes")
294 "org.codehaus.groovy.tools.FileSystemCompiler"
295 "-d" "build/test-classes" "-j"
296 (append (find-files "src/test" ".*\\.(groovy|java)$")))
297 (invoke "ant" "check")
300 `(("groovy-bootstrap" ,groovy-bootstrap)
301 ("groovy-test" ,groovy-test)
302 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
303 ,@(package-native-inputs java-groovy-bootstrap)))
304 (synopsis "Groovy XML")
305 (description "This package contains XML-related utilities for groovy.")))
307 (define groovy-templates
309 (inherit groovy-bootstrap)
310 (name "groovy-templates")
312 `(#:jar-name "groovy-templates.jar"
314 #:test-dir "subprojects/groovy-templates/src/test"
315 #:tests? #f;Requires spock-framework which is a circular dependency
317 (modify-phases %standard-phases
320 (mkdir-p "build/classes")
321 (mkdir-p "build/jar")
322 (apply invoke "java" "-cp" (getenv "CLASSPATH")
323 "org.codehaus.groovy.tools.FileSystemCompiler"
324 "-d" "build/classes" "-j"; joint compilation
325 (find-files "subprojects/groovy-templates/src/main"
326 ".*\\.(groovy|java)$"))
327 (invoke "jar" "-cf" "build/jar/groovy-templates.jar"
328 "-C" "build/classes" ".")
331 `(("groovy-xml" ,groovy-xml)
332 ,@(package-inputs groovy-bootstrap)))
334 `(("groovy-bootstrap" ,groovy-bootstrap)
335 ("groovy-test" ,groovy-test)
336 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
337 ,@(package-native-inputs java-groovy-bootstrap)))
338 (synopsis "Groovy template engine")
339 (description "This package contains a template framework which is
340 well-suited to applications where the text to be generated follows the form of
341 a static template.")))
343 (define groovy-groovydoc
345 (inherit groovy-bootstrap)
346 (name "groovy-groovydoc")
348 `(#:jar-name "groovy-groovydoc.jar"
350 #:test-dir "subprojects/groovy-groovydoc/src/test"
351 #:tests? #f; Requires groovy-ant which is a circular dependency
353 (modify-phases %standard-phases
354 (add-before 'build 'copy-resources
356 (copy-recursively "subprojects/groovy-groovydoc/src/main/resources"
361 (mkdir-p "build/classes")
362 (mkdir-p "build/jar")
363 (apply invoke "java" "-cp" (getenv "CLASSPATH")
364 "org.codehaus.groovy.tools.FileSystemCompiler"
366 "-j"; joint compilation
367 (find-files "subprojects/groovy-groovydoc/src/main"
368 ".*\\.(groovy|java)$"))
369 (invoke "jar" "-cf" "build/jar/groovy-groovydoc.jar"
370 "-C" "build/classes" ".")
373 `(("groovy-templates" ,groovy-templates)
374 ,@(package-inputs groovy-bootstrap)))
376 `(("groovy-bootstrap" ,groovy-bootstrap)
377 ("groovy-test" ,groovy-test)
378 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
379 ,@(package-native-inputs java-groovy-bootstrap)))
380 (synopsis "Groovy documentation generation")
381 (description "This package contains the groovy documentation generator,
382 similar to javadoc.")))
386 (inherit groovy-bootstrap)
389 `(#:jar-name "groovy-ant.jar"
391 #:test-dir "src/test"
392 ;; FIXME: Excluding all tests because they fail
395 "**/GroovycTest.java")
397 (modify-phases %standard-phases
398 (add-before 'configure 'chdir
400 (chdir "subprojects/groovy-ant")
402 (add-before 'build 'copy-resources
404 (copy-recursively "src/main/resources" "build/classes")
408 (mkdir-p "build/classes")
409 (mkdir-p "build/jar")
410 (apply invoke "java" "-cp" (getenv "CLASSPATH")
411 "org.codehaus.groovy.tools.FileSystemCompiler"
412 "-d" "build/classes" "-j"; joint compilation
413 (find-files "src/main" ".*\\.(groovy|java)$"))
414 (invoke "jar" "-cf" "build/jar/groovy-ant.jar"
415 "-C" "build/classes" ".")
419 (mkdir-p "build/test-classes")
420 (substitute* "build.xml"
421 (("depends=\"compile-tests\"") "depends=\"\"")
422 (("}/java") "}/groovy"))
423 (apply invoke "java" "-cp"
424 (string-append (getenv "CLASSPATH") ":build/classes")
425 "org.codehaus.groovy.tools.FileSystemCompiler"
426 "-d" "build/test-classes" "-j"
427 (find-files "src/test" ".*\\.(groovy|java)$"))
428 (invoke "ant" "check")
431 `(("groovy-groovydoc" ,groovy-groovydoc)
432 ,@(package-inputs groovy-bootstrap)))
434 `(("groovy-bootstrap" ,groovy-bootstrap)
435 ("groovy-xml" ,groovy-xml)
436 ("groovy-test" ,groovy-test)
437 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
438 ,@(package-native-inputs java-groovy-bootstrap)))
439 (synopsis "Groovy ant tasks")
440 (description "This package contains groovy-related ant tasks definitions.")))
444 (inherit groovy-bootstrap)
447 `(#:jar-name "groovy-bsf.jar"
449 #:test-dir "src/test"
451 ;; exception from Groovy: org.codehaus.groovy.runtime.InvokerInvocationException:
452 ;; groovy.lang.MissingMethodException: No signature of method:
453 ;; java.util.ArrayList.each() is applicable for argument types:
454 ;; (groovy.script.MapFromList$_doit_closure1) values:
455 ;; [groovy.script.MapFromList$_doit_closure1@17e554d5]
458 (modify-phases %standard-phases
459 (add-before 'configure 'chdir
461 (chdir "subprojects/groovy-bsf")
465 (mkdir-p "build/classes")
466 (mkdir-p "build/jar")
467 (apply invoke "java" "-cp" (getenv "CLASSPATH")
468 "org.codehaus.groovy.tools.FileSystemCompiler"
469 "-d" "build/classes" "-j"; joint compilation
470 (find-files "src/main" ".*\\.(groovy|java)$"))
471 (invoke "jar" "-cf" "build/jar/groovy-bsf.jar"
472 "-C" "build/classes" ".")
476 (mkdir-p "build/test-classes")
477 (substitute* "build.xml"
478 (("depends=\"compile-tests\"") "depends=\"\""))
479 (apply invoke "java" "-cp"
480 (string-append (getenv "CLASSPATH") ":build/classes")
481 "org.codehaus.groovy.tools.FileSystemCompiler"
482 "-d" "build/test-classes" "-j"
483 (find-files "src/test" ".*\\.(groovy|java)$"))
484 (invoke "ant" "check")
487 `(("java-commons-bsf" ,java-commons-bsf)
488 ,@(package-inputs groovy-bootstrap)))
490 `(("groovy-bootstrap" ,groovy-bootstrap)
491 ("groovy-test" ,groovy-test)
492 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
493 ("java-commons-logging-minimal" ,java-commons-logging-minimal)
494 ,@(package-native-inputs java-groovy-bootstrap)))
495 (synopsis "Groovy BSF engine")
496 (description "This package defines the BSF engine for using Groovy inside
497 any @dfn{Bean Scripting Framework} (BSF) application.")))
501 (inherit groovy-bootstrap)
502 (name "groovy-swing")
504 `(#:jar-name "groovy-swing.jar"
506 ;; FIXME: tests are not run
507 #:test-dir "src/test"
509 (modify-phases %standard-phases
510 (add-before 'configure 'chdir
512 (chdir "subprojects/groovy-swing")
516 (mkdir-p "build/classes")
517 (mkdir-p "build/jar")
518 (apply invoke "java" "-cp" (getenv "CLASSPATH")
519 "org.codehaus.groovy.tools.FileSystemCompiler"
520 "-d" "build/classes" "-j"; joint compilation
521 (find-files "src/main" ".*\\.(groovy|java)$"))
522 (invoke "jar" "-cf" "build/jar/groovy-swing.jar"
523 "-C" "build/classes" ".")
527 (mkdir-p "build/test-classes")
528 (substitute* "src/test/groovy/groovy/util/GroovySwingTestCase.groovy"
529 (("HeadlessTestSupport.headless") "isHeadless()"))
530 (substitute* "build.xml"
531 (("depends=\"compile-tests\"") "depends=\"\"")
532 (("}/java") "}/groovy"))
533 (apply invoke "java" "-cp"
534 (string-append (getenv "CLASSPATH") ":build/classes")
535 "org.codehaus.groovy.tools.FileSystemCompiler"
536 "-d" "build/test-classes" "-j"
537 (find-files "src/test" ".*\\.(groovy|java)$"))
538 (invoke "ant" "check")
541 `(("groovy-bootstrap" ,groovy-bootstrap)
542 ("groovy-test" ,groovy-test)
543 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
544 ("java-commons-logging-minimal" ,java-commons-logging-minimal)
545 ,@(package-native-inputs java-groovy-bootstrap)))
546 (synopsis "Groovy graphical library")
547 (description "This package contains the groovy bindings to Java Swing, a
548 library used to build graphical interfaces.")))
550 (define groovy-console
552 (inherit groovy-bootstrap)
553 (name "groovy-console")
555 `(#:jar-name "groovy-console.jar"
557 ;; FIXME: tests are not run
558 #:test-dir "src/test"
560 (modify-phases %standard-phases
561 (add-before 'configure 'chdir
563 (chdir "subprojects/groovy-console")
565 (add-before 'build 'copy-resources
567 (copy-recursively "src/main/resources" "build/classes")
571 (mkdir-p "build/classes")
572 (mkdir-p "build/jar")
573 (apply invoke "java" "-cp" (getenv "CLASSPATH")
574 "org.codehaus.groovy.tools.FileSystemCompiler"
575 "-d" "build/classes" "-j"; joint compilation
576 (find-files "src/main" ".*\\.(groovy|java)$"))
577 (invoke "jar" "-cf" "build/jar/groovy-console.jar"
578 "-C" "build/classes" ".")
582 (mkdir-p "build/test-classes")
583 (substitute* "build.xml"
584 (("depends=\"compile-tests\"") "depends=\"\"")
585 (("}/java") "}/groovy"))
587 "../groovy-swing/src/test/groovy/groovy/util/GroovySwingTestCase.groovy"
588 (("HeadlessTestSupport.headless") "isHeadless()"))
589 (apply invoke "java" "-cp"
590 (string-append (getenv "CLASSPATH") ":build/classes")
591 "org.codehaus.groovy.tools.FileSystemCompiler"
592 "-d" "build/test-classes" "-j"
594 (find-files "../groovy-swing/src/test" ".*\\.(groovy|java)$")
595 (find-files "src/test" ".*\\.(groovy|java)$")))
596 (invoke "ant" "check")
599 `(("groovy-swing" ,groovy-swing)
600 ("groovy-templates" ,groovy-templates)
601 ,@(package-inputs groovy-bootstrap)))
603 `(("groovy-bootstrap" ,groovy-bootstrap)
604 ("groovy-test" ,groovy-test)
605 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
606 ("java-commons-logging-minimal" ,java-commons-logging-minimal)
607 ,@(package-native-inputs java-groovy-bootstrap)))
608 (synopsis "Groovy graphical interface")
609 (description "This package contains a graphical interface to run groovy.")))
611 (define groovy-docgenerator
613 (inherit groovy-bootstrap)
614 (name "groovy-docgenerator")
616 `(#:jar-name "groovy-docgenerator.jar"
618 #:tests? #f; No tests
620 (modify-phases %standard-phases
621 (add-before 'configure 'chdir
623 (chdir "subprojects/groovy-docgenerator")
625 (add-before 'build 'copy-resources
627 (copy-recursively "src/main/resources" "build/classes")
631 (mkdir-p "build/classes")
632 (mkdir-p "build/jar")
633 (apply invoke "java" "-cp" (getenv "CLASSPATH")
634 "org.codehaus.groovy.tools.FileSystemCompiler"
635 "-d" "build/classes" "-j"; joint compilation
636 (find-files "src/main" ".*\\.(groovy|java)$"))
637 (invoke "jar" "-cf" "build/jar/groovy-docgenerator.jar"
638 "-C" "build/classes" ".")
641 `(("groovy-templates" ,groovy-templates)
642 ("groovy-swing" ,groovy-swing)
643 ("java-qdox-1.12" ,java-qdox-1.12)
644 ,@(package-inputs groovy-bootstrap)))
646 `(("groovy-bootstrap" ,groovy-bootstrap)
647 ("groovy-test" ,groovy-test)
648 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
649 ,@(package-native-inputs java-groovy-bootstrap)))
650 (synopsis "Groovy documentation generation")
651 (description "This package contains a command line tool to generate
652 documentation for groovy applications.")))
654 (define groovy-groovysh
656 (inherit groovy-bootstrap)
657 (name "groovy-groovysh")
659 `(#:jar-name "groovy-groovysh.jar"
660 #:test-dir "src/test"
663 (modify-phases %standard-phases
664 (add-before 'configure 'chdir
666 (chdir "subprojects/groovy-groovysh")
668 (add-before 'build 'copy-resources
670 (copy-recursively "src/main/resources" "build/classes")
674 (mkdir-p "build/classes")
675 (mkdir-p "build/jar")
676 (apply invoke "java" "-cp" (getenv "CLASSPATH")
677 "org.codehaus.groovy.tools.FileSystemCompiler"
678 "-d" "build/classes" "-j"; joint compilation
679 (find-files "src/main" ".*\\.(groovy|java)$"))
680 (invoke "jar" "-cf" "build/jar/groovy-groovysh.jar"
681 "-C" "build/classes" ".")
685 (mkdir-p "build/test-classes")
686 (substitute* "build.xml"
687 (("depends=\"compile-tests\"") "depends=\"\"")
688 (("}/java") "}/groovy"))
689 (apply invoke "java" "-cp"
690 (string-append (getenv "CLASSPATH") ":build/classes")
691 "org.codehaus.groovy.tools.FileSystemCompiler"
692 "-d" "build/test-classes" "-j"
693 (append (find-files "src/test" ".*\\.(groovy|java)$")))
694 (invoke "ant" "check")
697 `(("groovy-xml" ,groovy-xml)
698 ("groovy-console" ,groovy-console)
699 ,@(package-inputs groovy-bootstrap)))
701 `(("groovy-bootstrap" ,groovy-bootstrap)
702 ("groovy-test" ,groovy-test)
703 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
704 ,@(package-native-inputs java-groovy-bootstrap)))
705 (synopsis "Groovy REPL")
706 (description "This package contains the Groovy REPL.")))
710 (inherit groovy-bootstrap)
713 `(#:jar-name "groovy-jmx.jar"
714 #:test-dir "src/test"
717 (modify-phases %standard-phases
718 (add-before 'configure 'chdir
720 (chdir "subprojects/groovy-jmx")
724 (mkdir-p "build/classes")
725 (mkdir-p "build/jar")
726 (apply invoke "java" "-cp" (getenv "CLASSPATH")
727 "org.codehaus.groovy.tools.FileSystemCompiler"
728 "-d" "build/classes" "-j"; joint compilation
729 (find-files "src/main" ".*\\.(groovy|java)$"))
730 (invoke "jar" "-cf" "build/jar/groovy-jmx.jar"
731 "-C" "build/classes" ".")
735 (mkdir-p "build/test-classes")
736 (substitute* "build.xml"
737 (("depends=\"compile-tests\"") "depends=\"\"")
738 (("}/java") "}/groovy"))
739 (apply invoke "java" "-cp"
740 (string-append (getenv "CLASSPATH") ":build/classes")
741 "org.codehaus.groovy.tools.FileSystemCompiler"
742 "-d" "build/test-classes" "-j"
743 (append (find-files "src/test" ".*\\.(groovy|java)$")))
744 (invoke "ant" "check")
747 `(("groovy-bootstrap" ,groovy-bootstrap)
748 ("groovy-test" ,groovy-test)
749 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
750 ,@(package-native-inputs java-groovy-bootstrap)))
751 (synopsis "Groovy JMX extension")
752 (description "This package contains the JMX extension of Groovy, for
753 management and monitoring of JVM-based solutions.")))
757 (inherit groovy-bootstrap)
760 `(#:jar-name "groovy-json.jar"
761 #:test-dir "src/test"
764 (modify-phases %standard-phases
765 (add-before 'configure 'chdir
767 (chdir "subprojects/groovy-json")
771 (mkdir-p "build/classes")
772 (mkdir-p "build/jar")
773 (apply invoke "java" "-cp" (getenv "CLASSPATH")
774 "org.codehaus.groovy.tools.FileSystemCompiler"
775 "-d" "build/classes" "-j"; joint compilation
776 (find-files "src/main" ".*\\.(groovy|java)$"))
777 (invoke "jar" "-cf" "build/jar/groovy-json.jar"
778 "-C" "build/classes" ".")
782 (mkdir-p "build/test-classes")
783 (substitute* "build.xml"
784 (("depends=\"compile-tests\"") "depends=\"\"")
785 (("}/java") "}/groovy"))
786 (apply invoke "java" "-cp"
787 (string-append (getenv "CLASSPATH") ":build/classes")
788 "org.codehaus.groovy.tools.FileSystemCompiler"
789 "-d" "build/test-classes" "-j"
790 (append (find-files "src/test" ".*\\.(groovy|java)$")))
791 (invoke "ant" "check")
794 `(("groovy-bootstrap" ,groovy-bootstrap)
795 ("groovy-test" ,groovy-test)
796 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
797 ,@(package-native-inputs java-groovy-bootstrap)))
798 (synopsis "Groovy JSON")
799 (description "This package contains JSON-related utilities for groovy.")))
801 (define groovy-jsr223
803 (inherit groovy-bootstrap)
804 (name "groovy-jsr223")
806 `(#:jar-name "groovy-jsr223.jar"
807 #:test-dir "src/test"
810 (modify-phases %standard-phases
811 (add-before 'configure 'chdir
813 (chdir "subprojects/groovy-jsr223")
815 (add-before 'build 'copy-resources
817 (copy-recursively "src/main/resources" "build/classes")
821 (mkdir-p "build/classes")
822 (mkdir-p "build/jar")
823 (apply invoke "java" "-cp" (getenv "CLASSPATH")
824 "org.codehaus.groovy.tools.FileSystemCompiler"
825 "-d" "build/classes" "-j"; joint compilation
826 (find-files "src/main" ".*\\.(groovy|java)$"))
827 (invoke "jar" "-cf" "build/jar/groovy-jsr223.jar"
828 "-C" "build/classes" ".")
832 (mkdir-p "build/test-classes")
833 (substitute* "build.xml"
834 (("depends=\"compile-tests\"") "depends=\"\"")
835 (("}/java") "}/groovy"))
836 (apply invoke "java" "-cp"
837 (string-append (getenv "CLASSPATH") ":build/classes")
838 "org.codehaus.groovy.tools.FileSystemCompiler"
839 "-d" "build/test-classes" "-j"
840 (append (find-files "src/test" ".*\\.(groovy|java)$")))
841 (invoke "ant" "check")
844 `(("groovy-bootstrap" ,groovy-bootstrap)
845 ("groovy-test" ,groovy-test)
846 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
847 ,@(package-native-inputs java-groovy-bootstrap)))
848 (synopsis "Groovy's own JSR223 implementation")
849 (description "This package contains Groovy's own JSR223 implementation. This
850 module is used for interaction between Groovy and Java code.")))
854 (inherit groovy-bootstrap)
857 `(#:jar-name "groovy-nio.jar"
858 #:test-dir "src/test"
860 #:tests? #f; Requires spock-framework
862 (modify-phases %standard-phases
863 (add-before 'configure 'chdir
865 (chdir "subprojects/groovy-nio")
869 (mkdir-p "build/classes")
870 (mkdir-p "build/jar")
871 (apply invoke "java" "-cp" (getenv "CLASSPATH")
872 "org.codehaus.groovy.tools.FileSystemCompiler"
873 "-d" "build/classes" "-j"; joint compilation
874 (find-files "src/main" ".*\\.(groovy|java)$"))
875 (invoke "jar" "-cf" "build/jar/groovy-nio.jar"
876 "-C" "build/classes" ".")
879 `(("groovy-bootstrap" ,groovy-bootstrap)
880 ("groovy-test" ,groovy-test)
881 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
882 ,@(package-native-inputs java-groovy-bootstrap)))
883 (synopsis "Groovy input-output library")
884 (description "This package implements an input/output library that extends
885 the functionality of the common library of Java.")))
887 (define groovy-servlet
889 (inherit groovy-bootstrap)
890 (name "groovy-servlet")
892 `(#:jar-name "groovy-servlet.jar"
893 #:test-dir "src/test"
896 (modify-phases %standard-phases
897 (add-before 'configure 'chdir
899 (chdir "subprojects/groovy-servlet")
903 (mkdir-p "build/classes")
904 (mkdir-p "build/jar")
905 (apply invoke "java" "-cp" (getenv "CLASSPATH")
906 "org.codehaus.groovy.tools.FileSystemCompiler"
908 "-j"; joint compilation
909 (find-files "src/main" ".*\\.(groovy|java)$"))
910 (invoke "jar" "-cf" "build/jar/groovy-servlet.jar"
911 "-C" "build/classes" ".")
915 (mkdir-p "build/test-classes")
916 (substitute* "build.xml"
917 (("depends=\"compile-tests\"") "depends=\"\"")
918 (("}/java") "}/groovy"))
919 (apply invoke "java" "-cp"
920 (string-append (getenv "CLASSPATH") ":build/classes")
921 "org.codehaus.groovy.tools.FileSystemCompiler"
922 "-d" "build/test-classes"
924 (append (find-files "src/test" ".*\\.(groovy|java)$")))
925 (invoke "ant" "check")
928 `(("groovy-templates" ,groovy-templates)
929 ("groovy-xml" ,groovy-xml)
930 ,@(package-inputs groovy-bootstrap)))
932 `(("groovy-bootstrap" ,groovy-bootstrap)
933 ("groovy-json" ,groovy-json)
934 ("groovy-test" ,groovy-test)
935 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
936 ,@(package-native-inputs java-groovy-bootstrap)))
937 (synopsis "Groovy's servlet implementation")
938 (description "This package contains a library to create groovlets, Groovy's
939 version of Java servlets.")))
943 (inherit groovy-bootstrap)
946 `(#:jar-name "groovy-sql.jar"
947 #:test-dir "src/test"
948 #:tests? #f;TODO: Requires hsqldb
951 (modify-phases %standard-phases
952 (add-before 'configure 'chdir
954 (chdir "subprojects/groovy-sql")
958 (mkdir-p "build/classes")
959 (mkdir-p "build/jar")
960 (apply invoke "java" "-cp" (getenv "CLASSPATH")
961 "org.codehaus.groovy.tools.FileSystemCompiler"
962 "-d" "build/classes" "-j"; joint compilation
963 (find-files "src/main"
964 ".*\\.(groovy|java)$"))
965 (invoke "jar" "-cf" "build/jar/groovy-sql.jar"
966 "-C" "build/classes" ".")
969 `(("groovy-bootstrap" ,groovy-bootstrap)
970 ("groovy-test" ,groovy-test)
971 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
972 ,@(package-native-inputs java-groovy-bootstrap)))
973 (synopsis "Groovy SQL library")
974 (description "This package contains a facade over Java's normal JDBC APIs
975 providing greatly simplified resource management and result set handling.")))
977 (define groovy-testng
979 (inherit groovy-bootstrap)
980 (name "groovy-testng")
982 `(#:jar-name "groovy-testng.jar"
983 #:tests? #f; No tests
986 (modify-phases %standard-phases
987 (add-before 'configure 'chdir
989 (chdir "subprojects/groovy-testng")
991 (add-before 'build 'copy-resources
993 (copy-recursively "src/main/resources" "build/classes")
997 (mkdir-p "build/classes")
998 (mkdir-p "build/jar")
999 (apply invoke "java" "-cp" (getenv "CLASSPATH")
1000 "org.codehaus.groovy.tools.FileSystemCompiler"
1001 "-d" "build/classes"
1002 "-j"; joint compilation
1003 (find-files "src/main" ".*\\.(groovy|java)$"))
1004 (invoke "jar" "-cf" "build/jar/groovy-testng.jar"
1005 "-C" "build/classes" ".")
1008 `(("groovy-bootstrap" ,groovy-bootstrap)
1009 ("groovy-test" ,groovy-test)
1010 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
1011 ,@(package-native-inputs java-groovy-bootstrap)))
1012 (synopsis "Groovy testing framework")
1013 (description "This package contains integration code for running TestNG
1014 tests in Groovy.")))
1016 (define groovy-macro
1018 (inherit groovy-bootstrap)
1019 (name "groovy-macro")
1021 `(#:jar-name "groovy-macro.jar"
1022 #:test-dir "src/test"
1025 (modify-phases %standard-phases
1026 (add-before 'configure 'chdir
1028 (chdir "subprojects/groovy-macro")
1032 (mkdir-p "build/classes")
1033 (mkdir-p "build/jar")
1034 (apply invoke "java" "-cp" (getenv "CLASSPATH")
1035 "org.codehaus.groovy.tools.FileSystemCompiler"
1036 "-d" "build/classes" "-j"; joint compilation
1037 (find-files "src/main" ".*\\.(groovy|java)$"))
1038 (invoke "jar" "-cf" "build/jar/groovy-macro.jar"
1039 "-C" "build/classes" ".")
1043 (mkdir-p "build/test-classes")
1044 (substitute* "build.xml"
1045 (("depends=\"compile-tests\"") "depends=\"\"")
1046 (("}/java") "}/groovy"))
1047 (apply invoke "java" "-cp"
1048 (string-append (getenv "CLASSPATH") ":build/classes")
1049 "org.codehaus.groovy.tools.FileSystemCompiler"
1050 "-d" "build/test-classes" "-j"
1051 (append (find-files "src/test" ".*\\.(groovy|java)$")))
1052 (invoke "ant" "check")
1055 `(("groovy-templates" ,groovy-templates)
1056 ("groovy-xml" ,groovy-xml)
1057 ,@(package-inputs groovy-bootstrap)))
1059 `(("groovy-bootstrap" ,groovy-bootstrap)
1060 ("groovy-json" ,groovy-json)
1061 ("groovy-test" ,groovy-test)
1062 ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
1063 ,@(package-native-inputs java-groovy-bootstrap)))
1064 (synopsis "Groovy macro processor")
1065 (description "This package contains a high-level library to create macro
1066 and modify groovy's @dfn{Abstract Syntax Tree} (AST).")))
1068 (define-public groovy
1070 (inherit groovy-bootstrap)
1073 `(#:tests? #f; No tests
1076 (modify-phases %standard-phases
1080 (lambda* (#:key outputs inputs #:allow-other-keys)
1081 (let* ((out (assoc-ref outputs "out"))
1082 (out-bin (string-append out "/bin"))
1083 (out-lib (string-append out "/lib")))
1084 (with-directory-excursion "src/bin"
1085 (substitute* "startGroovy"
1089 (("@GROOVYJAR@") "groovy.jar")
1090 (("MAX_FD=\"maximum\"")
1092 "MAX_FD=\"maximum\"\nJAVAHOME="
1093 (assoc-ref inputs "jdk"))))
1094 ;; Groovy uses class loading. It's not enough to put the class
1095 ;; in the loader's classpath, as it causes breakages:
1096 ;; the compiler would give this error:
1097 ;; "Prohibited package name: java.lang"
1098 ;; So we symlink dependencies in this package's output. The
1099 ;; starter class (in groovy-bootstrap) is where the class loader
1100 ;; will look for dependencies, so we put it there too.
1106 (symlink jar (string-append out-lib "/" (basename jar))))
1107 (find-files (assoc-ref inputs input) ".*.jar")))
1108 '("groovy-bootstrap" "groovy-ant" "groovy-bsf"
1109 "groovy-console" "groovy-docgenerator"
1110 "groovy-groovydoc" "groovy-groovysh"
1111 "groovy-jmx" "groovy-json" "groovy-jsr223"
1112 "groovy-nio" "groovy-servlet" "groovy-sql"
1113 "groovy-swing" "groovy-templates" "groovy-testng"
1114 "groovy-xml" "java-commons-cli" "java-asm"
1115 "java-classpathx-servletapi" "java-xstream"
1116 "java-jansi" "java-jline-2"))
1117 ;; antlr.jar is present twice in antlr2. Symlink doesn't like
1118 ;; it, so we symlink it here.
1119 (symlink (string-append (assoc-ref inputs "antlr2") "/lib/antlr.jar")
1120 (string-append out-lib "/antlr.jar"))
1123 (install-file tool out-bin)
1124 (chmod (string-append out-bin "/" tool) #o755))
1125 '("grape" "groovy" "groovyc" "groovyConsole" "groovydoc"
1126 "groovysh" "java2groovy" "startGroovy")))
1127 (install-file "src/conf/groovy-starter.conf"
1128 (string-append out "/conf"))
1131 `(("groovy-bootstrap" ,groovy-bootstrap)
1132 ("groovy-ant" ,groovy-ant)
1133 ("groovy-bsf" ,groovy-bsf)
1134 ("groovy-console" ,groovy-console)
1135 ("groovy-docgenerator" ,groovy-docgenerator)
1136 ("groovy-groovydoc" ,groovy-groovydoc)
1137 ("groovy-groovysh" ,groovy-groovysh)
1138 ("groovy-jmx" ,groovy-jmx)
1139 ("groovy-json" ,groovy-json)
1140 ("groovy-jsr223" ,groovy-jsr223)
1141 ("groovy-nio" ,groovy-nio)
1142 ("groovy-servlet" ,groovy-servlet)
1143 ("groovy-sql" ,groovy-sql)
1144 ("groovy-swing" ,groovy-swing)
1145 ("groovy-templates" ,groovy-templates)
1146 ("groovy-testng" ,groovy-testng)
1147 ("groovy-xml" ,groovy-xml)
1148 ("java-commons-cli" ,java-commons-cli)
1149 ("java-asm" ,java-asm)
1150 ("java-classpathx-servletapi" ,java-classpathx-servletapi)
1151 ("java-xstream" ,java-xstream)
1152 ("java-jansi" ,java-jansi)
1153 ("java-jline-2" ,java-jline-2)
1154 ("antlr2" ,antlr2)))
1155 (synopsis "Programming language for the JVM")
1156 (description "Apache Groovy is a powerful, optionally typed and dynamic
1157 language, with static-typing and static compilation capabilities, for the Java
1158 platform. It integrates smoothly with any Java program, and immediately
1159 delivers to your application powerful features, including scripting
1160 capabilities, Domain-Specific Language authoring, runtime and compile-time
1161 meta-programming and functional programming.")))