package dkml-dune-dsl
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=e15cffe625e826450bdc86593ef15e7a
sha512=bfb8ef843c3954fcc6fc70d4576c2a599bfb88d94bbed5887d38d8fb20b86f656c19acb3fa73c49c443376423166527a019900cfcee574f7fede54b04c82a491
Description
dkml-dune-dsl lets you define Dune files in OCaml code with your favorite auto-completing IDE, compile it to an executable, and use it as a generator of your dune.inc files.
Added to opam-repository:
README
dkml-dune-dsl
A mini-language (DSL) for Dune files embedded in OCaml that produces readable, valid Dune include files. The mini-language closely matches the structure of a regular Dune file, and because it is embedded in OCaml you get OCaml type-safety and the power of your favorite OCaml IDE as you write your Dune files.
The Dune DSL uses a tagless final design so your Dune DSL can be interpreted in a variety of ways that are independent of Dune itself. The standard dkml-dune-dsl-show interpreter allows all of the Dune string values (executable names, rule targets, etc.) to be parameterized from external JSON files. That lets you produce many similar executables, libraries or assets using the same Dune logic without repeating yourself DRY.
The documentation is at https://diskuv.github.io/dkml-dune-dsl/dkml-dune-dsl/index.html
Once installed (see the documentation) you will be able to write DSL expressions like:
open DkmlDuneDsl
module Build (I : Dune.SYM) = struct
open I
let res =
[
rule
[
target "{{{ name }}}.txt";
action
(with_stdout_to "%{target}"
(echo [ "{{{ age }}}" ]));
];
]
endthat are run over the parameters in a JSON file:
{
"param-sets": [
{"name": "batman", "age": 39},
{"name": "robin", "age": 24}
]
}You can do also do aggregation or, if you are really adventurous, define your own interpreter. Even if you don't use parameterization you get things you take for granted with OCaml: type-safety, auto-complete and let constants.
Examples and Testing
The examples are available in the examples/ folder. Since Dune is the authority on whether Dune DSL is producing correct output, each example includes a test that checks the output of Dune.
For now the process is when a new bug is found then an existing example is expanded or a new example created.
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building dkml-dune-dsl with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.1.4 (this version) | n/a | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure