;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Julien Lepiller ;;; Copyright © 2019 Tobias Geerinck-Rice ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages groovy) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix build-system ant) #:use-module (gnu packages) #:use-module (gnu packages java) #:use-module (gnu packages xml)) (define java-groovy-bootstrap (package (name "java-groovy-bootstrap") (version "3.0.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/apache/groovy") (commit (string-append "GROOVY_" (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))))) (file-name (git-file-name name version)) (sha256 (base32 "00556qxjmcn3a3xhfy6n0zw3d69mnw72vzm2rb6n4ihzkk7579nm")) (patches (search-patches "groovy-add-exceptionutilsgenerator.patch")))) (build-system ant-build-system) (arguments `(#:jar-name "groovy.jar" #:source-dir "src/main/java:src/main/antlr2:subprojects/parser-antlr4/src/main/java:src/antlr" #:test-dir "src/test" #:tests? #f #:jdk ,openjdk9 #:main-class "groovy.ui.GroovyMain" #:phases (modify-phases %standard-phases (add-before 'build 'generate-parsers (lambda _ (with-directory-excursion "src/main/antlr2/org/codehaus/groovy/antlr/java" (invoke "antlr" "java.g")) (with-directory-excursion "src/main/antlr2/org/codehaus/groovy/antlr" (mkdir "parser") (with-directory-excursion "parser" (invoke "antlr" "../groovy.g"))) (invoke "antlr4" "-lib" "src/antlr" "-package" "org.apache.groovy.parser.antlr4" "-visitor" "-no-listener" "src/antlr/GroovyLexer.g4") (invoke "antlr4" "-lib" "src/antlr" "-package" "org.apache.groovy.parser.antlr4" "-visitor" "-no-listener" "src/antlr/GroovyParser.g4") #t)) (add-before 'build 'generate-exception-utils (lambda _ (invoke "javac" "-cp" (getenv "CLASSPATH") "-source" "1.8" "-target" "1.8" "config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java") (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":config/ant/src") "org.codehaus.groovy.ExceptionUtilsGenerator" "build/classes/org/codehaus/groovy/runtime/ExceptionUtils.class") #t)) (add-before 'build 'set-source-level (lambda _ (substitute* "build.xml" (("