groovy.scm
| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> |
| 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; |
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 7 | ;;; under the terms of the GNU General Public License as published by |
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 9 | ;;; your option) any later version. |
| 10 | ;;; |
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ;;; GNU General Public License for more details. |
| 15 | ;;; |
| 16 | ;;; You should have received a copy of the GNU General Public License |
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | (define-module (more packages groovy) |
| 20 | #:use-module ((guix licenses) #:prefix license:) |
| 21 | #:use-module (gnu packages) |
| 22 | #:use-module (guix packages) |
| 23 | #:use-module (guix download) |
| 24 | #:use-module (guix utils) |
| 25 | #:use-module (guix build-system ant) |
| 26 | #:use-module (gnu packages java) |
| 27 | #:use-module (gnu packages web) |
| 28 | #:use-module (gnu packages xml) |
| 29 | #:use-module (more packages java)) |
| 30 | |
| 31 | ;; This package contains the java bootstrap that is used to build groovy submodules. |
| 32 | (define-public groovy-java-bootstrap |
| 33 | (package |
| 34 | (name "groovy") |
| 35 | (version "2.4.13") |
| 36 | (source (origin |
| 37 | (method url-fetch) |
| 38 | (uri (string-append "https://github.com/apache/groovy/archive/GROOVY_" |
| 39 | "2_4_13.tar.gz")) |
| 40 | (file-name (string-append name "-" version ".tar.gz")) |
| 41 | (sha256 |
| 42 | (base32 |
| 43 | "0qf1l029ilhnldmd194aybk3053apya3vfd33d3m80n2zh2wnbc1")) |
| 44 | (patches |
| 45 | (search-patches |
| 46 | "groovy-Add-exceptionutilsgenerator.patch")))) |
| 47 | (build-system ant-build-system) |
| 48 | (arguments |
| 49 | `(#:jar-name "groovy.jar" |
| 50 | #:source-dir "src/main:subprojects/groovy-test/src/main/java" |
| 51 | #:test-dir "src/test" |
| 52 | #:tests? #f |
| 53 | #:main-class "groovy.ui.GroovyMain" |
| 54 | #:phases |
| 55 | (modify-phases %standard-phases |
| 56 | (add-before 'build 'generate-parser |
| 57 | (lambda _ |
| 58 | (with-directory-excursion "src/main/org/codehaus/groovy/antlr/java" |
| 59 | (zero? (system* "antlr" "java.g"))) |
| 60 | (with-directory-excursion "src/main/org/codehaus/groovy/antlr" |
| 61 | (mkdir "parser") |
| 62 | (with-directory-excursion "parser" |
| 63 | (zero? (system* "antlr" "../groovy.g")))))) |
| 64 | (add-before 'build 'generate-exception-utils |
| 65 | (lambda _ |
| 66 | (system* "javac" "-cp" (getenv "CLASSPATH") |
| 67 | "config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java") |
| 68 | (zero? (system* "java" "-cp" (string-append (getenv "CLASSPATH") |
| 69 | ":config/ant/src") |
| 70 | "org.codehaus.groovy.ExceptionUtilsGenerator" |
| 71 | "build/classes/org/codehaus/groovy/runtime/ExceptionUtils.class")))) |
| 72 | (add-after 'install 'install-sh |
| 73 | (lambda* (#:key outputs #:allow-other-keys) |
| 74 | (substitute* "src/bin/startGroovy" |
| 75 | ((" -classpath .*") |
| 76 | (string-append " -classpath " (getenv "CLASSPATH") ":" |
| 77 | (assoc-ref outputs "out") "/share/java/groovy.jar \\"))) |
| 78 | (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) |
| 79 | (for-each (lambda (script) |
| 80 | (install-file (string-append "src/bin/" script) bin) |
| 81 | (chmod (string-append bin "/" script) #o755)) |
| 82 | '("grape" "groovy" "groovyc" "groovyConsole" "groovydoc" |
| 83 | "groovysh" "java2groovy" "startGroovy"))) |
| 84 | (install-file "src/conf/groovy-starter.conf" |
| 85 | (string-append (assoc-ref outputs "out") "/conf")) |
| 86 | #t)) |
| 87 | (add-before 'check 'add-groovy-classes |
| 88 | (lambda _ |
| 89 | (substitute* "build.xml" |
| 90 | (("a") "a"))))))) |
| 91 | (native-inputs |
| 92 | `(("java-junit" ,java-junit) |
| 93 | ("antlr2" ,antlr2) |
| 94 | ("java-jmock-1" ,java-jmock-1) |
| 95 | ("java-xmlunit-legacy" ,java-xmlunit-legacy))) |
| 96 | (inputs |
| 97 | `(("java-commons-cli" ,java-commons-cli) |
| 98 | ("java-asm" ,java-asm) |
| 99 | ("java-tomcat" ,java-tomcat) |
| 100 | ("java-xstream" ,java-xstream) |
| 101 | ("java-jansi" ,java-jansi) |
| 102 | ("java-jline" ,java-jline))) |
| 103 | (home-page "") |
| 104 | (synopsis "") |
| 105 | (description "") |
| 106 | (license (list license:gpl2 |
| 107 | license:cddl1.1)))) |
| 108 | |
| 109 | (define-public groovy-templates |
| 110 | (package |
| 111 | (inherit groovy-java-bootstrap) |
| 112 | (name "groovy-templates") |
| 113 | (arguments |
| 114 | `(#:jar-name "groovy-templates.jar" |
| 115 | #:phases |
| 116 | (modify-phases %standard-phases |
| 117 | (replace 'build |
| 118 | (lambda _ |
| 119 | (mkdir-p "build/classes") |
| 120 | (zero? (system* "java" "-cp" (getenv "CLASSPATH") |
| 121 | "org.codehaus.groovy.tools.FileSystemCompiler" |
| 122 | "-d" "build/classes" |
| 123 | "-j"; joint compilation |
| 124 | (find-files "subprojects/groovy-templates/src/main" |
| 125 | ".*\\.(groovy|java)$"))))) |
| 126 | (replace 'check |
| 127 | (lambda _ |
| 128 | (mkdir-p "build/test-classes") |
| 129 | (zero? (system* "java" "-cp" (getenv "CLASSPATH") |
| 130 | "org.codehaus.groovy.tools.FileSystemCompiler" |
| 131 | "-d" "build/test-classes" |
| 132 | "-j" |
| 133 | (find-files "subprojects/groovy-templates/src/test" |
| 134 | ".*\\.(groovy|java)$")))))))) |
| 135 | (native-inputs |
| 136 | `(("groovy-java-bootstrap" ,groovy-java-bootstrap) |
| 137 | ,@(package-native-inputs groovy-java-bootstrap))))) |
| 138 | |
| 139 |