gradle.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 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))))) |
202 |