try to build groovy and gradle

Julien LepillerTue Dec 12 22:48:40+0100 2017

7a7f419

try to build groovy and gradle

more/packages/gradle.scm unknown status 1

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 gradle)
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 (more packages java))
28+
29+
;    (version "4.3.1")
30+
;    (source (origin
31+
;              (method url-fetch)
32+
;              (uri (string-append "https://github.com/gradle/gradle/archive/v"
33+
;                                  version ".tar.gz"))
34+
;              (file-name (string-append "gradle-" version ".tar.gz"))
35+
;              (sha256
36+
;               (base32
37+
;                "0lc093zxadzf1hbgsxrk6bpgaxws25pkja1d4xxw179x83ifib7p"))))
38+
39+
(define (gradle-subproject subproject)
40+
  (package
41+
    (name (string-append "gradle-" subproject))
42+
    (version "2.3")
43+
    (source (origin
44+
              (method url-fetch)
45+
              (uri (string-append "https://github.com/gradle/gradle/archive/REL_"
46+
                                  version ".tar.gz"))
47+
              (file-name (string-append "gradle-" version ".tar.gz"))
48+
              (sha256
49+
               (base32
50+
                "1v65ac38fzj92jqgrpgma8kpdy974xi8aclgwxkdasy4lcr0k37g"))))
51+
    (build-system ant-build-system)
52+
    (arguments
53+
     `(#:jar-name (string-append "gradle-" ,subproject ".jar")
54+
       #:source-dir (string-append "subprojects/" ,subproject "/src/main/java")
55+
       #:jdk ,icedtea-8
56+
       #:tests? #f;; Ignore tests for now
57+
       #:test-dir (string-append "subprojects/" ,subproject "/src/test")))
58+
    (inputs '())
59+
    (native-inputs '())
60+
    (home-page "")
61+
    (synopsis "Build system")
62+
    (description "Build system")
63+
    (license license:asl2.0)))
64+
65+
(define (gradle-groovy-subproject subproject)
66+
  (let ((base (gradle-subproject subproject)))
67+
    (package
68+
      (inherit base)
69+
      (arguments
70+
       `(#:jar-name (string-append "gradle-" ,subproject ".jar")
71+
         #:source-dir (string-append "subprojects/" ,subproject "/src/main/groovy")
72+
         #:test-dir (string-append "subprojects/" ,subproject "/src/test")
73+
         #:jdk ,icedtea-8
74+
         #:phases
75+
         (modify-phases %standard-phases
76+
           (add-before 'build 'use-groovy
77+
             (lambda _
78+
               (substitute* "build.xml"
79+
                 (("javac") "groovyc")
80+
                 (("includeantruntime=\"false\"")
81+
                  "includeantruntime=\"false\" fork=\"yes\"")
82+
                 (("classpath=\"@refidclasspath\"")
83+
                  "classpathref=\"classpath\"")
84+
                 ;; To enable joint compilation
85+
                 (("classpathref=\"classpath\" />")
86+
                  "classpathref=\"classpath\"><javac source=\"1.5\" target=\"1.5\" /></groovyc>")
87+
                 (("<project basedir=\".\">")
88+
                  "<project basedir=\".\"><taskdef name=\"groovyc\"
89+
classname=\"org.codehaus.groovy.ant.Groovyc\" />")))))))
90+
      (native-inputs
91+
       `(("groovy-bootstrap" ,groovy-bootstrap)
92+
         ,@(package-inputs groovy-bootstrap))))))
93+
94+
(define-public gradle-internal-testing
95+
  (package
96+
    (inherit (gradle-groovy-subproject "internal-testing"))
97+
    (inputs
98+
     `(("java-junit" ,java-junit)
99+
       ("java-jsoup" ,java-jsoup)
100+
       ("java-guava" ,java-guava)
101+
       ("java-slf4j-api" ,java-slf4j-api)
102+
       ("java-hamcrest-core" ,java-hamcrest-core)
103+
       ("java-commons-lang" ,java-commons-lang)
104+
       ("java-commons-io" ,java-commons-io)
105+
       ("gradle-base-services-bootstrap" ,gradle-base-services-bootstrap)))))
