scala.scm
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2018 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 scala) |
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 git-download) |
25 | #:use-module (guix utils) |
26 | #:use-module (guix build-system ant) |
27 | #:use-module (guix build-system gnu) |
28 | #:use-module (guix build-system trivial) |
29 | #:use-module (gnu packages base) |
30 | #:use-module (gnu packages bash) |
31 | #:use-module (gnu packages compression) |
32 | #:use-module (gnu packages java) |
33 | #:use-module (gnu packages protobuf) |
34 | #:use-module (more packages java)) |
35 | |
36 | ;; This package downloads the so-called official version of scala, a pre-built |
37 | ;; binary by the scala developers. |
38 | ;; This binary should never be made part of Guix itself, because we have |
39 | ;; ways to bootstrap it properly. The bootstrap project of scala takes time, |
40 | ;; so in the meantime... here you are :( |
41 | (define-public scala-official |
42 | (package |
43 | (name "scala-official") |
44 | (version "2.12.8") |
45 | (source |
46 | (origin |
47 | (method url-fetch) |
48 | (uri (string-append "https://downloads.lightbend.com/scala/" |
49 | version "/scala-" version ".tgz")) |
50 | (sha256 |
51 | (base32 |
52 | "18w0vdbsp0q5rxglgalwlgkggld926bqi1fxc598rn4gh46a03j4")))) |
53 | (build-system trivial-build-system) |
54 | (arguments |
55 | `(#:modules ((guix build utils)) |
56 | #:builder (begin |
57 | (use-modules (guix build utils)) |
58 | (let* ((source (assoc-ref %build-inputs "source")) |
59 | (java (assoc-ref %build-inputs "icedtea-8")) |
60 | (bash (assoc-ref %build-inputs "bash")) |
61 | (tar (string-append |
62 | (assoc-ref %build-inputs "tar") |
63 | "/bin/tar")) |
64 | (gzip (assoc-ref %build-inputs "gzip")) |
65 | (output (assoc-ref %outputs "out")) |
66 | (bindir (string-append output "/bin"))) |
67 | (mkdir-p output) |
68 | (setenv "PATH" (string-append (getenv "PATH") ":" gzip "/bin")) |
69 | (invoke tar "xf" source) |
70 | (copy-recursively "scala-2.12.8" output) |
71 | (chdir output) |
72 | (for-each delete-file (find-files "bin" "bat$")) |
73 | (substitute* (find-files "bin" ".*") |
74 | (("^#!.*") |
75 | (string-append "#!" bash "/bin/bash\n" "JAVA_HOME=" java))))))) |
76 | (inputs |
77 | `(("bash" ,bash) |
78 | ("gzip" ,gzip) |
79 | ("icedtea-8" ,icedtea-8) |
80 | ("tar" ,tar))) |
81 | (home-page "https://scala-lang.org/") |
82 | (synopsis "") |
83 | (description "") |
84 | (license license:bsd-3))) |
85 | |
86 | ;; TODO: put it in guix/build/java-utils.scm |
87 | ;; TODO: remove contraband-* directories and regenerate them from contraband/ |
88 | (define* (sbt-building-phase subprojects #:optional (kind-projector? #f)) |
89 | `(lambda* (#:key inputs #:allow-other-keys) |
90 | (define (build-subproject prefix name) |
91 | (let ((build-directory (string-append "build/" name)) |
92 | (kind-projector (assoc-ref inputs "scala-kind-projector")) |
93 | (jar-name (string-append |
94 | (if (> (string-length prefix) 0) |
95 | (string-replace prefix "-" (- (string-length prefix) 1)) |
96 | "") |
97 | name ".jar")) |
98 | (java-files |
99 | (append |
100 | (find-files (string-append prefix name "/src/main/contraband-java") |
101 | ".*.java$") |
102 | (find-files (string-append prefix name "/src/main/java") |
103 | ".*.java$"))) |
104 | (scala-files |
105 | (append |
106 | (find-files (string-append prefix name "/src/main/contraband-scala") |
107 | ".*.scala$") |
108 | (find-files (string-append prefix name "/src/main/scala") |
109 | ".*.scala$")))) |
110 | (mkdir-p build-directory) |
111 | (format #t "Building project ~a...~%" jar-name) |
112 | (unless (eq? scala-files '()) |
113 | (apply invoke "scalac" "-classpath" |
114 | (string-append |
115 | (getenv "CLASSPATH") ":" |
116 | ;; Add any top-level directory in build that may contain |
117 | ;; .class files, but don't actually add build/ iteself or |
118 | ;; any individual class file. |
119 | (string-join |
120 | (filter (lambda (s) (eq? (string-count s #\/) 1)) |
121 | (find-files "build" "." #:directories? #t)) |
122 | ":")) |
123 | "-d" build-directory "-language:experimental.macros" |
124 | (if ,kind-projector? |
125 | (string-append "-Xplugin:" kind-projector |
126 | "/share/java/kind-projector.jar") |
127 | "") |
128 | (append scala-files java-files))) |
129 | (unless (eq? java-files '()) |
130 | (apply invoke "javac" "-classpath" |
131 | (string-append |
132 | (getenv "CLASSPATH") ":" |
133 | (string-join |
134 | (filter (lambda (s) (eq? (string-count s #\/) 1)) |
135 | (find-files "build" "." #:directories? #t)) |
136 | ":")) |
137 | "-d" build-directory java-files)) |
138 | (invoke "jar" "cf" (string-append "build/jar/" jar-name) |
139 | "-C" build-directory "."))) |
140 | (mkdir-p "build/jar") |
141 | (for-each (lambda (project) |
142 | (build-subproject (car project) (cadr project))) |
143 | '(,@subprojects)) |
144 | #t)) |
145 | |
146 | (define-public sbt-boilerplate-standalone |
147 | (package |
148 | (name "sbt-boilerplate-standalone") |
149 | (version "0.6.1") |
150 | (source (origin |
151 | (method url-fetch) |
152 | (uri (string-append "https://github.com/sbt/sbt-boilerplate/archive/v" |
153 | version ".tar.gz")) |
154 | (file-name (string-append name "-" version ".tar.gz")) |
155 | (sha256 |
156 | (base32 |
157 | "1xzh7qrsl2nmnbyzlmrshzfsf8b4qgf6yaqm1hn3qnzk6761p2jy")))) |
158 | (build-system ant-build-system) |
159 | (arguments |
160 | `(#:tests? #f |
161 | #:phases |
162 | (modify-phases %standard-phases |
163 | (add-before 'build 'add-standalone |
164 | (lambda _ |
165 | (substitute* "src/main/scala/spray/boilerplate/Generator.scala" |
166 | (("object Generator \\{") |
167 | "object Generator { |
168 | def main(args: Array[String]): Unit = { |
169 | val num = args(2).toInt |
170 | val file = scala.io.Source.fromFile(args(0)) |
171 | val content = file.mkString |
172 | val result = new java.io.PrintWriter(new java.io.File(args(1))) |
173 | |
174 | file.close |
175 | result.write(generateFromTemplate(content, num)) |
176 | result.close() |
177 | }")) |
178 | #t)) |
179 | (replace 'build |
180 | (lambda _ |
181 | (mkdir-p "build/classes") |
182 | (mkdir-p "build/jar") |
183 | (invoke "scalac" "-classpath" (getenv "CLASSPATH") |
184 | "-d" "build/classes" |
185 | "src/main/scala/spray/boilerplate/Generator.scala" |
186 | "src/main/scala/spray/boilerplate/TemplateParser.scala") |
187 | (invoke "jar" "-cf" "build/jar/boilerplate.jar" |
188 | "-C" "build/classes" ".") |
189 | #t)) |
190 | (replace 'install |
191 | (install-jars "build"))))) |
192 | (native-inputs |
193 | `(("scala" ,scala-official))) |
194 | (home-page "https://github.com/sbt/sbt-boilerplate") |
195 | (synopsis "") |
196 | (description "") |
197 | (license license:bsd-2))) |
198 | |
199 | (define-public scala-sjsonnew |
200 | (package |
201 | (name "scala-sjsonnew") |
202 | (version "0.8.2") |
203 | (source |
204 | (origin |
205 | (method url-fetch) |
206 | (uri (string-append "https://github.com/eed3si9n/sjson-new/archive/v" |
207 | version ".tar.gz")) |
208 | (file-name (string-append name "-" version ".tar.gz")) |
209 | (sha256 |
210 | (base32 |
211 | "1rv0c50af5kn27x51g650wl2ig94z52fhs0rn8ykahpz4jhg1p7p")))) |
212 | (arguments |
213 | `(#:tests? #f |
214 | #:phases |
215 | (modify-phases %standard-phases |
216 | (add-before 'build 'generate-boilerplate |
217 | (lambda _ |
218 | ; CaseClassFormats.scala.template FlatUnionFormats.scala.template TupleFormats.scala.template UnionFormats.scala.template |
219 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
220 | "core/src/main/boilerplate/sjsonnew/CaseClassFormats.scala.template" |
221 | "core/src/main/scala/sjsonnew/CaseClassFormats.scala" "22") |
222 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
223 | "core/src/main/boilerplate/sjsonnew/FlatUnionFormats.scala.template" |
224 | "core/src/main/scala/sjsonnew/FlatUnionFormats.scala" "22") |
225 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
226 | "core/src/main/boilerplate/sjsonnew/TupleFormats.scala.template" |
227 | "core/src/main/scala/sjsonnew/TupleFormats.scala" "22") |
228 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
229 | "core/src/main/boilerplate/sjsonnew/UnionFormats.scala.template" |
230 | "core/src/main/scala/sjsonnew/UnionFormats.scala" "22") |
231 | #t)) |
232 | (replace 'build |
233 | (lambda _ |
234 | (mkdir-p "build/classes") |
235 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
236 | "-d" "build/classes" |
237 | (find-files "core/src/main/scala" ".*.scala$")) |
238 | (mkdir-p "build/jar") |
239 | (invoke "jar" "-cf" "build/jar/sjsonnew.jar" |
240 | "-C" "build/classes" ".") |
241 | #t)) |
242 | (replace 'install |
243 | (install-jars "build"))))) |
244 | (build-system ant-build-system) |
245 | (native-inputs |
246 | `(("scala" ,scala-official) |
247 | ("sbt-boilerplate-standalone" ,sbt-boilerplate-standalone))) |
248 | (home-page "") |
249 | (synopsis "") |
250 | (description "") |
251 | (license license:asl2.0))) |
252 | |
253 | (define-public scala-scalajson |
254 | (package |
255 | (name "scala-scalajson") |
256 | (version "1.0.0-M4") |
257 | (source (origin |
258 | (method url-fetch) |
259 | (uri (string-append "https://github.com/mdedetrich/scalajson/archive/v" version ".tar.gz")) |
260 | (file-name (string-append name "-" version ".tar.gz")) |
261 | (sha256 |
262 | (base32 |
263 | "0k4dj2zm7zilhshdnvqi9n17qr4szc5s9ymsm9imgqpr8r5hm2vj")))) |
264 | (build-system ant-build-system) |
265 | (arguments |
266 | `(#:tests? #f |
267 | #:phases |
268 | (modify-phases %standard-phases |
269 | (replace 'build |
270 | (lambda _ |
271 | (mkdir-p "build/classes") |
272 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
273 | "-d" "build/classes" |
274 | (find-files "shared/src/main/scala" ".*.scala$")) |
275 | (mkdir-p "build/jar") |
276 | (invoke "jar" "-cf" "build/jar/scalajson-shared.jar" |
277 | "-C" "build/classes" ".") |
278 | (delete-file-recursively "build/classes") |
279 | (setenv "CLASSPATH" (string-append (getenv "CLASSPATH") ":build/jar/scalajson-shared.jar")) |
280 | (mkdir-p "build/classes") |
281 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
282 | "-d" "build/classes" |
283 | (find-files "jvm/src/main/scala" ".*.scala$")) |
284 | (mkdir-p "build/jar") |
285 | (invoke "jar" "-cf" "build/jar/scalajson-jvm.jar" |
286 | "-C" "build/classes" ".") |
287 | #t)) |
288 | (replace 'install |
289 | (install-jars "build"))))) |
290 | (native-inputs |
291 | `(("scala" ,scala-official))) |
292 | (home-page "") |
293 | (synopsis "") |
294 | (description "") |
295 | (license license:bsd-3))) |
296 | |
297 | ;; Latest is 0.13.0, but this version is required for scala-jsonnew |
298 | (define-public scala-jawn |
299 | (package |
300 | (name "scala-jawn") |
301 | (version "0.10.4") |
302 | (source (origin |
303 | (method url-fetch) |
304 | (uri (string-append "https://github.com/non/jawn/archive/v" |
305 | version ".tar.gz")) |
306 | (file-name (string-append name "-" version ".tar.gz")) |
307 | (sha256 |
308 | (base32 |
309 | "1iic1rp7w7vsy0xhi40rcp339vcq5b4b46f51qrkfpv433f7hafi")))) |
310 | (build-system ant-build-system) |
311 | (arguments |
312 | `(#:tests? #f |
313 | #:phases |
314 | (modify-phases %standard-phases |
315 | (replace 'build |
316 | (lambda _ |
317 | (mkdir-p "build/classes") |
318 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
319 | "-d" "build/classes" |
320 | (find-files "util/src/main/scala" ".*.scala$")) |
321 | (mkdir-p "build/jar") |
322 | (invoke "jar" "-cf" "build/jar/jawn-util.jar" |
323 | "-C" "build/classes" ".") |
324 | (delete-file-recursively "build/classes") |
325 | (setenv "CLASSPATH" (string-append (getenv "CLASSPATH") ":build/jar/scalajson-shared.jar")) |
326 | (mkdir-p "build/classes") |
327 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
328 | "-d" "build/classes" |
329 | (find-files "parser/src/main/scala" ".*.scala$")) |
330 | (mkdir-p "build/jar") |
331 | (invoke "jar" "-cf" "build/jar/jawn-parser.jar" |
332 | "-C" "build/classes" ".") |
333 | #t)) |
334 | (replace 'install |
335 | (install-jars "build"))))) |
336 | (native-inputs |
337 | `(("scala" ,scala-official))) |
338 | (home-page "") |
339 | (synopsis "") |
340 | (description "") |
341 | (license license:bsd-3))) |
342 | |
343 | (define-public scala-sjsonnew-support-scalajson |
344 | (package |
345 | (inherit scala-sjsonnew) |
346 | (name "scala-sjsonnew-support-scalajson") |
347 | (arguments |
348 | `(#:tests? #f |
349 | #:phases |
350 | (modify-phases %standard-phases |
351 | (replace 'build |
352 | (lambda _ |
353 | (substitute* (find-files "." ".*.scala") |
354 | (("shaded.scalajson") "scalajson")) |
355 | (mkdir-p "build/classes") |
356 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
357 | "-d" "build/classes" |
358 | (find-files "support/scalajson/src/main/scala" ".*.scala$")) |
359 | (mkdir-p "build/jar") |
360 | (invoke "jar" "-cf" "build/jar/sjsonnew-support-scalajson.jar" |
361 | "-C" "build/classes" ".") |
362 | #t)) |
363 | (replace 'install |
364 | (install-jars "build"))))) |
365 | (inputs |
366 | `(("scala-sjsonnew" ,scala-sjsonnew) |
367 | ("scala-scalajson" ,scala-scalajson) |
368 | ("scala-jawn" ,scala-jawn))))) |
369 | |
370 | (define-public scala-sjsonnew-support-murmurhash |
371 | (package |
372 | (inherit scala-sjsonnew) |
373 | (name "scala-sjsonnew-support-murmurhash") |
374 | (arguments |
375 | `(#:tests? #f |
376 | #:phases |
377 | (modify-phases %standard-phases |
378 | (replace 'build |
379 | (lambda _ |
380 | (mkdir-p "build/classes") |
381 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
382 | "-d" "build/classes" |
383 | (find-files "support/murmurhash/src/main/scala" ".*.scala$")) |
384 | (mkdir-p "build/jar") |
385 | (invoke "jar" "-cf" "build/jar/sjsonnew-support-murmurhash.jar" |
386 | "-C" "build/classes" ".") |
387 | #t)) |
388 | (replace 'install |
389 | (install-jars "build"))))) |
390 | (inputs |
391 | `(("scala-sjsonnew" ,scala-sjsonnew))))) |
392 | |
393 | (define-public scala-kind-projector |
394 | (package |
395 | (name "scala-kind-projector") |
396 | (version "0.9.9") |
397 | (source (origin |
398 | (method url-fetch) |
399 | (uri (string-append "https://github.com/non/kind-projector/archive/v" |
400 | version ".tar.gz")) |
401 | (file-name (string-append name "-" version ".tar.gz")) |
402 | (sha256 |
403 | (base32 |
404 | "125amrhy7ri0z4bk2jzghg7341fm88a0p6gw3qg5diminlpaida3")))) |
405 | (build-system ant-build-system) |
406 | (arguments |
407 | `(#:phases |
408 | (modify-phases %standard-phases |
409 | (replace 'build |
410 | (lambda _ |
411 | (mkdir-p "build/classes") |
412 | (mkdir-p "build/jar") |
413 | (copy-recursively "src/main/resources" "build/classes") |
414 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
415 | "-d" "build/classes" |
416 | (find-files "src/main/scala" ".*.scala$")) |
417 | (invoke "jar" "-cf" "build/jar/kind-projector.jar" |
418 | "-C" "build/classes" ".") |
419 | #t)) |
420 | (replace 'check |
421 | (lambda _ |
422 | (mkdir-p "build/test-classes") |
423 | (copy-recursively "src/test/resources" "build/test-classes") |
424 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
425 | "-Xplugin:build/jar/kind-projector.jar" |
426 | "-d" "build/test-classes" |
427 | (find-files "src/test/scala" ".*.scala$")) |
428 | ;; TODO: actually run the tests... :D |
429 | #t)) |
430 | (replace 'install |
431 | (install-jars "build"))))) |
432 | (native-inputs |
433 | `(("scala-official" ,scala-official) |
434 | ("java-junit" ,java-junit))) |
435 | (home-page "https://github.com/non/kind-projector") |
436 | (synopsis "Scala compiler plugin for type lambda") |
437 | (description "Kind projector is a Scala compiler plugin for making type |
438 | lambdas (type projections) easier to write.") |
439 | (license license:expat))) |
440 | |
441 | (define-public sbt-util |
442 | (package |
443 | (name "sbt-util") |
444 | (version "1.2.4") |
445 | (source |
446 | (origin |
447 | (method url-fetch) |
448 | (uri (string-append "https://github.com/sbt/util/archive/v" |
449 | version ".tar.gz")) |
450 | (file-name (string-append "sbt-util-" version ".tar.gz")) |
451 | (sha256 |
452 | (base32 |
453 | "04ss1q4rl272ryxys05zmd4j2gm3aanaiqn6dmqbh6jii934pyxg")))) |
454 | (build-system ant-build-system) |
455 | (arguments |
456 | `(#:tests? #f |
457 | #:phases |
458 | (modify-phases %standard-phases |
459 | (add-before 'build 'fix-sjsonnew |
460 | (lambda _ |
461 | (substitute* (find-files "." ".*.scala") |
462 | (("sjsonnew.shaded.") "")) |
463 | #t)) |
464 | (replace 'build |
465 | ,(sbt-building-phase |
466 | '(("internal/" "util-position") |
467 | ("internal/" "util-control") |
468 | ("internal/" "util-interface") |
469 | ("internal/" "util-logging") |
470 | ("internal/" "util-relation") |
471 | ("internal/" "util-scripted") |
472 | ("" "util-cache") |
473 | ("" "util-tracking")))) |
474 | (replace 'install |
475 | (install-jars "."))))) |
476 | (inputs |
477 | `(("java-log4j-api" ,java-log4j-api-for-sbt) |
478 | ("java-log4j-core" ,java-log4j-core-for-sbt) |
479 | ("sbt-io" ,sbt-io) |
480 | ("scala-jawn" ,scala-jawn) |
481 | ("scala-scalajson" ,scala-scalajson) |
482 | ("scala-sjsonnew" ,scala-sjsonnew) |
483 | ("scala-sjsonnew-support-murmurhash" ,scala-sjsonnew-support-murmurhash) |
484 | ("scala-sjsonnew-support-scalajson" ,scala-sjsonnew-support-scalajson))) |
485 | (native-inputs |
486 | `(("scala" ,scala-official))) |
487 | (home-page "https://www.scala-sbt.org/") |
488 | (synopsis "") |
489 | (description "") |
490 | (license license:bsd-3))) |
491 | |
492 | (define-public java-log4j-api-for-sbt |
493 | (package |
494 | (inherit java-log4j-api) |
495 | (version "2.8.1") |
496 | ;(version "2.11.1") |
497 | (arguments |
498 | (ensure-keyword-arguments (package-arguments java-log4j-api) |
499 | `(#:source-dir "src/main/java" |
500 | #:phases |
501 | (modify-phases %standard-phases |
502 | (add-after 'unpack 'chdir |
503 | (lambda _ |
504 | (chdir "log4j-api") |
505 | #t)) |
506 | (add-before 'build 'fix-ambiguous |
507 | (lambda _ |
508 | (substitute* "src/main/java/org/apache/logging/log4j/message/MapMessage.java" |
509 | (("append\\(data") "append((CharSequence)data")) |
510 | #t)))))) |
511 | (source (origin |
512 | (method url-fetch) |
513 | (uri (string-append "mirror://apache/logging/log4j/" version |
514 | "/apache-log4j-" version "-src.tar.gz")) |
515 | (sha256 |
516 | (base32 |
517 | "0x5gksgh0jkvd7k70rqrs2hy3glms0pkj6lhl26m6f83x1b6kvdm")))))) |
518 | ;"1dhxnd0348is21w93m1rv2sbfwyx83rv63adnbd0bgjq01gzbvic")))))) |
519 | |
520 | ;; More dependencies needed |
521 | (define-public java-log4j-core-for-sbt |
522 | (package |
523 | (inherit java-log4j-api-for-sbt) |
524 | (name "java-log4j-core") |
525 | (inputs |
526 | `(("java-osgi-core" ,java-osgi-core) |
527 | ("java-hamcrest-core" ,java-hamcrest-core) |
528 | ("java-log4j-api" ,java-log4j-api-for-sbt) |
529 | ("java-mail" ,java-mail) |
530 | ("java-jansi" ,java-jansi) |
531 | ("java-jboss-jms-api-spec" ,java-jboss-jms-api-spec) |
532 | ("java-jctools-core" ,java-jctools-core) |
533 | ("java-lmax-disruptor" ,java-lmax-disruptor) |
534 | ("java-kafka" ,java-kafka-clients) |
535 | ("java-datanucleus-javax-persistence" ,java-datanucleus-javax-persistence) |
536 | ("java-fasterxml-jackson-annotations" ,java-fasterxml-jackson-annotations) |
537 | ("java-fasterxml-jackson-core" ,java-fasterxml-jackson-core) |
538 | ("java-fasterxml-jackson-databind" ,java-fasterxml-jackson-databind) |
539 | ("java-fasterxml-jackson-dataformat-xml" ,java-fasterxml-jackson-dataformat-xml) |
540 | ("java-fasterxml-jackson-dataformat-yaml" ,java-fasterxml-jackson-dataformat-yaml) |
541 | ("java-commons-compress" ,java-commons-compress) |
542 | ("java-commons-csv" ,java-commons-csv) |
543 | ("java-conversantmedia-disruptor" ,java-conversantmedia-disruptor) |
544 | ("java-jcommander" ,java-jcommander) |
545 | ("java-stax2-api" ,java-stax2-api) |
546 | ("java-jeromq" ,java-jeromq) |
547 | ("java-junit" ,java-junit))) |
548 | (native-inputs |
549 | `(("hamcrest" ,java-hamcrest-all) |
550 | ("java-commons-io" ,java-commons-io) |
551 | ("java-commons-lang3" ,java-commons-lang3) |
552 | ("slf4j" ,java-slf4j-api))) |
553 | (arguments |
554 | `(#:tests? #f ; tests require more dependencies |
555 | #:test-dir "src/test" |
556 | #:source-dir "src/main/java" |
557 | #:jar-name "log4j-core.jar" |
558 | #:make-flags |
559 | (list (string-append "-Ddist.dir=" (assoc-ref %outputs "out") |
560 | "/share/java")) |
561 | #:phases |
562 | (modify-phases %standard-phases |
563 | (add-after 'unpack 'enter-dir |
564 | (lambda _ (chdir "log4j-core") #t)) |
565 | (add-before 'build 'fix-ambiguous |
566 | (lambda _ |
567 | (substitute* "src/main/java/org/apache/logging/log4j/core/pattern/MapPatternConverter.java" |
568 | (("append\\(sortedMap") "append((CharSequence)sortedMap")) |
569 | #t))))) |
570 | (synopsis "Core component of the Log4j framework") |
571 | (description "This package provides the core component of the Log4j |
572 | logging framework for Java."))) |
573 | |
574 | |
575 | ;; TODO: Update to 2.0.6? |
576 | (define-public java-swoval-apple-file-events |
577 | (package |
578 | (name "java-swoval-apple-file-events") |
579 | (version "1.3.2") |
580 | (source (origin |
581 | (method url-fetch) |
582 | (uri (string-append "https://github.com/swoval/swoval/archive/v" |
583 | version ".tar.gz")) |
584 | (file-name (string-append "scala-swoval-" version ".tar.gz")) |
585 | (sha256 |
586 | (base32 |
587 | "0ivrc4lcali84xp8frkjb2zi1l3lw8pim9xbkfah5iyj120gw6mq")))) |
588 | (build-system ant-build-system) |
589 | (arguments |
590 | `(#:tests? #f; no tests |
591 | #:jar-name "apple-file-events.jar" |
592 | #:source-dir "apple-file-events/jvm/src/main/java")) |
593 | (home-page "") |
594 | (synopsis "") |
595 | (description "") |
596 | (license license:expat))) |
597 | |
598 | (define-public sbt-io |
599 | (package |
600 | (name "sbt-io") |
601 | (version "1.2.2") |
602 | (source |
603 | (origin |
604 | (method url-fetch) |
605 | (uri (string-append "https://github.com/sbt/io/archive/v" |
606 | version ".tar.gz")) |
607 | (file-name (string-append name "-" version ".tar.gz")) |
608 | (sha256 |
609 | (base32 |
610 | "0f9yjrrcr15kx2fn7w8f8swpx2dsx5zn95yg744l9gi2ri2qpyj5")))) |
611 | (build-system ant-build-system) |
612 | (arguments |
613 | `(#:tests? #f |
614 | #:phases |
615 | (modify-phases %standard-phases |
616 | (replace 'build |
617 | (lambda* (#:key inputs #:allow-other-keys) |
618 | (mkdir-p "build/classes") |
619 | (apply invoke "scalac" "-classpath" |
620 | (string-append (getenv "CLASSPATH") ":build/util-interface") |
621 | "-d" "build/classes" |
622 | (append |
623 | (find-files "io/src/main/java" ".*.java$") |
624 | (find-files "io/src/main/scala" ".*.scala$") |
625 | (find-files "io/src/main/contraband-scala" ".*.scala$"))) |
626 | (invoke "jar" "cf" "sbt-io.jar" "-C" "build/classes" ".") |
627 | #t)) |
628 | (replace 'install |
629 | (install-jars "."))))) |
630 | (inputs |
631 | `(("java-native-access" ,java-native-access) |
632 | ("java-native-access-platform" ,java-native-access-platform) |
633 | ("java-swoval-apple-file-events" ,java-swoval-apple-file-events) |
634 | ("scala" ,scala-official))) |
635 | (home-page "https://www.scala-sbt.org/") |
636 | (synopsis "") |
637 | (description "") |
638 | (license license:bsd-3))) |
639 | |
640 | (define-public scala-ssl-config |
641 | (package |
642 | (name "scala-ssl-config") |
643 | (version "0.3.7") |
644 | (source (origin |
645 | (method url-fetch) |
646 | (uri (string-append "https://github.com/lightbend/ssl-config/archive/v" |
647 | version ".tar.gz")) |
648 | (file-name (string-append name "-" version ".tar.gz")) |
649 | (sha256 |
650 | (base32 |
651 | "0sg477705flhcdnhjyl8v9jkhx1xfsnc73md8iva1agylpj5546f")))) |
652 | (build-system ant-build-system) |
653 | (arguments |
654 | `(#:tests? #f |
655 | #:phases |
656 | (modify-phases %standard-phases |
657 | (replace 'build |
658 | (lambda* (#:key inputs #:allow-other-keys) |
659 | (mkdir-p "build/classes") |
660 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
661 | "-d" "build/classes" |
662 | (find-files "ssl-config-core/src/main/scala" ".*.scala$")) |
663 | (invoke "jar" "cf" "okhttp.jar" "-C" "build/classes" ".") |
664 | #t)) |
665 | (replace 'install |
666 | (install-jars "."))))) |
667 | (inputs |
668 | `(("java-config" ,java-config))) |
669 | (native-inputs |
670 | `(("scala" ,scala-official))) |
671 | (home-page "") |
672 | (synopsis "") |
673 | (description "") |
674 | (license license:asl2.0))) |
675 | |
676 | (define-public scala-okhttp |
677 | (package |
678 | (name "scala-okhttp") |
679 | (version "0.3.1") |
680 | (source (origin |
681 | (method url-fetch) |
682 | (uri (string-append "https://github.com/eed3si9n/gigahorse/archive/v" |
683 | version ".tar.gz")) |
684 | (file-name (string-append name "-" version ".tar.gz")) |
685 | (sha256 |
686 | (base32 |
687 | "06ac03vr0cyr63zw0ibdwmswa03crm6i8mb00y69zpkm2jxqq2mb")))) |
688 | (build-system ant-build-system) |
689 | (arguments |
690 | `(#:tests? #f |
691 | #:phases |
692 | (modify-phases %standard-phases |
693 | (replace 'build |
694 | (lambda* (#:key inputs #:allow-other-keys) |
695 | (mkdir-p "build/classes") |
696 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
697 | "-d" "build/classes" |
698 | (append |
699 | (find-files "core/src/main/scala" ".*.scala$") |
700 | (find-files "okhttp/src/main/scala" ".*.scala$") |
701 | (find-files "core/src/main/contraband-scala" ".*.scala$"))) |
702 | (invoke "jar" "cf" "okhttp.jar" "-C" "build/classes" ".") |
703 | #t)) |
704 | (replace 'install |
705 | (install-jars "."))))) |
706 | (inputs |
707 | `(("java-config" ,java-config) |
708 | ("java-reactive-streams" ,java-reactive-streams) |
709 | ("java-slf4j-api" ,java-slf4j-api) |
710 | ("java-okhttp" ,java-okhttp) |
711 | ("java-okio" ,java-okio) |
712 | ("scala-ssl-config" ,scala-ssl-config))) |
713 | (native-inputs |
714 | `(("scala" ,scala-official))) |
715 | (home-page "") |
716 | (synopsis "") |
717 | (description "") |
718 | (license license:asl2.0))) |
719 | |
720 | (define-public sbt-launcher |
721 | (package |
722 | (name "sbt-launcher") |
723 | (version "1.0.4") |
724 | (source (origin |
725 | (method url-fetch) |
726 | (uri (string-append "https://github.com/sbt/launcher/archive/v" version ".tar.gz")) |
727 | (file-name (string-append name "-" version ".tar.gz")) |
728 | (sha256 |
729 | (base32 |
730 | "1a9dfqm47fn2nbqvjl723s0h16jf71cgnilg1i7gz6h4a7i0snak")))) |
731 | (build-system ant-build-system) |
732 | (arguments |
733 | `(#:tests? #f |
734 | #:phases |
735 | (modify-phases %standard-phases |
736 | (replace 'build |
737 | (lambda* (#:key inputs #:allow-other-keys) |
738 | (define (split n str) |
739 | (if (<= (string-length str) n) |
740 | (list str) |
741 | (cons (substring str 0 n) (split n (substring str n))))) |
742 | (substitute* "launcher-implementation/src/main/input_sources/CrossVersionUtil.scala" |
743 | (("\\$\\{\\{cross.package0\\}\\}") "xsbt") |
744 | (("\\$\\{\\{cross.package1\\}\\}") "boot")) |
745 | (mkdir-p "build/classes") |
746 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
747 | "-d" "build/classes" |
748 | (append |
749 | (find-files "launcher-interface/src/main/java" ".*.java$") |
750 | (find-files "launcher-implementation/src/main/input_sources" ".*.scala$") |
751 | (find-files "launcher-implementation/src/main/scala" ".*.scala$"))) |
752 | (apply invoke "javac" "-cp" (string-append (getenv "CLASSPATH") ":build/classes") |
753 | "-d" "build/classes" |
754 | (find-files "launcher-interface/src/main/java" ".*.java$")) |
755 | (mkdir-p "build/classes/META-INF") |
756 | (with-output-to-file "build/classes/META-INF/MANIFEST.MF" |
757 | (lambda _ |
758 | (format #t "Manifest-Version: 1.0\n") |
759 | (format #t "Class-Path: ~a\n" |
760 | (string-join |
761 | (split |
762 | 58 |
763 | (string-join |
764 | (map |
765 | (lambda (jar) |
766 | ;; We can't use absolute paths with java 8 :/ |
767 | (string-append "../../../../../../../../.." jar)) |
768 | (string-split (getenv "CLASSPATH") #\:)) |
769 | " ")) |
770 | "\n ")) |
771 | (format #t "Main-Class: xsbt.boot.Boot\n\n"))) |
772 | (invoke "jar" "cfm" "sbt-launcher.jar" "build/classes/META-INF/MANIFEST.MF" |
773 | "-C" "build/classes" ".") |
774 | #t)) |
775 | (replace 'install |
776 | (install-jars "."))))) |
777 | (inputs |
778 | `(("java-apache-ivy" ,java-apache-ivy))) |
779 | (native-inputs |
780 | `(("scala" ,scala-official))) |
781 | (home-page "") |
782 | (synopsis "") |
783 | (description "") |
784 | (license license:bsd-3))) |
785 | |
786 | (define-public sbt-librarymanagement |
787 | (package |
788 | (name "sbt-librarymanagement") |
789 | (version "1.2.4") |
790 | (source (origin |
791 | (method url-fetch) |
792 | (uri (string-append "https://github.com/sbt/librarymanagement/archive/v" version ".tar.gz")) |
793 | (file-name (string-append name "-" version ".tar.gz")) |
794 | (sha256 |
795 | (base32 |
796 | "0g37agv3xkq1fjl9a25ybcdk4d5aq1m81rz5d2a8zvny135m73gl")) |
797 | (modules '((guix build utils))) |
798 | (snippet |
799 | `(begin |
800 | (for-each delete-file (find-files "." ".*.jar")) |
801 | #t)))) |
802 | (build-system ant-build-system) |
803 | (arguments |
804 | `(#:tests? #f |
805 | #:phases |
806 | (modify-phases %standard-phases |
807 | (add-before 'build 'fix-sjsonnew |
808 | (lambda _ |
809 | (substitute* (find-files "." ".*.scala") |
810 | (("sjsonnew.shaded.") "")) |
811 | #t)) |
812 | (replace 'build |
813 | ,(sbt-building-phase |
814 | `(("" "core") |
815 | ("" "ivy")))) |
816 | (replace 'install |
817 | (install-jars "."))))) |
818 | (inputs |
819 | `(("java-apache-ivy" ,java-apache-ivy) |
820 | ("java-okhttp" ,java-okhttp) |
821 | ("java-okhttp-urlconnection" ,java-okhttp-urlconnection) |
822 | ("java-okio" ,java-okio) |
823 | ("sbt-launcher" ,sbt-launcher) |
824 | ("sbt-util" ,sbt-util) |
825 | ("sbt-io" ,sbt-io) |
826 | ("scala-jawn" ,scala-jawn) |
827 | ("scala-okhttp" ,scala-okhttp) |
828 | ("scala-scalajson" ,scala-scalajson) |
829 | ("scala-sjsonnew" ,scala-sjsonnew) |
830 | ("scala-sjsonnew-support-murmurhash" ,scala-sjsonnew-support-murmurhash) |
831 | ("scala-sjsonnew-support-scalajson" ,scala-sjsonnew-support-scalajson))) |
832 | (native-inputs |
833 | `(("scala" ,scala-official))) |
834 | (home-page "") |
835 | (synopsis "") |
836 | (description "") |
837 | ;; From core/NOTICE |
838 | ;; XXX: WARNING: no license in ivy/ |
839 | (license license:bsd-2))) |
840 | |
841 | ;; LICENSE? |
842 | (define-public scala-protoc-bridge |
843 | (package |
844 | (name "scala-protoc-bridge") |
845 | (version "0.7.3") |
846 | (source |
847 | (origin |
848 | (method url-fetch) |
849 | (uri (string-append "https://github.com/scalapb/protoc-bridge/archive/v" |
850 | version ".tar.gz")) |
851 | (file-name (string-append name "-" version ".tar.gz")) |
852 | (sha256 |
853 | (base32 |
854 | "17xjsa70h0w80rhps00kj42fmghk98c789aaa19g4bii2j1ckry8")))) |
855 | (build-system ant-build-system) |
856 | (arguments |
857 | `(#:phases |
858 | (modify-phases %standard-phases |
859 | (add-before 'build 'fix-script |
860 | (lambda _ |
861 | (substitute* "src/main/scala/protocbridge/frontend/PosixPluginFrontend.scala" |
862 | (("/usr/bin/env sh") (which "sh"))) |
863 | #t)) |
864 | (replace 'build |
865 | (lambda _ |
866 | (mkdir-p "build/classes") |
867 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
868 | "-d" "build/classes" |
869 | (append |
870 | (find-files "src/main/scala" ".*.scala$") |
871 | (find-files "src/main/java" ".*.java$"))) |
872 | (apply invoke "javac" "-cp" (string-append (getenv "CLASSPATH") ":build/classes") |
873 | "-d" "build/classes" |
874 | (find-files "src/main/java" ".*.java$")) |
875 | (mkdir-p "build/jar") |
876 | (invoke "jar" "-cf" "build/jar/protoc-bridge.jar" |
877 | "-C" "build/classes" ".") |
878 | #t)) |
879 | (replace 'check |
880 | (lambda _ |
881 | (mkdir-p "build/test-classes") |
882 | ;(apply invoke "scalac" "-classpath" (string-append (getenv "CLASSPATH") |
883 | ; ":build/classes") |
884 | ; "-d" "build/test-classes" |
885 | ; (find-files "src/test/scala" ".*.scala$")) |
886 | ;; TODO: actually run the tests |
887 | #t)) |
888 | (replace 'install |
889 | (install-jars "build"))))) |
890 | (native-inputs |
891 | `(("scala" ,scala-official))) |
892 | (home-page "") |
893 | (synopsis "") |
894 | (description "") |
895 | (license license:bsd-3))) |
896 | |
897 | (define-public scala-sourcecode |
898 | (package |
899 | (name "scala-sourcecode") |
900 | (version "0.1.5") |
901 | (source (origin |
902 | (method url-fetch) |
903 | (uri (string-append "https://github.com/lihaoyi/sourcecode/archive/v" |
904 | version ".tar.gz")) |
905 | (file-name (string-append name "-" version ".tar.gz")) |
906 | (sha256 |
907 | (base32 |
908 | "1cq15cxsv0j6xdrl566ywmab5il3239ja4cbgm39ihyn0yw2q1q4")))) |
909 | (build-system ant-build-system) |
910 | (arguments |
911 | `(#:tests? #f; in sourcecode/shared/src/test |
912 | #:phases |
913 | (modify-phases %standard-phases |
914 | (add-before 'build 'copy-compat |
915 | (lambda _ |
916 | (with-directory-excursion "sourcecode/shared/src/main" |
917 | (copy-file "scala-2.11/sourcecode/Compat.scala" |
918 | "scala/sourcecode/Compat.scala")) |
919 | #t)) |
920 | (replace 'build |
921 | (lambda _ |
922 | (mkdir-p "build/classes") |
923 | (mkdir-p "build/jar") |
924 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
925 | "-d" "build/classes" |
926 | (find-files "sourcecode/shared/src/main/scala" ".*.scala$")) |
927 | (invoke "jar" "cf" "build/jar/sourcecode.jar" "-C" "build/classes" ".") |
928 | #t)) |
929 | (replace 'install |
930 | (install-jars "build"))))) |
931 | (native-inputs |
932 | `(("scala" ,scala-official))) |
933 | (home-page "") |
934 | (synopsis "") |
935 | (description "") |
936 | (license license:expat))) |
937 | |
938 | (define-public scala-acyclic |
939 | (package |
940 | (name "scala-acyclic") |
941 | (version "0.1.8") |
942 | (source (origin |
943 | (method url-fetch) |
944 | (uri (string-append "https://github.com/lihaoyi/acyclic/archive/v" |
945 | version ".tar.gz")) |
946 | (file-name (string-append name "-" version ".tar.gz")) |
947 | (sha256 |
948 | (base32 |
949 | "0c26qnjfhihn06sf17bxskacjcr51s03ygcmj8fp5vdzgcyfh7dl")))) |
950 | (build-system ant-build-system) |
951 | (arguments |
952 | `(#:tests? #f; in sourcecode/shared/src/test |
953 | #:phases |
954 | (modify-phases %standard-phases |
955 | (add-before 'build 'copy-compat |
956 | (lambda _ |
957 | (with-directory-excursion "src/main" |
958 | (copy-file "scala-2.10_2.12/acyclic/plugin/Compat.scala" |
959 | "scala/acyclic/plugin/Compat.scala")) |
960 | #t)) |
961 | (replace 'build |
962 | (lambda _ |
963 | (mkdir-p "build/classes") |
964 | (mkdir-p "build/jar") |
965 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
966 | "-d" "build/classes" |
967 | (find-files "src/main/scala" ".*.scala$")) |
968 | (copy-recursively "src/main/resources" "build/classes") |
969 | (invoke "jar" "cf" "build/jar/acyclic.jar" "-C" "build/classes" ".") |
970 | #t)) |
971 | (replace 'install |
972 | (install-jars "build"))))) |
973 | (native-inputs |
974 | `(("scala" ,scala-official))) |
975 | (home-page "") |
976 | (synopsis "") |
977 | (description "") |
978 | (license license:expat))) |
979 | |
980 | (define-public scala-fastparse |
981 | (package |
982 | (name "scala-fastparse") |
983 | (version "2.1.0") |
984 | (source (origin |
985 | (method url-fetch) |
986 | (uri (string-append "https://github.com/lihaoyi/fastparse/archive/" |
987 | version ".tar.gz")) |
988 | (file-name (string-append name "-" version ".tar.gz")) |
989 | (sha256 |
990 | (base32 |
991 | "1h8s3izykv3x2g7klihk03mbnjcp23f2613827y62kdk6x9q6yjs")))) |
992 | (build-system ant-build-system) |
993 | (arguments |
994 | `(#:tests? #f; in fastpares/test/src |
995 | #:modules |
996 | ((guix build ant-build-system) |
997 | (guix build java-utils) |
998 | (guix build utils) |
999 | (srfi srfi-1)) |
1000 | #:imported-modules |
1001 | ((srfi srfi-1) ; for iota |
1002 | ,@%ant-build-system-modules) |
1003 | #:phases |
1004 | (modify-phases %standard-phases |
1005 | (add-before 'build 'generate-sources |
1006 | (lambda _ |
1007 | (define (tuple num) |
1008 | (let* ((ts (map (lambda (n) (string-append "T" (number->string n))) |
1009 | (iota num 1))) |
1010 | (chunks (map (lambda (n) |
1011 | (string-append "t._" (number->string n))) |
1012 | (iota num 1))) |
1013 | (chunkss (string-join chunks ", ")) |
1014 | (tsD (string-join (reverse (cons "D" (reverse ts))) ",")) |
1015 | (anys (string-join (map (const "Any") ts) ", ")) |
1016 | (tss (string-join ts ", "))) |
1017 | (format #t " |
1018 | val BaseSequencer~a: Sequencer[(~a), Any, (~a, Any)] = |
1019 | Sequencer0((t, d) => (~a, d)) |
1020 | implicit def Sequencer~a[~a]: Sequencer[(~a), D, (~a)] = |
1021 | BaseSequencer~a.asInstanceOf[Sequencer[(~a), D, (~a)]] |
1022 | " num anys anys chunkss num tsD tss tsD num tss tsD))) |
1023 | (with-output-to-file "fastparse/src/fastparse/SequencerGen.scala" |
1024 | (lambda _ |
1025 | (format #t "package fastparse |
1026 | trait SequencerGen[Sequencer[_, _, _]] extends LowestPriSequencer[Sequencer]{ |
1027 | protected[this] def Sequencer0[A, B, C](f: (A, B) => C): Sequencer[A, B, C] |
1028 | ") |
1029 | (for-each tuple (iota 20 2)) |
1030 | (format #t "} |
1031 | trait LowestPriSequencer[Sequencer[_, _, _]]{ |
1032 | protected[this] def Sequencer0[A, B, C](f: (A, B) => C): Sequencer[A, B, C] |
1033 | implicit def Sequencer1[T1, T2]: Sequencer[T1, T2, (T1, T2)] = Sequencer0{case (t1, t2) => (t1, t2)} |
1034 | } |
1035 | "))) |
1036 | #t)) |
1037 | (replace 'build |
1038 | (lambda _ |
1039 | (mkdir-p "build/classes") |
1040 | (mkdir-p "build/jar") |
1041 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
1042 | "-d" "build/classes" |
1043 | (find-files "fastparse/src" ".*.scala$")) |
1044 | (invoke "jar" "cf" "build/jar/fastparse.jar" "-C" "build/classes" ".") |
1045 | #t)) |
1046 | (replace 'install |
1047 | (install-jars "build"))))) |
1048 | (inputs |
1049 | `(("scala-sourcecode" ,scala-sourcecode))) |
1050 | (native-inputs |
1051 | `(("scala" ,scala-official))) |
1052 | (home-page "") |
1053 | (synopsis "") |
1054 | (description "") |
1055 | (license license:expat))) |
1056 | |
1057 | (define scala-fastparse1 |
1058 | (package |
1059 | (inherit scala-fastparse) |
1060 | (version "1.0.0") |
1061 | (source (origin |
1062 | (method url-fetch) |
1063 | (uri (string-append "https://github.com/lihaoyi/fastparse/archive/" |
1064 | version ".tar.gz")) |
1065 | (file-name (string-append "scala-fastparse-" version ".tar.gz")) |
1066 | (sha256 |
1067 | (base32 |
1068 | "14d44f23hl6ypfwlvnzkzcvv52a0xipm5wkp2glr184aik7w5pnb")))) |
1069 | (arguments |
1070 | `(#:tests? #f; in fastpares/test/src |
1071 | #:modules |
1072 | ((guix build ant-build-system) |
1073 | (guix build java-utils) |
1074 | (guix build utils) |
1075 | (srfi srfi-1)) |
1076 | #:imported-modules |
1077 | ((srfi srfi-1) ; for iota |
1078 | ,@%ant-build-system-modules) |
1079 | #:phases |
1080 | (modify-phases %standard-phases |
1081 | (add-before 'build 'copy-compat |
1082 | (lambda _ |
1083 | (with-directory-excursion "utils/shared/src/main" |
1084 | (copy-file "scala-2.11/fastparse/utils/Compat.scala" |
1085 | "scala/fastparse/utils/Compat.scala")) |
1086 | #t)) |
1087 | (add-before 'build 'generate-sources |
1088 | (lambda _ |
1089 | (define (tuple num) |
1090 | (let* ((ts (map (lambda (n) (string-append "T" (number->string n))) |
1091 | (iota num 1))) |
1092 | (chunks (map (lambda (n) |
1093 | (string-append "t._" (number->string n))) |
1094 | (iota num 1))) |
1095 | (chunkss (string-join chunks ", ")) |
1096 | (tsD (string-join (reverse (cons "D" (reverse ts))) ",")) |
1097 | (anys (string-join (map (const "Any") ts) ", ")) |
1098 | (tss (string-join ts ", "))) |
1099 | (format #t " |
1100 | val BaseSequencer~a: Sequencer[(~a), Any, (~a, Any)] = |
1101 | Sequencer0((t, d) => (~a, d)) |
1102 | implicit def Sequencer~a[~a]: Sequencer[(~a), D, (~a)] = |
1103 | BaseSequencer~a.asInstanceOf[Sequencer[(~a), D, (~a)]] |
1104 | " num anys anys chunkss num tsD tss tsD num tss tsD))) |
1105 | (with-output-to-file |
1106 | "fastparse/shared/src/main/scala/fastparse/core/SequencerGen.scala" |
1107 | (lambda _ |
1108 | (format #t "package fastparse.core |
1109 | trait SequencerGen[Sequencer[_, _, _]] extends LowestPriSequencer[Sequencer]{ |
1110 | protected[this] def Sequencer0[A, B, C](f: (A, B) => C): Sequencer[A, B, C] |
1111 | ") |
1112 | (for-each tuple (iota 20 2)) |
1113 | (format #t "} |
1114 | trait LowestPriSequencer[Sequencer[_, _, _]]{ |
1115 | protected[this] def Sequencer0[A, B, C](f: (A, B) => C): Sequencer[A, B, C] |
1116 | implicit def Sequencer1[T1, T2]: Sequencer[T1, T2, (T1, T2)] = Sequencer0{case (t1, t2) => (t1, t2)} |
1117 | } |
1118 | "))) |
1119 | #t)) |
1120 | (replace 'build |
1121 | (lambda _ |
1122 | (mkdir-p "build/classes") |
1123 | (mkdir-p "build/jar") |
1124 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
1125 | "-d" "build/classes" |
1126 | (find-files "utils/shared/src/main/scala" ".*.scala$")) |
1127 | (apply invoke "scalac" "-classpath" |
1128 | (string-append (getenv "CLASSPATH") ":build/classes") |
1129 | "-d" "build/classes" |
1130 | (find-files "fastparse/shared/src/main/scala" ".*.scala$")) |
1131 | (invoke "jar" "cf" "build/jar/fastparse.jar" "-C" "build/classes" ".") |
1132 | #t)) |
1133 | (replace 'install |
1134 | (install-jars "build"))))) |
1135 | (inputs |
1136 | `(("scala-acyclic" ,scala-acyclic) |
1137 | ("scala-sourcecode" ,scala-sourcecode))))) |
1138 | |
1139 | ;; LICENSE? |
1140 | (define-public scala-protobuf |
1141 | (package |
1142 | (name "scala-protobuf") |
1143 | (version "0.8.3") |
1144 | (source (origin |
1145 | (method url-fetch) |
1146 | (uri (string-append "https://github.com/scalapb/ScalaPB/archive/v" |
1147 | version ".tar.gz")) |
1148 | (file-name (string-append name "-" version ".tar.gz")) |
1149 | (sha256 |
1150 | (base32 |
1151 | "0x6mfpyhzxh54dxh1pj3x952gyvp05m7vkj0c3p8ssx214r327kj")) |
1152 | (modules '((guix build utils))) |
1153 | (snippet |
1154 | `(delete-file-recursively "third_party")))) |
1155 | (build-system ant-build-system) |
1156 | (arguments |
1157 | `(#:tests? #f; TODO |
1158 | #:phases |
1159 | (modify-phases %standard-phases |
1160 | (add-before 'build 'generate-sources |
1161 | (lambda _ |
1162 | (with-output-to-file "compiler-plugin/src/main/scala/scalapb/compiler/Version.scala" |
1163 | (lambda _ |
1164 | (format #t "package scalapb.compiler |
1165 | object Version { |
1166 | val scalapbVersion = \"~a\" |
1167 | val protobufVersion = \"~a\" |
1168 | val grpcJavaVersion = \"~a\" |
1169 | }" ,version ,(package-version protobuf) "TODO"))) |
1170 | (mkdir-p "compiler-plugin/src/main/scala/scalapb/compiler/internal") |
1171 | (copy-file |
1172 | "scalapb-runtime/shared/src/main/scala/scalapb/Encoding.scala" |
1173 | "compiler-plugin/src/main/scala/scalapb/compiler/internal/Encoding.scala") |
1174 | (substitute* "compiler-plugin/src/main/scala/scalapb/compiler/internal/Encoding.scala" |
1175 | (("package scalapb") "package scalapb.internal")) |
1176 | #t)) |
1177 | (add-before 'build 'merge-runtime |
1178 | (lambda _ |
1179 | (copy-recursively "scalapb-runtime/shared/src" "scalapb-runtime/src") |
1180 | (copy-recursively "scalapb-runtime/jvm/src" "scalapb-runtime/src") |
1181 | #t)) |
1182 | (add-before 'build 'copy-compat |
1183 | (lambda _ |
1184 | (with-directory-excursion "scalapb-runtime/src/main" |
1185 | (copy-file "scala-2.11/scalapb/textformat/ParserCompat.scala" |
1186 | "scala/scalapb/textformat/ParserCompat.scala")) |
1187 | #t)) |
1188 | (replace 'build |
1189 | ,(sbt-building-phase |
1190 | '(("lenses/" "shared") |
1191 | ("" "scalapb-runtime") |
1192 | ("" "compiler-plugin") |
1193 | ("" "scalapbc")))) |
1194 | (replace 'install |
1195 | (install-jars "build")) |
1196 | (add-after 'install 'install-bin |
1197 | (lambda* (#:key inputs outputs #:allow-other-keys) |
1198 | (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) |
1199 | (mkdir-p bin) |
1200 | (with-output-to-file (string-append bin "/scalapbc") |
1201 | (lambda _ |
1202 | (format #t "#!~a |
1203 | java -cp ~a scalapb.ScalaPBC $@\n" (which "bash") |
1204 | (string-join |
1205 | (append |
1206 | (find-files (assoc-ref outputs "out") ".*.jar") |
1207 | (find-files (assoc-ref inputs "java-protobuf") ".*.jar") |
1208 | (find-files (assoc-ref inputs "java-protoc-jar") ".*.jar") |
1209 | (find-files (assoc-ref inputs "scala-fastparse1") ".*.jar") |
1210 | (find-files (assoc-ref inputs "scala-protoc-bridge") ".*.jar") |
1211 | (find-files (assoc-ref inputs "scala-sourcecode") ".*.jar") |
1212 | (find-files (assoc-ref inputs "scala") ".*.jar")) |
1213 | ":")))) |
1214 | (chmod (string-append bin "/scalapbc") #o755)) |
1215 | #t))))) |
1216 | (inputs |
1217 | `(("java-protobuf" ,java-protobuf) |
1218 | ("java-protoc-jar" ,java-protoc-jar) |
1219 | ("scala-fastparse1" ,scala-fastparse1) |
1220 | ("scala-protoc-bridge" ,scala-protoc-bridge) |
1221 | ("scala-sourcecode" ,scala-sourcecode))) |
1222 | (native-inputs |
1223 | `(("protobuf" ,protobuf) |
1224 | ("scala" ,scala-official))) |
1225 | (home-page "") |
1226 | (synopsis "") |
1227 | (description "") |
1228 | (license license:bsd-3))) |
1229 | |
1230 | (define-public sbt-sbinary |
1231 | (package |
1232 | (name "sbt-sbinary") |
1233 | (version "0.5.0") |
1234 | (source |
1235 | (origin |
1236 | (method url-fetch) |
1237 | (uri (string-append "https://github.com/sbt/sbinary/archive/v" |
1238 | version ".tar.gz")) |
1239 | (file-name (string-append "sbt-util-" version ".tar.gz")) |
1240 | (sha256 |
1241 | (base32 |
1242 | "12mcny4flfc6zbgncjwqljrsg6qw7azagkackyqcp4gmv9ssw99f")))) |
1243 | (build-system ant-build-system) |
1244 | (arguments |
1245 | `(#:tests? #f |
1246 | #:phases |
1247 | (modify-phases %standard-phases |
1248 | (add-before 'build 'generate-fmpp |
1249 | (lambda _ |
1250 | (invoke "fmpp" "-U" "all" "-S" "core/src/main/fmpp" "-O" |
1251 | "core/src/main/scala") |
1252 | #t)) |
1253 | (replace 'build |
1254 | (lambda* (#:key inputs #:allow-other-keys) |
1255 | (mkdir-p "build/classes") |
1256 | (apply invoke "scalac" "-classpath" |
1257 | (string-append (getenv "CLASSPATH") ":build/util-interface") |
1258 | "-d" "build/classes" |
1259 | (append |
1260 | (find-files "core/src/main/scala-2.13-" ".*.scala$") |
1261 | (find-files "core/src/main/scala" ".*.scala$"))) |
1262 | (invoke "jar" "cf" "sbt-sbinary.jar" "-C" "build/classes" ".") |
1263 | #t)) |
1264 | (replace 'install |
1265 | (install-jars "."))))) |
1266 | (native-inputs |
1267 | `(("java-fmpp" ,java-fmpp) |
1268 | ("scala" ,scala-official))) |
1269 | (home-page "https://www.scala-sbt.org/") |
1270 | (synopsis "") |
1271 | (description "") |
1272 | (license license:bsd-3))) |
1273 | |
1274 | (define-public sbt-zinc |
1275 | (package |
1276 | (name "sbt-zinc") |
1277 | (version "1.2.5") |
1278 | (source |
1279 | (origin |
1280 | (method url-fetch) |
1281 | (uri (string-append "https://github.com/sbt/zinc/archive/v" |
1282 | version ".tar.gz")) |
1283 | (file-name (string-append name "-" version ".tar.gz")) |
1284 | (sha256 |
1285 | (base32 |
1286 | "1b01nv3dk3g7jx59jnzp2m2va5brhmds4bpgp824fnmp2fdjzgl0")))) |
1287 | (build-system ant-build-system) |
1288 | (arguments |
1289 | `(#:tests? #f |
1290 | #:phases |
1291 | (modify-phases %standard-phases |
1292 | (add-before 'build 'generate-protobuf |
1293 | (lambda _ |
1294 | (invoke "scalapbc" |
1295 | (string-append |
1296 | "-v" |
1297 | (string-delete #\. ,(package-version protobuf))) |
1298 | "--scala_out=internal/zinc-persist/src/main/scala" |
1299 | "internal/zinc-persist/src/main/protobuf/schema.proto") |
1300 | #t)) |
1301 | (add-before 'build 'use-correct-class |
1302 | (lambda _ |
1303 | ;; Because of our way of compiling, some classes are present |
1304 | ;; in excess in the classpath, and sometimes are imported |
1305 | ;; instead of the correct one. e.g. is AnalysisCallback imported |
1306 | ;; as xsbti.AnalysisCallback and inc.AnalysisCallback |
1307 | (with-directory-excursion "internal/zinc-compile-core/src/main/scala" |
1308 | (substitute* "sbt/internal/inc/AnalyzingCompiler.scala" |
1309 | ((": AnalysisCallback") ": xsbti.AnalysisCallback"))) |
1310 | #t)) |
1311 | (replace 'build |
1312 | ,(sbt-building-phase |
1313 | '(("internal/" "compiler-interface") |
1314 | ("internal/" "zinc-classpath") |
1315 | ("internal/" "zinc-classfile") |
1316 | ("internal/" "zinc-apiinfo") |
1317 | ("internal/" "zinc-core") |
1318 | ("internal/" "zinc-persist") |
1319 | ("internal/" "zinc-compile-core") |
1320 | ("internal/" "zinc-ivy-integration") |
1321 | ("" "zinc-compile") |
1322 | ("" "zinc")))) |
1323 | (replace 'install |
1324 | (install-jars "."))))) |
1325 | (inputs |
1326 | `(("java-log4j-api" ,java-log4j-api-for-sbt) |
1327 | ("java-log4j-core" ,java-log4j-core-for-sbt) |
1328 | ("java-protobuf" ,java-protobuf) |
1329 | ("sbt-io" ,sbt-io) |
1330 | ("sbt-launcher" ,sbt-launcher) |
1331 | ("sbt-librarymanagement" ,sbt-librarymanagement) |
1332 | ("sbt-sbinary" ,sbt-sbinary) |
1333 | ("sbt-util" ,sbt-util) |
1334 | ("scala-protoc-bridge" ,scala-protoc-bridge) |
1335 | ("scala-sjsonnew" ,scala-sjsonnew))) |
1336 | (native-inputs |
1337 | `(("scala-protobuf" ,scala-protobuf) |
1338 | ("scala" ,scala-official))) |
1339 | (home-page "") |
1340 | (synopsis "") |
1341 | (description "") |
1342 | (license license:bsd-3))) |
1343 | |
1344 | (define-public scala-cache |
1345 | (package |
1346 | (name "scala-cache") |
1347 | (version "0.27.0") |
1348 | (source |
1349 | (origin |
1350 | (method url-fetch) |
1351 | (uri (string-append "https://github.com/cb372/scalacache/archive/v" |
1352 | version ".tar.gz")) |
1353 | (file-name (string-append name "-" version ".tar.gz")) |
1354 | (sha256 |
1355 | (base32 |
1356 | "0iqs1zvwr19j9k726f4zf4jzqlx5y1br87ijras668c3wd301h1k")))) |
1357 | (build-system ant-build-system) |
1358 | (arguments |
1359 | `(#:tests? #f |
1360 | #:phases |
1361 | (modify-phases %standard-phases |
1362 | (add-before 'build 'merge-core |
1363 | (lambda _ |
1364 | (copy-recursively "modules/core/jvm" "modules/core") |
1365 | (copy-recursively "modules/core/shared" "modules/core") |
1366 | #t)) |
1367 | (replace 'build |
1368 | ,(sbt-building-phase |
1369 | `(("modules/" "core") |
1370 | ("modules/" "caffeine")))) |
1371 | (replace 'install |
1372 | (install-jars "."))))) |
1373 | (inputs |
1374 | `(("java-caffeine" ,java-caffeine) |
1375 | ("java-slf4j-api" ,java-slf4j-api))) |
1376 | (native-inputs |
1377 | `(("scala" ,scala-official))) |
1378 | (home-page "https://www.scala-sbt.org/") |
1379 | (synopsis "") |
1380 | (description "") |
1381 | (license license:bsd-3))) |
1382 | |
1383 | (define-public sbt-jars |
1384 | (package |
1385 | (name "sbt-jars") |
1386 | (version "1.2.8") |
1387 | (source (origin |
1388 | (method url-fetch) |
1389 | (uri (string-append "https://github.com/sbt/sbt/archive/v" |
1390 | version ".tar.gz")) |
1391 | (file-name (string-append name "-" version ".tar.gz")) |
1392 | (sha256 |
1393 | (base32 |
1394 | "0fpm9jcd84xjxlfdfh2iwz7544ksgqik6591i7nrzlamygmbfadr")) |
1395 | (modules '((guix build utils))) |
1396 | (snippet |
1397 | `(begin |
1398 | (for-each delete-file (find-files "." ".*.jar")) |
1399 | #t)))) |
1400 | (build-system ant-build-system) |
1401 | (arguments |
1402 | `(#:tests? #f |
1403 | #:phases |
1404 | (modify-phases %standard-phases |
1405 | (add-before 'build 'fix-sjsonnew |
1406 | (lambda _ |
1407 | (substitute* (find-files "." ".*.scala") |
1408 | (("sjsonnew.shaded.") "")) |
1409 | #t)) |
1410 | (add-before 'build 'copy-resources |
1411 | (lambda _ |
1412 | (copy-recursively "sbt/src/main/resources" "build/classes") |
1413 | #t)) |
1414 | (add-before 'build 'generate-scalakeywords.scala |
1415 | (lambda _ |
1416 | (with-output-to-file "project/WriteKeywords.scala" |
1417 | (lambda _ |
1418 | (format #t "package project |
1419 | object WriteKeywords { |
1420 | def main(arg: Array[String]): Unit = { |
1421 | val g = new scala.tools.nsc.Global(new scala.tools.nsc.Settings) |
1422 | val keywords = g.nme.keywords.map(_.toString) |
1423 | val init = keywords.map(tn => '\"' + tn + '\"').mkString(\"Set(\", \", \", \")\") |
1424 | val ObjectName = \"ScalaKeywords\" |
1425 | val PackageName = \"sbt.internal.util\" |
1426 | val keywordsSrc = s\"\"\" |
1427 | |package $PackageName |
1428 | |object $ObjectName { |
1429 | | val values = $init |
1430 | |} |
1431 | \"\"\".trim.stripMargin |
1432 | val base = \"internal/util-collection/src/main/scala\" |
1433 | val out = base + \"/\" + PackageName.replace('.', '/') + \"/\" + s\"$ObjectName.scala\" |
1434 | val result = new java.io.PrintWriter(new java.io.File(out)) |
1435 | result.write(keywordsSrc) |
1436 | result.close() |
1437 | } |
1438 | }"))) |
1439 | (invoke "scalac" "-classpath" (getenv "CLASSPATH") "project/WriteKeywords.scala") |
1440 | (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":.") |
1441 | "project.WriteKeywords") |
1442 | #t)) |
1443 | (replace 'build |
1444 | ,(sbt-building-phase |
1445 | `(("internal/" "util-collection") |
1446 | ("internal/" "util-complete") |
1447 | ("internal/" "util-logic") |
1448 | ("testing/" "agent") |
1449 | ("" "testing") |
1450 | ("" "core-macros") |
1451 | ("" "tasks") |
1452 | ("" "tasks-standard") |
1453 | ("" "protocol") |
1454 | ("" "run") |
1455 | ("" "main-command") |
1456 | ("" "main-settings") |
1457 | ("" "main-actions") |
1458 | ("" "main") |
1459 | ("" "sbt")) |
1460 | #t)) |
1461 | (add-before 'build 'build-launch |
1462 | (lambda* (#:key inputs #:allow-other-keys) |
1463 | (mkdir-p "build/launch") |
1464 | (mkdir-p "build/jar") |
1465 | (with-directory-excursion "build/launch" |
1466 | (invoke "jar" "xf" (string-append |
1467 | (assoc-ref inputs "sbt-launcher") |
1468 | "/share/java/sbt-launcher.jar"))) |
1469 | (copy-recursively "launch/src/main/input_resources" "build/launch") |
1470 | (copy-recursively "launch/src/main/resources" "build/launch") |
1471 | (substitute* "build/launch/sbt/sbt.boot.properties" |
1472 | (("\\$\\{\\{sbt.version\\}\\}") ,version) |
1473 | (("\\$\\{\\{org\\}\\}") "org.scala-sbt")) |
1474 | (invoke "jar" "cmf" "build/launch/META-INF/MANIFEST.MF" |
1475 | "build/jar/sbt-launch.jar" "-C" "build/launch" ".") |
1476 | #t)) |
1477 | (replace 'install |
1478 | (install-jars "."))))) |
1479 | (inputs |
1480 | `(("java-apache-ivy" ,java-apache-ivy) |
1481 | ("java-sbt-ipcsocket" ,java-sbt-ipcsocket) |
1482 | ("java-sbt-test-interface" ,java-sbt-test-interface) |
1483 | ("java-log4j-api" ,java-log4j-api-for-sbt) |
1484 | ("java-log4j-core" ,java-log4j-core-for-sbt) |
1485 | ("java-native-access" ,java-native-access) |
1486 | ("scala" ,scala-official) |
1487 | ("scala-cache" ,scala-cache) |
1488 | ("scala-jawn" ,scala-jawn) |
1489 | ("scala-scalajson" ,scala-scalajson) |
1490 | ("scala-sjsonnew" ,scala-sjsonnew) |
1491 | ("scala-sjsonnew-support-murmurhash" ,scala-sjsonnew-support-murmurhash) |
1492 | ("scala-sjsonnew-support-scalajson" ,scala-sjsonnew-support-scalajson) |
1493 | ("sbt-io" ,sbt-io) |
1494 | ("sbt-launcher" ,sbt-launcher) |
1495 | ("sbt-librarymanagement" ,sbt-librarymanagement) |
1496 | ("sbt-util" ,sbt-util) |
1497 | ("sbt-zinc" ,sbt-zinc))) |
1498 | (native-inputs |
1499 | `(("scala-kind-projector" ,scala-kind-projector))) |
1500 | (home-page "https://www.scala-sbt.org/") |
1501 | (synopsis "") |
1502 | (description "") |
1503 | (license license:bsd-3))) |
1504 | |
1505 | (define-public sbt |
1506 | (package |
1507 | (name "sbt") |
1508 | (version (package-version sbt-jars)) |
1509 | (source (origin |
1510 | (method url-fetch) |
1511 | (uri (string-append "https://github.com/sbt/sbt-launcher-package/" |
1512 | "archive/v" version ".tar.gz")) |
1513 | (file-name (string-append name "-" version ".tar.gz")) |
1514 | (sha256 |
1515 | (base32 |
1516 | "0bcqjambyf4x89ind2hg6ngh6qn46wiwa8q4gcyw65jyl4rsxls9")))) |
1517 | (build-system gnu-build-system) |
1518 | (arguments |
1519 | `(#:tests? #f; no tests |
1520 | #:phases |
1521 | (modify-phases %standard-phases |
1522 | (delete 'configure) |
1523 | (delete 'build) |
1524 | (replace 'install |
1525 | (lambda* (#:key outputs inputs #:allow-other-keys) |
1526 | (delete-file "src/universal/bin/sbt.bat") |
1527 | (let ((out (assoc-ref outputs "out")) |
1528 | (sbt (assoc-ref inputs "sbt-jars")) |
1529 | (scala (assoc-ref inputs "scala")) |
1530 | (icedtea (assoc-ref inputs "icedtea"))) |
1531 | (substitute* "src/universal/bin/sbt-launch-lib.bash" |
1532 | (("java_cmd=.*") (string-append "java_cmd=\"" icedtea "/bin/java\"\n"))) |
1533 | (mkdir-p (string-append out "/lib/local-preloaded")) |
1534 | (for-each |
1535 | (lambda (package) |
1536 | (for-each |
1537 | (lambda (jar) |
1538 | (symlink jar (string-append out "/lib/local-preloaded/" |
1539 | (basename jar)))) |
1540 | (find-files (assoc-ref inputs package) ".*.jar$"))) |
1541 | '("scala" "sbt-jars")) |
1542 | (copy-recursively "src/universal" out) |
1543 | (copy-recursively "src/linux/usr" out) |
1544 | (copy-file (string-append sbt "/share/java/sbt-launch.jar") |
1545 | (string-append out "/bin/sbt-launch.jar"))) |
1546 | #t))))) |
1547 | (inputs |
1548 | `(("icedtea" ,icedtea-8) |
1549 | ("sbt-jars" ,sbt-jars) |
1550 | ("scala" ,scala-official))) |
1551 | (home-page "https://www.scala-sbt.org/") |
1552 | (synopsis "") |
1553 | (description "") |
1554 | (license license:bsd-3))) |
1555 |