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 trivial) |
28 | #:use-module (gnu packages base) |
29 | #:use-module (gnu packages bash) |
30 | #:use-module (gnu packages compression) |
31 | #:use-module (gnu packages java)) |
32 | |
33 | ;; This package downloads the so-called official version of scala, a pre-built |
34 | ;; binary by the scala developers. |
35 | ;; This binary should never be made part of Guix itself, because we have |
36 | ;; ways to bootstrap it properly. The bootstrap project of scala takes time, |
37 | ;; so in the meantime... here you are :( |
38 | (define-public scala-official |
39 | (package |
40 | (name "scala-official") |
41 | (version "2.12.6") |
42 | (source |
43 | (origin |
44 | (method url-fetch) |
45 | (uri (string-append "https://downloads.lightbend.com/scala/" |
46 | version "/scala-" version ".tgz")) |
47 | (sha256 |
48 | (base32 |
49 | "05ili2959yrshqi44wpmwy0dyfm4kvp6i8mlbnj1xvc5b9649iqs")))) |
50 | (build-system trivial-build-system) |
51 | (arguments |
52 | `(#:modules ((guix build utils)) |
53 | #:builder (begin |
54 | (use-modules (guix build utils)) |
55 | (let* ((source (assoc-ref %build-inputs "source")) |
56 | (java (assoc-ref %build-inputs "icedtea-8")) |
57 | (bash (assoc-ref %build-inputs "bash")) |
58 | (tar (string-append |
59 | (assoc-ref %build-inputs "tar") |
60 | "/bin/tar")) |
61 | (gzip (assoc-ref %build-inputs "gzip")) |
62 | (output (assoc-ref %outputs "out")) |
63 | (bindir (string-append output "/bin"))) |
64 | (mkdir-p output) |
65 | (setenv "PATH" (string-append (getenv "PATH") ":" gzip "/bin")) |
66 | (invoke tar "xf" source) |
67 | (copy-recursively "scala-2.12.6" output) |
68 | (chdir output) |
69 | (for-each delete-file (find-files "bin" "bat$")) |
70 | (substitute* (find-files "bin" ".*") |
71 | (("^#!.*") |
72 | (string-append "#!" bash "/bin/bash\n" "JAVA_HOME=" java))))))) |
73 | (inputs |
74 | `(("bash" ,bash) |
75 | ("gzip" ,gzip) |
76 | ("icedtea-8" ,icedtea-8) |
77 | ("tar" ,tar))) |
78 | (home-page "https://scala-lang.org/") |
79 | (synopsis "") |
80 | (description "") |
81 | (license license:bsd-3))) |
82 | |
83 | (define-public sbt-boilerplate-standalone |
84 | (package |
85 | (name "sbt-boilerplate-standalone") |
86 | (version "0.6.1") |
87 | (source (origin |
88 | (method url-fetch) |
89 | (uri (string-append "https://github.com/sbt/sbt-boilerplate/archive/v" |
90 | version ".tar.gz")) |
91 | (file-name (string-append name "-" version ".tar.gz")) |
92 | (sha256 |
93 | (base32 |
94 | "1xzh7qrsl2nmnbyzlmrshzfsf8b4qgf6yaqm1hn3qnzk6761p2jy")))) |
95 | (build-system ant-build-system) |
96 | (arguments |
97 | `(#:tests? #f |
98 | #:jdk ,icedtea-8 |
99 | #:phases |
100 | (modify-phases %standard-phases |
101 | (add-before 'build 'add-standalone |
102 | (lambda _ |
103 | (substitute* "src/main/scala/spray/boilerplate/Generator.scala" |
104 | (("object Generator \\{") |
105 | "object Generator { |
106 | def main(args: Array[String]): Unit = { |
107 | val num = args(2).toInt |
108 | val file = scala.io.Source.fromFile(args(0)) |
109 | val content = file.mkString |
110 | val result = new java.io.PrintWriter(new java.io.File(args(1))) |
111 | |
112 | file.close |
113 | result.write(generateFromTemplate(content, num)) |
114 | result.close() |
115 | }")) |
116 | #t)) |
117 | (replace 'build |
118 | (lambda _ |
119 | (mkdir-p "build/classes") |
120 | (mkdir-p "build/jar") |
121 | (invoke "scalac" "-classpath" (getenv "CLASSPATH") |
122 | "-d" "build/classes" |
123 | "src/main/scala/spray/boilerplate/Generator.scala" |
124 | "src/main/scala/spray/boilerplate/TemplateParser.scala") |
125 | (invoke "jar" "-cf" "build/jar/boilerplate.jar" |
126 | "-C" "build/classes" ".") |
127 | #t)) |
128 | (replace 'install |
129 | (install-jars "build"))))) |
130 | (native-inputs |
131 | `(("scala" ,scala-official))) |
132 | (home-page "https://github.com/sbt/sbt-boilerplate") |
133 | (synopsis "") |
134 | (description "") |
135 | (license license:bsd-2))) |
136 | |
137 | (define-public scala-sjsonnew |
138 | (package |
139 | (name "scala-sjsonnew") |
140 | (version "0.8.2") |
141 | (source |
142 | (origin |
143 | (method url-fetch) |
144 | (uri (string-append "https://github.com/eed3si9n/sjson-new/archive/v" |
145 | version ".tar.gz")) |
146 | (file-name (string-append name "-" version ".tar.gz")) |
147 | (sha256 |
148 | (base32 |
149 | "1rv0c50af5kn27x51g650wl2ig94z52fhs0rn8ykahpz4jhg1p7p")))) |
150 | (arguments |
151 | `(#:tests? #f |
152 | #:jdk ,icedtea-8 |
153 | #:phases |
154 | (modify-phases %standard-phases |
155 | (add-before 'build 'generate-boilerplate |
156 | (lambda _ |
157 | ; CaseClassFormats.scala.template FlatUnionFormats.scala.template TupleFormats.scala.template UnionFormats.scala.template |
158 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
159 | "core/src/main/boilerplate/sjsonnew/CaseClassFormats.scala.template" |
160 | "core/src/main/scala/sjsonnew/CaseClassFormats.scala" "22") |
161 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
162 | "core/src/main/boilerplate/sjsonnew/FlatUnionFormats.scala.template" |
163 | "core/src/main/scala/sjsonnew/FlatUnionFormats.scala" "22") |
164 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
165 | "core/src/main/boilerplate/sjsonnew/TupleFormats.scala.template" |
166 | "core/src/main/scala/sjsonnew/TupleFormats.scala" "22") |
167 | (invoke "java" "-cp" (getenv "CLASSPATH") "spray.boilerplate.Generator" |
168 | "core/src/main/boilerplate/sjsonnew/UnionFormats.scala.template" |
169 | "core/src/main/scala/sjsonnew/UnionFormats.scala" "22") |
170 | #t)) |
171 | (replace 'build |
172 | (lambda _ |
173 | (mkdir-p "build/classes") |
174 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
175 | "-d" "build/classes" |
176 | (find-files "core/src/main/scala" ".*.scala$")) |
177 | (mkdir-p "build/jar") |
178 | (invoke "jar" "-cf" "build/jar/sjsonnew.jar" |
179 | "-C" "build/classes" ".") |
180 | #t)) |
181 | (replace 'install |
182 | (install-jars "build"))))) |
183 | (build-system ant-build-system) |
184 | (native-inputs |
185 | `(("scala" ,scala-official) |
186 | ("sbt-boilerplate-standalone" ,sbt-boilerplate-standalone))) |
187 | (home-page "") |
188 | (synopsis "") |
189 | (description "") |
190 | (license license:asl2.0))) |
191 | |
192 | (define-public scala-kind-projector |
193 | (package |
194 | (name "scala-kind-projector") |
195 | (version "0.9.7") |
196 | (source (origin |
197 | (method url-fetch) |
198 | (uri (string-append "https://github.com/non/kind-projector/archive/v" |
199 | version ".tar.gz")) |
200 | (file-name (string-append name "-" version ".tar.gz")) |
201 | (sha256 |
202 | (base32 |
203 | "176g2d7ix2asp94ch39mza84k6z8by308hzglxs8933j8byramff")))) |
204 | (build-system ant-build-system) |
205 | (arguments |
206 | `(#:jdk ,icedtea-8 |
207 | #:phases |
208 | (modify-phases %standard-phases |
209 | (replace 'build |
210 | (lambda _ |
211 | (mkdir-p "build/classes") |
212 | (mkdir-p "build/jar") |
213 | (copy-recursively "src/main/resources" "build/classes") |
214 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
215 | "-d" "build/classes" |
216 | (find-files "src/main/scala" ".*.scala$")) |
217 | (invoke "jar" "-cf" "build/jar/kind-projector.jar" |
218 | "-C" "build/classes" ".") |
219 | #t)) |
220 | (replace 'check |
221 | (lambda _ |
222 | (mkdir-p "build/test-classes") |
223 | (copy-recursively "src/test/resources" "build/test-classes") |
224 | (apply invoke "scalac" "-classpath" (getenv "CLASSPATH") |
225 | "-Xplugin:build/jar/kind-projector.jar" |
226 | "-d" "build/test-classes" |
227 | (find-files "src/test/scala" ".*.scala$")) |
228 | ;; TODO: actually run the tests... :D |
229 | #t)) |
230 | (replace 'install |
231 | (install-jars "build"))))) |
232 | (native-inputs |
233 | `(("scala-official" ,scala-official) |
234 | ("java-junit" ,java-junit))) |
235 | (home-page "https://github.com/non/kind-projector") |
236 | (synopsis "Scala compiler plugin for type lambda") |
237 | (description "Kind projector is a Scala compiler plugin for making type |
238 | lambdas (type projections) easier to write.") |
239 | (license license:expat))) |
240 | |
241 | (define-public sbt-util-position |
242 | (package |
243 | (name "sbt-util-position") |
244 | (version "1.2.2") |
245 | (source |
246 | (origin |
247 | (method url-fetch) |
248 | (uri (string-append "https://github.com/sbt/util/archive/v" |
249 | version ".tar.gz")) |
250 | (file-name (string-append "sbt-util-" version ".tar.gz")) |
251 | (sha256 |
252 | (base32 |
253 | "1mj6ny62crq1d8850lkj00g3wsjhflaxrqiiv72b02fb8hn671dh")))) |
254 | (build-system ant-build-system) |
255 | (arguments |
256 | `(#:tests? #f |
257 | #:jdk ,icedtea-8 |
258 | #:phases |
259 | (modify-phases %standard-phases |
260 | (replace 'build |
261 | (lambda* (#:key inputs #:allow-other-keys) |
262 | (define (build-subproject prefix name) |
263 | (let ((build-directory (string-append "build/" name)) |
264 | (jar-name (string-append name ".jar"))) |
265 | (mkdir-p build-directory) |
266 | (format #t "Building project ~a...~%" name) |
267 | (apply invoke "scalac" "-classpath" |
268 | (string-append (getenv "CLASSPATH") ":build/util-interface") |
269 | "-d" build-directory "-language:experimental.macros" |
270 | (find-files (string-append prefix name "/src/main/scala") |
271 | ".*.scala$")) |
272 | (invoke "jar" "cf" jar-name "-C" build-directory "."))) |
273 | (build-subproject "internal/" "util-position") |
274 | #t)) |
275 | (replace 'install |
276 | (install-jars "."))))) |
277 | (inputs |
278 | `(("java-log4j-api" ,java-log4j-api) |
279 | ("java-log4j-core" ,java-log4j-core) |
280 | ("scala" ,scala-official) |
281 | ("scala-sjsonnew" ,scala-sjsonnew))) |
282 | (home-page "https://www.scala-sbt.org/") |
283 | (synopsis "") |
284 | (description "") |
285 | (license license:bsd-3))) |
286 | |
287 | (define-public sbt-util-control |
288 | (package |
289 | (inherit sbt-util-position) |
290 | (name "sbt-util-control") |
291 | (arguments |
292 | `(#:tests? #f |
293 | #:jdk ,icedtea-8 |
294 | #:phases |
295 | (modify-phases %standard-phases |
296 | (replace 'build |
297 | (lambda* (#:key inputs #:allow-other-keys) |
298 | (define (build-subproject prefix name) |
299 | (let ((build-directory (string-append "build/" name)) |
300 | (jar-name (string-append name ".jar"))) |
301 | (mkdir-p build-directory) |
302 | (format #t "Building project ~a...~%" name) |
303 | (apply invoke "scalac" "-classpath" |
304 | (string-append (getenv "CLASSPATH") ":build/util-interface") |
305 | "-d" build-directory "-language:experimental.macros" |
306 | (find-files (string-append prefix name "/src/main/scala") |
307 | ".*.scala$")) |
308 | (invoke "jar" "cf" jar-name "-C" build-directory "."))) |
309 | (build-subproject "internal/" "util-control") |
310 | #t)) |
311 | (replace 'install |
312 | (install-jars "."))))))) |
313 | |
314 | (define-public sbt-util-interface |
315 | (package |
316 | (inherit sbt-util-position) |
317 | (name "sbt-util-interface") |
318 | (arguments |
319 | `(#:tests? #f |
320 | #:jdk ,icedtea-8 |
321 | #:source-dir "internal/util-interface/src/main/java" |
322 | #:jar-name "util-interface.jar")))) |
323 | |
324 | (define-public java-log4j-api-for-sbt |
325 | (package |
326 | (inherit java-log4j-api) |
327 | (version "2.8.1") |
328 | (source (origin |
329 | (method url-fetch) |
330 | (uri (string-append "mirror://apache/logging/log4j/" version |
331 | "/apache-log4j-" version "-src.tar.gz")) |
332 | (sha256 |
333 | (base32 |
334 | "0x5gksgh0jkvd7k70rqrs2hy3glms0pkj6lhl26m6f83x1b6kvdm")))))) |
335 | |
336 | ;; More dependencies needed |
337 | (define-public java-log4j-core-for-sbt |
338 | (package |
339 | (inherit java-log4j-api-for-sbt) |
340 | (name "java-log4j-core") |
341 | (inputs |
342 | `(("java-osgi-core" ,java-osgi-core) |
343 | ("java-hamcrest-core" ,java-hamcrest-core) |
344 | ("java-log4j-api" ,java-log4j-api-for-sbt) |
345 | ("java-mail" ,java-mail) |
346 | ("java-jboss-jms-api-spec" ,java-jboss-jms-api-spec) |
347 | ("java-lmax-disruptor" ,java-lmax-disruptor) |
348 | ("java-kafka" ,java-kafka-clients) |
349 | ("java-datanucleus-javax-persistence" ,java-datanucleus-javax-persistence) |
350 | ("java-fasterxml-jackson-annotations" ,java-fasterxml-jackson-annotations) |
351 | ("java-fasterxml-jackson-core" ,java-fasterxml-jackson-core) |
352 | ("java-fasterxml-jackson-databind" ,java-fasterxml-jackson-databind) |
353 | ("java-fasterxml-jackson-dataformat-xml" ,java-fasterxml-jackson-dataformat-xml) |
354 | ("java-fasterxml-jackson-dataformat-yaml" ,java-fasterxml-jackson-dataformat-yaml) |
355 | ("java-commons-compress" ,java-commons-compress) |
356 | ("java-commons-csv" ,java-commons-csv) |
357 | ("java-jeromq" ,java-jeromq) |
358 | ("java-junit" ,java-junit))) |
359 | (native-inputs |
360 | `(("hamcrest" ,java-hamcrest-all) |
361 | ("java-commons-io" ,java-commons-io) |
362 | ("java-commons-lang3" ,java-commons-lang3) |
363 | ("slf4j" ,java-slf4j-api))) |
364 | (arguments |
365 | `(#:tests? #f ; tests require more dependencies |
366 | #:test-dir "src/test" |
367 | #:source-dir "src/main/java" |
368 | #:jar-name "log4j-core.jar" |
369 | #:jdk ,icedtea-8 |
370 | #:make-flags |
371 | (list (string-append "-Ddist.dir=" (assoc-ref %outputs "out") |
372 | "/share/java")) |
373 | #:phases |
374 | (modify-phases %standard-phases |
375 | (add-after 'unpack 'enter-dir |
376 | (lambda _ (chdir "log4j-core") #t))))) |
377 | (synopsis "Core component of the Log4j framework") |
378 | (description "This package provides the core component of the Log4j |
379 | logging framework for Java."))) |
380 | |
381 | |
382 | (define-public sbt-util-logging |
383 | (package |
384 | (inherit sbt-util-position) |
385 | (name "sbt-util-logging") |
386 | (arguments |
387 | `(#:tests? #f |
388 | #:jdk ,icedtea-8 |
389 | #:phases |
390 | (modify-phases %standard-phases |
391 | (replace 'build |
392 | (lambda* (#:key inputs #:allow-other-keys) |
393 | (define (build-subproject prefix name) |
394 | (let ((build-directory (string-append "build/" name)) |
395 | (jar-name (string-append name ".jar"))) |
396 | (mkdir-p build-directory) |
397 | (format #t "Building project ~a...~%" name) |
398 | (apply invoke "scalac" "-classpath" |
399 | (string-append (getenv "CLASSPATH") ":build/util-interface") |
400 | "-d" build-directory "-language:experimental.macros" |
401 | (append |
402 | (find-files (string-append prefix name "/src/main/contraband-scala") |
403 | ".*.scala$") |
404 | (find-files (string-append prefix name "/src/main/scala") |
405 | ".*.scala$"))) |
406 | (invoke "jar" "cf" jar-name "-C" build-directory "."))) |
407 | (build-subproject "internal/" "util-logging") |
408 | #t)) |
409 | (replace 'install |
410 | (install-jars "."))))) |
411 | (inputs |
412 | `(("java-log4j-api" ,java-log4j-api-for-sbt) |
413 | ;("java-log4j-core" ,java-log4j-core) |
414 | ("sbt-util-interface" ,sbt-util-interface) |
415 | ("scala-"))) |
416 | (native-inputs |
417 | `(("scala-official" ,scala-official))))) |
418 | |
419 | (define-public java-swoval-apple-file-events |
420 | (package |
421 | (name "java-swoval-apple-file-events") |
422 | (version "1.3.2") |
423 | (source (origin |
424 | (method url-fetch) |
425 | (uri (string-append "https://github.com/swoval/swoval/archive/v" |
426 | version ".tar.gz")) |
427 | (file-name (string-append "scala-swoval-" version ".tar.gz")) |
428 | (sha256 |
429 | (base32 |
430 | "0ivrc4lcali84xp8frkjb2zi1l3lw8pim9xbkfah5iyj120gw6mq")))) |
431 | (build-system ant-build-system) |
432 | (arguments |
433 | `(#:jdk ,icedtea-8 |
434 | #:tests? #f; no tests |
435 | #:jar-name "apple-file-events.jar" |
436 | #:source-dir "apple-file-events/jvm/src/main/java")) |
437 | (home-page "") |
438 | (synopsis "") |
439 | (description "") |
440 | (license license:expat))) |
441 | |
442 | (define-public sbt-io |
443 | (package |
444 | (name "sbt-io") |
445 | (version "1.2.1") |
446 | (source |
447 | (origin |
448 | (method url-fetch) |
449 | (uri (string-append "https://github.com/sbt/io/archive/v" |
450 | version ".tar.gz")) |
451 | (file-name (string-append name "-" version ".tar.gz")) |
452 | (sha256 |
453 | (base32 |
454 | "0cgk3y3w8yjpivi910px529bz8bil49lrnib6wbwmvq8lw8mgrwq")))) |
455 | (build-system ant-build-system) |
456 | (arguments |
457 | `(#:tests? #f |
458 | #:jdk ,icedtea-8 |
459 | #:phases |
460 | (modify-phases %standard-phases |
461 | (replace 'build |
462 | (lambda* (#:key inputs #:allow-other-keys) |
463 | (mkdir-p "build/classes") |
464 | (apply invoke "scalac" "-classpath" |
465 | (string-append (getenv "CLASSPATH") ":build/util-interface") |
466 | "-d" "build/classes" |
467 | (append |
468 | (find-files "io/src/main/java" ".*.java$") |
469 | (find-files "io/src/main/scala" ".*.scala$") |
470 | (find-files "io/src/main/contraband-scala" ".*.scala$"))) |
471 | (invoke "jar" "cf" "sbt-io.jar" "-C" "build/classes" ".") |
472 | #t)) |
473 | (replace 'install |
474 | (install-jars "."))))) |
475 | (inputs |
476 | `(("java-native-access" ,java-native-access) |
477 | ("java-native-access-platform" ,java-native-access-platform) |
478 | ("java-swoval-apple-file-events" ,java-swoval-apple-file-events) |
479 | ("scala" ,scala-official))) |
480 | (home-page "https://www.scala-sbt.org/") |
481 | (synopsis "") |
482 | (description "") |
483 | (license license:bsd-3))) |
484 | |
485 | (define-public sbt |
486 | (package |
487 | (name "sbt") |
488 | (version "1.2.1") |
489 | (source |
490 | (origin |
491 | (method url-fetch) |
492 | (uri (string-append "https://github.com/sbt/sbt/archive/v" |
493 | version ".tar.gz")) |
494 | (file-name (string-append name "-" version ".tar.gz")) |
495 | (sha256 |
496 | (base32 |
497 | "15i8fd7zgairaaikscrva8d1klz0w9nh7fc0896x1n8nrs578vmy")))) |
498 | (build-system ant-build-system) |
499 | (arguments |
500 | `(#:tests? #f |
501 | #:jdk ,icedtea-8 |
502 | #:phases |
503 | (modify-phases %standard-phases |
504 | (add-before 'build 'copy-resources |
505 | (lambda _ |
506 | (copy-recursively "sbt/src/main/resources" "build/classes") |
507 | #t)) |
508 | (add-before 'build 'generate-scalakeywords.scala |
509 | (lambda _ |
510 | (with-output-to-file "project/WriteKeywords.scala" |
511 | (lambda _ |
512 | (format #t "package project |
513 | object WriteKeywords { |
514 | def main(arg: Array[String]): Unit = { |
515 | val g = new scala.tools.nsc.Global(new scala.tools.nsc.Settings) |
516 | val keywords = g.nme.keywords.map(_.toString) |
517 | val init = keywords.map(tn => '\"' + tn + '\"').mkString(\"Set(\", \", \", \")\") |
518 | val ObjectName = \"ScalaKeywords\" |
519 | val PackageName = \"sbt.internal.util\" |
520 | val keywordsSrc = s\"\"\" |
521 | |package $PackageName |
522 | |object $ObjectName { |
523 | | val values = $init |
524 | |} |
525 | \"\"\".trim.stripMargin |
526 | val base = \"internal/util-collection/src/main/scala\" |
527 | val out = base + \"/\" + PackageName.replace('.', '/') + \"/\" + s\"$ObjectName.scala\" |
528 | val result = new java.io.PrintWriter(new java.io.File(out)) |
529 | result.write(keywordsSrc) |
530 | result.close() |
531 | } |
532 | }"))) |
533 | (invoke "scalac" "-classpath" (getenv "CLASSPATH") "project/WriteKeywords.scala") |
534 | (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":.") |
535 | "project.WriteKeywords") |
536 | #t)) |
537 | (replace 'build |
538 | (lambda* (#:key inputs #:allow-other-keys) |
539 | (define (build-subproject prefix name) |
540 | (let ((build-directory (string-append "build/" name)) |
541 | (jar-name (string-append name ".jar")) |
542 | (kind-projector (assoc-ref inputs "scala-kind-projector"))) |
543 | (mkdir-p build-directory) |
544 | (format #t "Building project ~a...~%" name) |
545 | (apply invoke "scalac" "-classpath" |
546 | ;; 13:36 < snape> roptat: I think you could use 'readdir', as in 'files-in-directory' from guix/build/union.scm |
547 | (apply string-append (getenv "CLASSPATH") |
548 | (map (lambda (file) (string-append ":" file)) |
549 | (find-files "build" "." #:directories? #t))) |
550 | "-d" build-directory |
551 | (string-append "-Xplugin:" kind-projector |
552 | "/share/java/kind-projector.jar") |
553 | (find-files (string-append prefix name "/src/main/scala") |
554 | ".*.scala$")) |
555 | (invoke "jar" "cf" jar-name "-C" build-directory "."))) |
556 | (build-subproject "internal/" "util-collection") |
557 | (build-subproject "internal/" "util-complete") |
558 | (build-subproject "" "core-macros") |
559 | (build-subproject "" "tasks") |
560 | (build-subproject "" "tasks-standard") |
561 | (build-subproject "" "main-settings") |
562 | (build-subproject "" "sbt") |
563 | #t)) |
564 | (replace 'install |
565 | (install-jars "."))))) |
566 | (inputs |
567 | `(("scala" ,scala-official) |
568 | ("scala-sjsonnew" ,scala-sjsonnew) |
569 | ("sbt-io" ,sbt-io) |
570 | ("sbt-util-control" ,sbt-util-control) |
571 | ("sbt-util-interface" ,sbt-util-interface) |
572 | ("sbt-util-logging" ,sbt-util-logging) |
573 | ("sbt-util-position" ,sbt-util-position))) |
574 | (native-inputs |
575 | `(("scala-kind-projector" ,scala-kind-projector))) |
576 | (home-page "https://www.scala-sbt.org/") |
577 | (synopsis "") |
578 | (description "") |
579 | (license license:bsd-3))) |
580 |