gnu: clojure: Use (guix build java-utils) to simplify build phases.

* gnu/packages/lisp.scm (clojure)[arguments]: Use 'ant-build-javadoc',
'install-jars' and 'install-javadoc' in build phases.
This commit is contained in:
Alex Vong 2018-10-14 02:52:41 +08:00 committed by Danny Milosavljevic
parent 8da9187a5a
commit d0ad97115a
No known key found for this signature in database
GPG key ID: E71A35542C30BAA5

View file

@ -614,10 +614,10 @@ (define-public clojure
(build-system ant-build-system) (build-system ant-build-system)
(arguments (arguments
`(#:modules ((guix build ant-build-system) `(#:modules ((guix build ant-build-system)
(guix build java-utils)
(guix build utils) (guix build utils)
(ice-9 ftw) (ice-9 ftw)
(ice-9 regex) (ice-9 regex)
(srfi srfi-1)
(srfi srfi-26)) (srfi srfi-26))
#:test-target "test" #:test-target "test"
#:phases #:phases
@ -641,34 +641,22 @@ (define (extract-library name)
(substitute* "build.xml" (substitute* "build.xml"
(("<attribute name=\"Class-Path\" value=\".\"/>") "")) (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
#t)) #t))
;; The javadoc target is not built by default. (add-after 'build 'build-javadoc ant-build-javadoc)
(add-after 'build 'build-doc (replace 'install (install-jars "./"))
(lambda _
(invoke "ant" "javadoc")))
;; Needed since no install target is provided.
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((java-dir (string-append (assoc-ref outputs "out")
"/share/java/")))
;; Install versioned to avoid collisions.
(install-file (string-append "clojure-" ,version ".jar")
java-dir)
#t)))
;; Needed since no install-doc target is provided.
(add-after 'install 'install-doc (add-after 'install 'install-doc
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((doc-dir (string-append (assoc-ref outputs "out") (let ((doc-dir (string-append (assoc-ref outputs "out")
"/share/doc/clojure-" "/share/doc/clojure-"
,version "/"))) ,version "/")))
(copy-recursively "doc/clojure" doc-dir) (copy-recursively "doc/clojure" doc-dir)
(copy-recursively "target/javadoc/"
(string-append doc-dir "javadoc/"))
(for-each (cut install-file <> doc-dir) (for-each (cut install-file <> doc-dir)
(filter (cut string-match (filter (cut string-match
".*\\.(html|markdown|md|txt)" ".*\\.(html|markdown|md|txt)"
<>) <>)
(scandir "./"))) (scandir "./")))
#t)))))) #t)))
(add-after 'install-doc 'install-javadoc
(install-javadoc "target/javadoc/")))))
(native-inputs libraries) (native-inputs libraries)
(home-page "https://clojure.org/") (home-page "https://clojure.org/")
(synopsis "Lisp dialect running on the JVM") (synopsis "Lisp dialect running on the JVM")