OCaml dune 如何设置最低依赖版本
dune 可以指定依赖,以及依赖的最低版本。最近我提交软件包到opam-repository的时候,就遇到了这个问题,因为默认持续集成CI,会强行降低版本到一个很老很老的库,没有我们需要的API,然后我们的构建一直失败。
直到我找到了正确的设置依赖版本,也就是编辑dune-project文件,里面写
(depends ocaml ( re (>= 1.10.4) ) dune)
完整的代码示例
(lang dune 3.3)
(name bsmi_ocaml)
(generate_opam_files true)
(source
(github infobsmi/bsmi_ocaml))
(authors "cnmade")
(maintainers "cnmade")
(license AGPL-3.0-only)
(documentation https://github.com/infobsmi/bsmi_ocaml/wiki)
(package
(name bsmi_ocaml)
(synopsis "Bsmi common ocaml library")
(description "Provided common tools deal with time,date, strings, html, filters.")
(depends ocaml ( re (>= 1.10.4) ) dune)
(tags
("tools")))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project
官方文档缺少示例,看文档,不知道它说的是什么意思,理解困难,所以这里我直接给大家准确的注释
关键点就在 (re (>= 1.10.4))
之前我是没写版本要求,所以我就写了个re
现在我们需要限制最低版本,所以我们用括号把这个re包容起来,然后在子语句里面,把这个版本范围限制一下。
分类: 默认 标签: 发布于: 2022-06-29 14:25:08, 更新于: 2022-06-29 14:25:08