Improve the sbt recipes

Julien LepillerFri Dec 14 18:14:05+0100 2018

e39c46f

Improve the sbt recipes

more/packages/scala.scm

190190
    (description "")
191191
    (license license:asl2.0)))
192192
193-
;; TODO: https://github.com/mdedetrich/scalajson
193+
(define-public scala-scalajson
194+
  (package
195+
    (name "scala-scalajson")
196+
    (version "1.0.0-M4")
197+
    (source (origin
198+
              (method url-fetch)
199+
              (uri (string-append "https://github.com/mdedetrich/scalajson/archive/v" version ".tar.gz"))
200+
              (file-name (string-append name "-" version ".tar.gz"))
201+
              (sha256
202+
               (base32
203+
                "0k4dj2zm7zilhshdnvqi9n17qr4szc5s9ymsm9imgqpr8r5hm2vj"))))
204+
    (build-system ant-build-system)
205+
    (arguments
206+
     `(#:tests? #f
207+
       #:phases
208+
       (modify-phases %standard-phases
209+
         (replace 'build
210+
           (lambda _
211+
             (mkdir-p "build/classes")
212+
             (apply invoke "scalac" "-classpath" (getenv "CLASSPATH")
213+
                    "-d" "build/classes"
214+
                    (find-files "shared/src/main/scala" ".*.scala$"))
215+
             (mkdir-p "build/jar")
216+
             (invoke "jar" "-cf" "build/jar/scalajson-shared.jar"
217+
                     "-C" "build/classes" ".")
218+
             (delete-file-recursively "build/classes")
219+
             (setenv "CLASSPATH" (string-append (getenv "CLASSPATH") ":build/jar/scalajson-shared.jar"))
220+
             (mkdir-p "build/classes")
221+
             (apply invoke "scalac" "-classpath" (getenv "CLASSPATH")
222+
                    "-d" "build/classes"
223+
                    (find-files "jvm/src/main/scala" ".*.scala$"))
224+
             (mkdir-p "build/jar")
225+
             (invoke "jar" "-cf" "build/jar/scalajson-jvm.jar"
226+
                     "-C" "build/classes" ".")
227+
             #t))
228+
         (replace 'install
229+
           (install-jars "build")))))
230+
    (native-inputs
231+
     `(("scala" ,scala-official)))
232+
    (home-page "")
233+
    (synopsis "")
234+
    (description "")
235+
    (license license:bsd-3)))
236+
237+
;; Latest is 0.13.0, but this version is required for scala-jsonnew
238+
(define-public scala-jawn
239+
  (package
240+
    (name "scala-jawn")
241+
    (version "0.10.4")
242+
    (source (origin
243+
              (method url-fetch)
244+
              (uri (string-append "https://github.com/non/jawn/archive/v"
245+
                                  version ".tar.gz"))
246+
              (file-name (string-append name "-" version ".tar.gz"))
247+
              (sha256
248+
               (base32
249+
                "1iic1rp7w7vsy0xhi40rcp339vcq5b4b46f51qrkfpv433f7hafi"))))
250+
    (build-system ant-build-system)
251+
    (arguments
252+
     `(#:tests? #f
253+
       #:phases
254+
       (modify-phases %standard-phases
255+
         (replace 'build
256+
           (lambda _
257+
             (mkdir-p "build/classes")
258+
             (apply invoke "scalac" "-classpath" (getenv "CLASSPATH")
259+
                    "-d" "build/classes"
260+
                    (find-files "util/src/main/scala" ".*.scala$"))
261+
             (mkdir-p "build/jar")
262+
             (invoke "jar" "-cf" "build/jar/jawn-util.jar"
263+
                     "-C" "build/classes" ".")
264+
             (delete-file-recursively "build/classes")
265+
             (setenv "CLASSPATH" (string-append (getenv "CLASSPATH") ":build/jar/scalajson-shared.jar"))
266+
             (mkdir-p "build/classes")
267+
             (apply invoke "scalac" "-classpath" (getenv "CLASSPATH")
268+
                    "-d" "build/classes"
269+
                    (find-files "parser/src/main/scala" ".*.scala$"))
270+
             (mkdir-p "build/jar")
271+
             (invoke "jar" "-cf" "build/jar/jawn-parser.jar"
272+
                     "-C" "build/classes" ".")
273+
             #t))
274+
         (replace 'install
275+
           (install-jars "build")))))
276+
    (native-inputs
277+
     `(("scala" ,scala-official)))
278+
    (home-page "")
279+
    (synopsis "")
280+
    (description "")
281+
    (license license:bsd-3)))
