diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm index b28e2d4a40e..6b82c525366 100644 --- a/gnu/packages/clojure.scm +++ b/gnu/packages/clojure.scm @@ -36,50 +36,229 @@ #:use-module (guix build-system clojure) #:use-module (ice-9 match)) -(define-public clojure - (let* ((lib (lambda (prefix version hash) - (origin (method url-fetch) - (uri (string-append "https://github.com/clojure/" - prefix version ".tar.gz")) - (sha256 (base32 hash))))) - ;; The libraries below are needed to run the tests. - (libraries - `(("core-specs-alpha-src" - ,(lib "core.specs.alpha/archive/v" - "0.4.74" - "1hgl3222381349s4w5bnz02gghxfc8jjsqxhrvgadvn8ybh3dcsp")) - ("data-generators-src" - ,(lib "data.generators/archive/data.generators-" - "1.0.0" - "0s3hf1njvs68b8igasikvzagzqxl0gbri7w2qhzsypkhfh60v2cp")) - ("java-classpath-src" - ,(lib "java.classpath/archive/java.classpath-" - "1.0.0" - "178zajjsc9phk5l61r8w9hcpk0wgc9a811pl7kjgvn7rg4l7fh7j")) - ("spec-alpha-src" - ,(lib "spec.alpha/archive/v" - "0.5.238" - "0h15q9cmxaa7l2pqwwcykfyql8vbw6ns2a4lqfchik1mpfpr9jrb")) - ("test-check-src" - ,(lib "test.check/archive/v" - "1.1.1" - "0kx8l79mhpnn94rpsgc7nac7gb222g7a47mzrycj8crfc54wf0c1")) - ("test-generative-src" - ,(lib "test.generative/archive/v" - "1.1.0" - "0sm3q4jkcn06b3r0m0p29z159zqc8jk3k02yz92xwvdbnywaqnfz")) - ("tools-namespace-src" - ,(lib "tools.namespace/archive/tools.namespace-" - "1.0.0" - "1ifpk93m33rj2xm1qnnninlsdvm1liqmsp9igr63pjjwwwjw1cnn")) - ("tools-reader-src" - ,(lib "tools.reader/archive/tools.reader-" - "1.3.2" - "1n4dhg61iyypnjbxmihhqjb7lfpc0lzfvlk4jd8w0yr6za414f3a")))) - (library-names (match libraries - (((library-name _) ...) - library-name)))) +(define-public clojure-spec-alpha + (package + (name "clojure-spec-alpha") + (version "0.6.249") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/clojure/spec.alpha") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1rzy7mjzchsjpwkn3b5vg5hnmsj5h9ljxdjn48j92bgh7vl3k2r5")))) + (build-system clojure-build-system) + (arguments '(#:source-dirs '("src/main/clojure") + #:test-dirs '("src/test/clojure") + #:doc-dirs '())) + (native-inputs (list clojure-test-check)) + (synopsis + "Clojure library to describe the structure of data and functions") + (description + "This package can be used to validate data, conform (destructure) data, explain +invalid data, generate examples that conform to the specs, and automatically +use generative testing to test functions. +Clojure depends on this library and provides it. Thus it is not recommended +to add a direct dependency on this package.") + (home-page "https://github.com/clojure/spec.alpha") + (license license:epl1.0))) + +(define-public clojure-core-specs-alpha + (package + (name "clojure-core-specs-alpha") + (version "0.5.81") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/clojure/core.specs.alpha") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1hy060mb2hxirynkk36plx1rvpj6i2ldn8mvnwfd02wvjvh57dad")))) + (build-system clojure-build-system) + (arguments '(#:source-dirs '("src/main/clojure") + #:test-dirs '() + #:doc-dirs '())) + (synopsis "Describe clojure.core macros and functions") + (description + "This package contains specs to describe Clojure core macros and functions. + +Clojure depends on this library and provides it. Thus it is not recommended +to add a direct dependency on this package.") + (home-page "https://github.com/clojure/core.specs.alpha") + (license license:epl1.0))) + +(define-public clojure-java-classpath + (package + (name "clojure-java-classpath") + (version "1.1.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/clojure/java.classpath") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1k34yrx3gmvf46984zdgn2vb98ixf47q1vgh9p78bgmpyhrwzx2z")))) + (build-system clojure-build-system) + (arguments '(#:source-dirs '("src/main/clojure") + #:test-dirs '("src/test/clojure") + #:doc-dirs '())) + (synopsis "Examine the Java classpath from Clojure programs") + (description + "This package provides utilities for dealing with the JVM's classpath from +Clojure.") + (home-page "https://github.com/clojure/java.classpath") + (license license:epl1.0))) + +(define-public clojure-data-generators + (package + (name "clojure-data-generators") + (version "1.1.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/clojure/data.generators") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1ynazp55v15zv5jwz1wh2p8cawjcmn0bwzgfs2dwrp6aq231jafm")))) + (build-system clojure-build-system) + (arguments '(#:source-dirs '("src/main/clojure") + #:test-dirs '("src/test/clojure") + #:doc-dirs '())) + (synopsis "Generators for random Clojure data") + (description + "This package contains various functions to generate random clojure data.") + (home-page "https://github.com/clojure/data.generators") + (license license:epl1.0))) + +(define-public clojure-tools-namespace + (package + (name "clojure-tools-namespace") + (version "1.5.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/clojure/tools.namespace") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0j1lz3xnpgvyi0mcg9mjz7hrchf3hwhbhxi2163d739dxdx60s22")))) + (build-system clojure-build-system) + (arguments '(#:source-dirs '("src/main/clojure") + #:test-dirs '("src/test/clojure") + #:doc-dirs '())) + (propagated-inputs (list clojure-java-classpath + clojure-tools-reader)) + (synopsis "Tools for managing namespaces in Clojure") + (description + "This package parses ns declarations from source files, extract their +dependencies, build a graph of namespace dependencies within a project, update +that graph as files change, and reload files in the correct order. + +This is only about namespace dependencies within a single project. It has +nothing to do with Leiningen, Maven, JAR files, or repositories.") + (home-page "https://github.com/clojure/tools.namespace") + (license license:epl1.0))) + +(define-public clojure-test-generative + (package + (name "clojure-test-generative") + (version "1.1.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/clojure/test.generative") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0lb72cr4s6rgpg18v3jr67ps6wx4p7j7mfzwnfgmm0v8rldlcycf")))) + (build-system clojure-build-system) + (arguments '(#:source-dirs '("src/main/clojure") + #:test-dirs '("src/examples/clojure") + #:doc-dirs '())) + (propagated-inputs (list clojure-tools-namespace + clojure-data-generators)) + (synopsis "Generative test runner") + (description + "This package defines generators functions and property based testing macros.") + (home-page "https://github.com/clojure/test.generative") + (license license:epl1.0))) + +(define-public clojure-test-check + (package + (name "clojure-test-check") + (version "1.1.1") + (home-page "https://github.com/clojure/test.check") + (source (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "09jvlibnxhjv0l57y0sa7yy5in67gq4sssag77hv2d980mwdnls6")))) + (build-system clojure-build-system) + (arguments + '(#:source-dirs '("src/main/clojure") + #:test-dirs '("src/test/clojure") + #:doc-dirs '())) + (synopsis "QuickCheck for Clojure") + (description "@code{test.check} is a Clojure property-based testing tool +inspired by QuickCheck. The core idea of @code{test.check} is that instead of +enumerating expected input and output for unit tests, you write properties +about your function that should hold true for all inputs. This lets you write +concise, powerful tests.") + (license license:epl1.0))) + +(define-public clojure-tools-reader + (package + (name "clojure-tools-reader") + (version "1.5.0") + (home-page "https://github.com/clojure/tools.reader") + (source (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1jf05q4ym8z16qaxidx47g2gjv04qcf1wvkca3wqyiaszpvym4zz")))) + (build-system clojure-build-system) + (arguments + '(#:doc-dirs '() + #:source-dirs '("src/main/clojure") + #:test-dirs '("src/test/clojure") + #:test-exclude '(clojure.tools.common-tests))) ; Loaded by other tests. + (synopsis "Clojure reader written in Clojure") + (description "The clojure.tools.reader library offers all functionality +provided by the Clojure Core reader and more. It adds metadata such as column +and line numbers not only to lists, but also to symbols, vectors and maps.") + (license license:epl1.0))) + +(define (package-sources . packages) + (map package-source packages)) + +(define-public clojure + (let ((provided-libraries (package-sources clojure-core-specs-alpha + clojure-spec-alpha)) + (test-libraries (package-sources clojure-data-generators + clojure-java-classpath + clojure-test-check + clojure-test-generative + clojure-tools-namespace + clojure-tools-reader))) (package (name "clojure") (version "1.12.4") @@ -87,8 +266,8 @@ (origin (method git-fetch) (uri (git-reference - (url "https://github.com/clojure/clojure") - (commit name+version))) + (url "https://github.com/clojure/clojure") + (commit name+version))) (file-name (string-append name+version "-checkout")) (sha256 (base32 @@ -98,40 +277,28 @@ (arguments `(#:imported-modules ((guix build clojure-utils) (guix build clojure-build-system) - (guix build guile-build-system) ,@%ant-build-system-modules) #:modules ((guix build ant-build-system) ((guix build clojure-build-system) #:prefix clj:) (guix build clojure-utils) (guix build java-utils) (guix build utils) - (ice-9 match) - (ice-9 regex) (srfi srfi-26)) #:test-target "test" #:phases (modify-phases %standard-phases (add-after 'unpack 'unpack-library-sources (lambda* (#:key inputs #:allow-other-keys) - (define (extract-library name) - (mkdir-p name) - (with-directory-excursion name - (invoke "tar" - "--extract" - "--verbose" - "--file" (assoc-ref inputs name) - "--strip-components=1"))) - (for-each extract-library ',library-names) - (copy-recursively "core-specs-alpha-src/src/main/clojure" - "src/clj/") - (copy-recursively "spec-alpha-src/src/main/clojure" - "src/clj/") - #t)) + (define (extract-provided-library name) + (copy-recursively + (string-append (assoc-ref inputs name) "/src/main/clojure") + "src/clj/")) + (for-each extract-provided-library + ',(map origin-actual-file-name provided-libraries)))) (add-after 'unpack-library-sources 'fix-manifest-classpath (lambda _ (substitute* "build.xml" - (("") "")) - #t)) + (("") "")))) (add-after 'unpack-library-sources 'clojure-spec-skip-macros ;; Disable spec macro instrumentation when compiling clojure.spec ;; See: https://clojure.atlassian.net/browse/CLJ-2254 @@ -141,8 +308,7 @@ ,(string-join '("" "\n") - "\n"))) - #t)) + "\n"))))) (add-after 'unpack-library-sources 'clojure-spec-compile ;; Compile and include clojure.spec.alpha & clojure.core.specs.alpha (lambda _ @@ -153,20 +319,19 @@ "" "" "" - "")))) - #t)) + "")))))) (add-before 'build 'maven-classpath-properties - (lambda _ - (define (make-classpath libraries) - (string-join (map (lambda (library) - (string-append library "/src/main/clojure")) - libraries) ":")) - (with-output-to-file "maven-classpath.properties" - (lambda () - (let ((classpath (make-classpath ',library-names))) - (display (string-append "maven.compile.classpath=" classpath "\n")) - (display (string-append "maven.test.classpath=" classpath "\n"))))) - #t)) + (lambda* (#:key inputs #:allow-other-keys) + (define (source-dir library) + (string-append (assoc-ref inputs library) "/src/main/clojure")) + (let* ((libraries ',(map origin-actual-file-name test-libraries)) + (test-classpath (map source-dir libraries))) + (with-output-to-file "maven-classpath.properties" + (lambda _ + (display "maven.compile.classpath=\n") + (display (string-append "maven.test.classpath=" + (string-join test-classpath ":") + "\n"))))))) (add-before 'check 'fix-test-classpath ;; Some java test files need access to compiled classes. (lambda _ @@ -181,7 +346,7 @@ (install-javadoc "target/javadoc/")) (add-after 'reset-gzip-timestamps 'reset-class-timestamps clj:reset-class-timestamps)))) - (native-inputs libraries) + (native-inputs (append provided-libraries test-libraries)) (home-page "https://clojure.org/") (synopsis "Lisp dialect running on the JVM") (description "Clojure is a dynamic, general-purpose programming language, @@ -651,33 +816,6 @@ tree. (home-page "https://github.com/Engelberg/instaparse") (license license:epl1.0)))) -(define-public clojure-test-check - (package - (name "clojure-test-check") - (version "1.1.1") - (home-page "https://github.com/clojure/test.check") - (source (origin - (method git-fetch) - (uri (git-reference - (url home-page) - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "09jvlibnxhjv0l57y0sa7yy5in67gq4sssag77hv2d980mwdnls6")))) - (build-system clojure-build-system) - (arguments - '(#:source-dirs '("src/main/clojure") - #:test-dirs '("src/test/clojure") - #:doc-dirs '())) - (synopsis "QuickCheck for Clojure") - (description "@code{test.check} is a Clojure property-based testing tool -inspired by QuickCheck. The core idea of @code{test.check} is that instead of -enumerating expected input and output for unit tests, you write properties -about your function that should hold true for all inputs. This lets you write -concise, powerful tests.") - (license license:epl1.0))) - (define-public clojure-tools-analyzer (package (name "clojure-tools-analyzer") @@ -969,32 +1107,6 @@ implementation, selected at runtime when the clojure.tools.logging namespace is first loaded.") (license license:epl1.0))) -(define-public clojure-tools-reader - (package - (name "clojure-tools-reader") - (version "1.5.0") - (home-page "https://github.com/clojure/tools.reader") - (source (origin - (method git-fetch) - (uri (git-reference - (url home-page) - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1jf05q4ym8z16qaxidx47g2gjv04qcf1wvkca3wqyiaszpvym4zz")))) - (build-system clojure-build-system) - (arguments - '(#:doc-dirs '() - #:source-dirs '("src/main/clojure") - #:test-dirs '("src/test/clojure") - #:test-exclude '(clojure.tools.common-tests))) ; Loaded by other tests. - (synopsis "Clojure reader written in Clojure") - (description "The clojure.tools.reader library offers all functionality -provided by the Clojure Core reader and more. It adds metadata such as column -and line numbers not only to lists, but also to symbols, vectors and maps.") - (license license:epl1.0))) - (define-public http-kit (package (name "http-kit") @@ -1077,161 +1189,3 @@ an operation on the service. invoke takes a map and returns a map, and works the same way for every operation on every service.") (home-page "https://github.com/cognitect-labs/aws-api") (license license:asl2.0))) - -(define-public clojure-java-classpath - (package - (name "clojure-java-classpath") - (version "1.1.1") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/clojure/java.classpath") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1k34yrx3gmvf46984zdgn2vb98ixf47q1vgh9p78bgmpyhrwzx2z")))) - (build-system clojure-build-system) - (arguments '(#:source-dirs '("src/main/clojure") - #:test-dirs '("src/test/clojure") - #:doc-dirs '())) - (synopsis "Examine the Java classpath from Clojure programs") - (description - "This package provides utilities for dealing with the JVM's classpath from -Clojure.") - (home-page "https://github.com/clojure/java.classpath") - (license license:epl1.0))) - -(define-public clojure-spec-alpha - (package - (name "clojure-spec-alpha") - (version "0.6.249") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/clojure/spec.alpha") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1rzy7mjzchsjpwkn3b5vg5hnmsj5h9ljxdjn48j92bgh7vl3k2r5")))) - (build-system clojure-build-system) - (arguments '(#:source-dirs '("src/main/clojure") - #:test-dirs '("src/test/clojure") - #:doc-dirs '())) - (native-inputs (list clojure-test-check)) - (synopsis - "Clojure library to describe the structure of data and functions") - (description - "This package can be used to validate data, conform (destructure) data, explain -invalid data, generate examples that conform to the specs, and automatically -use generative testing to test functions. - -Clojure depends on this library and provides it. Thus it is not recommended -to add a direct dependency on this package.") - (home-page "https://github.com/clojure/spec.alpha") - (license license:epl1.0))) - -(define-public clojure-core-specs-alpha - (package - (name "clojure-core-specs-alpha") - (version "0.5.81") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/clojure/core.specs.alpha") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1hy060mb2hxirynkk36plx1rvpj6i2ldn8mvnwfd02wvjvh57dad")))) - (build-system clojure-build-system) - (arguments '(#:source-dirs '("src/main/clojure") - #:test-dirs '() - #:doc-dirs '())) - (synopsis "Describe clojure.core macros and functions") - (description - "This package contains specs to describe Clojure core macros and functions. - -Clojure depends on this library and provides it. Thus it is not recommended -to add a direct dependency on this package.") - (home-page "https://github.com/clojure/core.specs.alpha") - (license license:epl1.0))) - -(define-public clojure-data-generators - (package - (name "clojure-data-generators") - (version "1.1.1") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/clojure/data.generators") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1ynazp55v15zv5jwz1wh2p8cawjcmn0bwzgfs2dwrp6aq231jafm")))) - (build-system clojure-build-system) - (arguments '(#:source-dirs '("src/main/clojure") - #:test-dirs '("src/test/clojure") - #:doc-dirs '())) - (synopsis "Generators for random Clojure data") - (description - "This package contains various functions to generate random clojure data.") - (home-page "https://github.com/clojure/data.generators") - (license license:epl1.0))) - -(define-public clojure-tools-namespace - (package - (name "clojure-tools-namespace") - (version "1.5.1") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/clojure/tools.namespace") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0j1lz3xnpgvyi0mcg9mjz7hrchf3hwhbhxi2163d739dxdx60s22")))) - (build-system clojure-build-system) - (arguments '(#:source-dirs '("src/main/clojure") - #:test-dirs '("src/test/clojure") - #:doc-dirs '())) - (propagated-inputs (list clojure-java-classpath - clojure-tools-reader)) - (synopsis "Tools for managing namespaces in Clojure") - (description - "This package parses ns declarations from source files, extract their -dependencies, build a graph of namespace dependencies within a project, update -that graph as files change, and reload files in the correct order. - -This is only about namespace dependencies within a single project. It has -nothing to do with Leiningen, Maven, JAR files, or repositories.") - (home-page "https://github.com/clojure/tools.namespace") - (license license:epl1.0))) - -(define-public clojure-test-generative - (package - (name "clojure-test-generative") - (version "1.1.1") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/clojure/test.generative") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0lb72cr4s6rgpg18v3jr67ps6wx4p7j7mfzwnfgmm0v8rldlcycf")))) - (build-system clojure-build-system) - (arguments '(#:source-dirs '("src/main/clojure") - #:test-dirs '("src/examples/clojure") - #:doc-dirs '())) - (propagated-inputs (list clojure-tools-namespace - clojure-data-generators)) - (synopsis "Generative test runner") - (description - "This package defines generators functions and property based testing macros.") - (home-page "https://github.com/clojure/test.generative") - (license license:epl1.0)))