diff mbox series

[bug#57540,RFC,v2,02/19] gnu: Add ocaml-atd.* gnu/packages/ocaml.scm (ocaml-atd): New variable.

Message ID 87r10nvxuz.fsf@disroot.org
State Accepted
Headers show
Series None | expand

Commit Message

Garek Dyszel Sept. 7, 2022, 6:32 p.m. UTC
* gnu/packages/ocaml.scm (ocaml-atd): New variable.
---
 gnu/packages/ocaml.scm | 59 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index c4fa05b934..11b982519b 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -8870,3 +8870,62 @@  (define-public ocaml-elpi
 
 ELPI is free software released under the terms of LGPL 2.1 or above.")
     (license license:lgpl2.1)))
+
+;; NOTE: requires python-jsonschema with version at minimum 4.6.0 to run
+;; tests.
+;; See https://github.com/ahrefs/atd/issues/306 for more info on that.
+(define-public ocaml-atd
+  (package
+    (name "ocaml-atd")
+    (version "2.10.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ahrefs/atd")
+                    (commit version)
+                    (recursive? #t)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "10fgahdigrl01py0k0q2d6a60yps38q96dxhjnzm9jz4g931716l"))))
+    (build-system dune-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      ;; The dune-build-system does not run "make test" but
+                      ;; "dune runtest test --release".
+                      ;; This project, rather, needs us to run "make test".
+                      ;;
+                      ;; For this package (ocaml-atd), we DO NOT run all the
+                      ;; tests. The atd repository has resources for several
+                      ;; different interfaces (python, scala, etc), but we
+                      ;; don't need to run those tests if we are just
+                      ;; interested in the ocaml interface.
+                      ;; So we stick with just the ocaml tests here.
+                      (when tests?
+                        (invoke "make" "test-ocaml")))))))
+    (propagated-inputs (list ocaml-menhir
+                             ocaml-easy-format
+                             ocaml-odoc
+                             ocaml-re
+                             ocaml-camlp-streams
+                             ocaml-biniou
+                             ocaml-yojson
+                             ocaml-cmdliner))
+    (native-inputs (list ocaml-alcotest
+                         python
+                         python-pypa-build
+                         python-jsonschema-4.15
+                         python-flake8
+                         python-mypy
+                         python-pytest))
+    (home-page "https://github.com/ahrefs/atd")
+    (synopsis "Parser for the ATD data format description language")
+    (description
+     "ATD is the OCaml library providing a parser for the ATD language
+and various utilities.  ATD stands for Adjustable Type Definitions in
+reference to its main property of supporting annotations that allow a
+good fit with a variety of data formats.")
+    ;; Modified BSD license
+    (license (license:non-copyleft "LICENSE.md"))))