282+
194283
(define-public scala-sjsonnew-support-scalajson
195284
  (package
196285
    (inherit scala-sjsonnew)

201290
       (modify-phases %standard-phases
202291
         (replace 'build
203292
           (lambda _
293+
             (substitute* (find-files "." ".*.scala")
294+
               (("shaded.scalajson") "scalajson"))
204295
             (mkdir-p "build/classes")
205296
             (apply invoke "scalac" "-classpath" (getenv "CLASSPATH")
206297
                    "-d" "build/classes"

212303
         (replace 'install
213304
           (install-jars "build")))))
214305
    (inputs
306+
     `(("scala-sjsonnew" ,scala-sjsonnew)
307+
       ("scala-scalajson" ,scala-scalajson)
308+
       ("scala-jawn" ,scala-jawn)))))
309+
310+
(define-public scala-sjsonnew-support-murmurhash
311+
  (package
312+
    (inherit scala-sjsonnew)
313+
    (name "scala-sjsonnew-support-murmurhash")
314+
    (arguments
315+
     `(#:tests? #f
316+
       #:phases
317+
       (modify-phases %standard-phases
318+
         (replace 'build
319+
           (lambda _
320+
             (mkdir-p "build/classes")
321+
             (apply invoke "scalac" "-classpath" (getenv "CLASSPATH")
322+
                    "-d" "build/classes"
323+
                    (find-files "support/murmurhash/src/main/scala" ".*.scala$"))
324+
             (mkdir-p "build/jar")
325+
             (invoke "jar" "-cf" "build/jar/sjsonnew-support-murmurhash.jar"
326+
                     "-C" "build/classes" ".")
327+
             #t))
328+
         (replace 'install
329+
           (install-jars "build")))))
330+
    (inputs
215331
     `(("scala-sjsonnew" ,scala-sjsonnew)))))
216332
217333
(define-public scala-kind-projector

354470
    (arguments
355471
     (ensure-keyword-arguments (package-arguments java-log4j-api)
356472
       `(#:jdk ,icedtea-8
357-
	 #:source-dir "src/main/java"
358-
	 #:phases
359-
	 (modify-phases %standard-phases
360-
	   (add-after 'unpack 'chdir
361-
	     (lambda _
362-
	       (chdir "log4j-api")
363-
	       #t))
364-
	   (add-before 'build 'fix-ambiguous
365-
	     (lambda _
366-
	       (substitute* "src/main/java/org/apache/logging/log4j/message/MapMessage.java"
367-
		 (("append\\(data") "append((CharSequence)data"))
368-
	       #t))))))
473+
         #:source-dir "src/main/java"
474+
         #:phases
475+
         (modify-phases %standard-phases
476+
           (add-after 'unpack 'chdir
477+
             (lambda _
478+
               (chdir "log4j-api")
479+
               #t))
480+
           (add-before 'build 'fix-ambiguous
481+
             (lambda _
482+
               (substitute* "src/main/java/org/apache/logging/log4j/message/MapMessage.java"
483+
                 (("append\\(data") "append((CharSequence)data"))
484+
               #t))))))
369485
    (source (origin
370486
              (method url-fetch)
371487
              (uri (string-append "mirror://apache/logging/log4j/" version

421537
       (modify-phases %standard-phases
422538
         (add-after 'unpack 'enter-dir
423539
           (lambda _ (chdir "log4j-core") #t))
424-
	 (add-before 'build 'fix-ambiguous
425-
	   (lambda _
426-
	     (substitute* "src/main/java/org/apache/logging/log4j/core/pattern/MapPatternConverter.java"
427-
	       (("append\\(sortedMap") "append((CharSequence)sortedMap"))
428-
	     #t)))))
540+
         (add-before 'build 'fix-ambiguous
541+
           (lambda _
542+
             (substitute* "src/main/java/org/apache/logging/log4j/core/pattern/MapPatternConverter.java"
543+
               (("append\\(sortedMap") "append((CharSequence)sortedMap"))
544+
             #t)))))
429545
    (synopsis "Core component of the Log4j framework")
430546
    (description "This package provides the core component of the Log4j
431547
logging framework for Java.")))

447563
                     (jar-name (string-append name ".jar")))
448564
                 (mkdir-p build-directory)
449565
                 (format #t "Building project ~a...~%" name)
566+
                 (substitute* (find-files "." ".*.scala")
567+
                   (("sjsonnew.shaded.") ""))
450568
                 (apply invoke "scalac" "-classpath"
451569
                        (string-append (getenv "CLASSPATH") ":build/util-interface")
452570
                        "-d" build-directory "-language:experimental.macros"

464582
     `(("java-log4j-api" ,java-log4j-api-for-sbt)
465583
       ("java-log4j-core" ,java-log4j-core-for-sbt)
466584
       ("sbt-util-interface" ,sbt-util-interface)
467-
       ("scala-sjsonnew" ,scala-sjsonnew)))
585+
       ("scala-scalajson" ,scala-scalajson)
586+
       ("scala-sjsonnew" ,scala-sjsonnew)
587+
       ("scala-sjsonnew-support-scalajson" ,scala-sjsonnew-support-scalajson)))
588+
    (native-inputs
589+
     `(("scala-official" ,scala-official)))))
590+
591+
(define-public sbt-util-cache
592+
  (package
593+
    (inherit sbt-util-position)
594+
    (name "sbt-util-cache")
595+
    (arguments
596+
     `(#:tests? #f
597+
       #:phases
598+
       (modify-phases %standard-phases
599+
         (replace 'build
600+
           (lambda* (#:key inputs #:allow-other-keys)
601+
             (define (build-subproject prefix name)
602+
               (let ((build-directory (string-append "build/" name))
603+
                     (jar-name (string-append name ".jar")))
604+
                 (mkdir-p build-directory)
605+
                 (substitute* (find-files "." ".*.scala")
606+
                   (("sjsonnew.shaded.") ""))
607+
                 (format #t "Building project ~a...~%" name)
608+
                 (apply invoke "scalac" "-classpath"
609+
                        (string-append (getenv "CLASSPATH") ":build/util-interface")
610+
                        "-d" build-directory "-language:experimental.macros"
611+
                        (append
612+
                          (find-files (string-append prefix name "/src/main/contraband-scala")
613+
                                      ".*.scala$")
614+
                          (find-files (string-append prefix name "/src/main/scala")
615+
                                      ".*.scala$")))
616+
                 (invoke "jar" "cf" jar-name "-C" build-directory ".")))
617+
             (build-subproject "" "util-cache")
618+
             #t))
619+
         (replace 'install
620+
           (install-jars ".")))))
621+
    (inputs
622+
     `(("sbt-io" ,sbt-io)
623+
       ("scala-jawn" ,scala-jawn)
624+
       ("scala-scalajson" ,scala-scalajson)
625+
       ("scala-sjsonnew" ,scala-sjsonnew)
626+
       ("scala-sjsonnew-support-murmurhash" ,scala-sjsonnew-support-murmurhash)
627+
       ("scala-sjsonnew-support-scalajson" ,scala-sjsonnew-support-scalajson)))
468628
    (native-inputs
469629
     `(("scala-official" ,scala-official)))))
470630

534694
    (description "")
535695
    (license license:bsd-3)))
536696
697+
;; https://index.scala-lang.org/eed3si9n/gigahorse/gigahorse-okhttp/0.3.0?target=_2.12
698+
(define-public sbt-librarymanagement
699+
  (package
700+
    (name "sbt-librarymanagement")
701+
    (version "1.2.3")
702+
    (source (origin
703+
	      (method url-fetch)
704+
	      (uri (string-append "https://github.com/sbt/librarymanagement/archive/v" version ".tar.gz"))
705+
	      (file-name (string-append name "-" version ".tar.gz"))
706+
	      (sha256
707+
	       (base32
708+
		"0a29xzcw2qzviv073g040m3lcylybh2qj1xcdkcjdcfajad7c27k"))))
709+
    (build-system ant-build-system)
710+
    (arguments
711+
     `(#:tests? #f
712+
       #:phases
713+
       (modify-phases %standard-phases
714+
         (replace 'build
715+
           (lambda* (#:key inputs #:allow-other-keys)
716+
             (mkdir-p "build/classes")
717+
             (apply invoke "scalac" "-classpath" (getenv "CLASSPATH")
718+
                    "-d" "build/classes"
719+
                    (append
720+
                      (find-files "core/src/main/java" ".*.java$")
721+
                      (find-files "core/src/main/scala" ".*.scala$")
722+
                      (find-files "core/src/main/contraband-scala" ".*.scala$")))
723+
             (invoke "jar" "cf" "sbt-io.jar" "-C" "build/classes" ".")
724+
             #t))
725+
         (replace 'install
726+
           (install-jars ".")))))
727+
    (inputs
728+
     `(("sbt-util-cache" ,sbt-util-cache)
729+
       ("sbt-util-interface" ,sbt-util-interface)
730+
       ("sbt-util-logging" ,sbt-util-logging)
731+
       ("sbt-util-position" ,sbt-util-position)
732+
       ("sbt-io" ,sbt-io)
733+
       ("scala-sjsonnew" ,scala-sjsonnew)))
734+
    (native-inputs
735+
     `(("scala" ,scala-official)))
736+
    (home-page "")
737+
    (synopsis "")
738+
    (description "")
739+
    ;; From core/NOTICE
740+
    (license license:bsd-2)))
741+
537742
(define-public sbt
538743
  (package
539744
    (name "sbt")
540-
    (version "1.2.1")
745+
    (version "1.2.7")
541746
    (source
542747
      (origin
543748
        (method url-fetch)

546751
        (file-name (string-append name "-" version ".tar.gz"))
547752
        (sha256
548753
         (base32
549-
          "15i8fd7zgairaaikscrva8d1klz0w9nh7fc0896x1n8nrs578vmy"))))
754+
          "0i0j6dcgn80bajq05h739h0d7kgcz7zbfk6qsnln8qrcx1wgbf0q"))))
550755
    (build-system ant-build-system)
551756
    (arguments
552757
     `(#:tests? #f

619824
     `(("scala" ,scala-official)
620825
       ("scala-sjsonnew" ,scala-sjsonnew)
621826
       ("sbt-io" ,sbt-io)
827+
       ("sbt-util-cache" ,sbt-util-cache)
622828
       ("sbt-util-control" ,sbt-util-control)
623829
       ("sbt-util-interface" ,sbt-util-interface)
624830
       ("sbt-util-logging" ,sbt-util-logging)