106+
107+
;; Cycle with internal-testing
108+
(define-public gradle-base-services
109+
  (let ((base (gradle-subproject "base-services")))
110+
    (package
111+
      (inherit base)
112+
      (inputs
113+
       `(("java-guava" ,java-guava)
114+
         ("java-slf4j-api" ,java-slf4j-api)
115+
         ("java-commons-lang" ,java-commons-lang)
116+
         ("java-commons-io" ,java-commons-io)
117+
         ("java-jsr305" ,java-jsr305)
118+
         ("java-jcip-annotations" ,java-jcip-annotations)))
119+
    (native-inputs
120+
     `(("java-junit" ,java-junit)
121+
       ("java-hamcrest-core" ,java-hamcrest-core))))))
122+
123+
(define-public gradle-base-services-groovy
124+
  (package
125+
    (inherit (gradle-groovy-subproject "base-services-groovy"))
126+
    (inputs
127+
     `(("gradle-base-services" ,gradle-base-services)
128+
       ("java-byte-buddy-dep" ,java-byte-buddy-dep)
129+
       ("java-guava" ,java-guava)))
130+
    (arguments
131+
      (substitute-keyword-arguments (package-arguments java-javacc)
132+
        ((#:phases phases)
133+
         `(modify-phases ,phases
134+
            (add-before 'build 'add-bytebuddy
135+
              (lambda _
136+
                (substitute* "subprojects/base-services-groovy/src/main/groovy/org/gradle/groovy/scripts/internal/AstUtils.java"
137+
                  (("package org.gradle.groovy.scripts.internal;")
138+
                   "package org.gradle.groovy.scripts.internal;
139+
import net.bytebuddy.implementation.MethodCall;"))
140+
                #t))))))))
141+
142+
;(define-public gradle-build-option
143+
;  (package
144+
;    (inherit (gradle-subproject "build-option"))
145+
;    (inputs
146+
;     `(("gradle-cli" ,gradle-cli)
147+
;       ("java-commons-lang" ,java-commons-lang)
148+
;       ("java-jsr305" ,java-jsr305)))))
149+
150+
(define-public gradle-cli
151+
  (package
152+
    (inherit (gradle-subproject "cli"))))
153+
154+
(define-public gradle-native
155+
  (package
156+
    (inherit (gradle-subproject "native"))
157+
    (inputs
158+
     `(("gradle-base-services" ,gradle-base-services)
159+
       ("java-commons-io" ,java-commons-io)
160+
       ("java-guava" ,java-guava)
161+
       ("java-jansi" ,java-jansi)
162+
       ("java-jsr305" ,java-jsr305)
163+
       ("java-native-platform" ,java-native-platform)
164+
       ("java-slf4j-api" ,java-slf4j-api)))))
165+
166+
(define-public gradle-messaging
167+
  (let ((base  (gradle-subproject "messaging")))
168+
    (package
169+
      (inherit base)
170+
      (arguments
171+
       `(#:phases
172+
         (modify-phases %standard-phases
173+
           (add-before 'build 'fix-kryo
174+
             (lambda _
175+
               ;; gradle depends on kryo-2.20 from 2013, we packaged version 4.
176+
               (substitute* "subprojects/messaging/src/main/java/org/gradle/messaging/serialize/kryo/KryoBackedEncoder.java"
177+
                 (("public int getWritePosition")
178+
                  "public long getWritePosition"))
179+
               #t)))
180+
         ,@(package-arguments base)))
181+
      (inputs
182+
       `(("gradle-base-services" ,gradle-base-services)
183+
         ("java-guava" ,java-guava)
184+
         ("java-jsr305" ,java-jsr305)
185+
         ("java-kryo" ,java-kryo)
186+
         ("java-slf4j-api" ,java-slf4j-api))))))
187+
188+
(define-public gradle-core
189+
  (package
190+
    (inherit (gradle-groovy-subproject "core"))
191+
    (inputs
192+
     `(("gradle-base-services" ,gradle-base-services)
193+
       ("gradle-cli" ,gradle-cli)
194+
       ("gradle-messaging" ,gradle-messaging)
195+
       ("gradle-native" ,gradle-native)
196+
       ("java-commons-io" ,java-commons-io)
197+
       ("java-commons-lang" ,java-commons-lang)
198+
       ("java-guava" ,java-guava)
199+
       ("java-javax-inject" ,java-javax-inject)
200+
       ("java-jcip-annotations" ,java-jcip-annotations)
201+
       ("java-slf4j-api" ,java-slf4j-api)))))

more/packages/groovy.scm unknown status 1

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+