Questions tagged [ocaml-dune]

Use for questions relating to dune, previously jbuilder, a build system for [ocaml] and [reason]

Dune is a build system for and .

Resources

96 questions
3
votes
1 answer

dune utop some executable

For an single file executable, how can I load it in dune utop ? Precisely, on a project with a library in a directory lib and a corresponding dune file, I can launch dune utop lib then open Lib.MyModule and this will load the file MyModule.ml. What…
nicolas
  • 9,549
  • 3
  • 39
  • 83
3
votes
1 answer

Creating debug builds of Ocaml code with Jbuilder

I have been reading the tutorials for the Ocaml language and for Jbuilder. The official tutorial indicates that one must compile Ocaml code using the '-g' flag with ocamlc in order to then run ocamldebug. I cannot find any mention of debug builds…
Vishakh
  • 1,168
  • 1
  • 11
  • 20
2
votes
1 answer

Troubleshooting Compilation Error with lwt_ppx in OCaml: Unable to Compile File

I'm encountering an issue while using lwt_ppx and the let%lwt syntax as described in the CS3110 textbook's section on promises (https://cs3110.github.io/textbook/chapters/ds/promises.html). In the code snippet provided: open Lwt_io let p = …
abu fahad
  • 23
  • 3
2
votes
1 answer

Generating executable .ml test cases from a glob of plaintext files using dune

I'm in the process of writing a test suite for some lexing/parsing and it would be much cleaner if I could drop test input/output files in a directory and have dune generate OCaml test cases for each of these during a step in compilation. I figured…
s1gtrap
  • 162
  • 2
  • 10
2
votes
0 answers

How do I write a diff test that only runs with "dune test", not "dune build"?

Goal I want to write a test that runs as part of dune test but does not run as part of dune build (for example, because it is slow). This test should have an expected output file and compare the actual output to it, and dune promote should be able…
Scott McPeak
  • 8,803
  • 2
  • 40
  • 79
2
votes
1 answer

How do I include an OCaml module that is not called from the main module in an executable with dune?

I want to include a module in an OCaml program where the module is not directly called by the main (or any other) module, but rather does something during initialization. How do I do that with dune? It seems that dune only includes modules that…
Scott McPeak
  • 8,803
  • 2
  • 40
  • 79
2
votes
1 answer

Merlin on Emacs (GUI) does not get merlin's configuration provided by dune

First, please know that I am a beginner with Dune and project management in Ocaml. Nevertheless, I have installed Dune and created a new Dune-project which deals with camlimages library, graphics, etc. Project compilation and execution works well…
Glouton01
  • 21
  • 2
2
votes
0 answers

Is there a way with dune or opam to check that the installed ocaml compiler version is compliant with the specifications

I have a dune-project file that specifies that my ocaml compiler should be at least 4.05.0 I created a configure file to check that all I need is properly installed (using a mix of Unix.open_process_in "which " and dune external-lib-deps…
Lhooq
  • 4,281
  • 1
  • 18
  • 37
2
votes
0 answers

How do you run a single OCaml inline test with dune?

I'm trying to run a single inline test in OCaml, in a dune project. The only command I have is dune test which runs all the tests. I can't seem to find the command to run a single test.
David 天宇 Wong
  • 3,724
  • 4
  • 35
  • 47
2
votes
1 answer

generating OCaml documentation with dune

I'm in an internal package of my project and I ran dune build @doc. It does not complain and runs to completion. I then check the /_build/default directory and no _doc directory exists. Am I missing something?
David 天宇 Wong
  • 3,724
  • 4
  • 35
  • 47
2
votes
1 answer

Dune: build library and access it in another project and hide or make inaccessible private or implementation modules

I am using Dune for building OCaml projects and I'd like to build a standalone library for reusing it in other projects. The root folder of the library is mylib and the library was initialized with dune init lib mylib src (after cd mylib). The…
Oliver
  • 926
  • 2
  • 12
  • 31
2
votes
1 answer

odoc (documentation generator for OCaml) remove 'Stdlib' prefix

I'm using odoc, along with dune to generate documentation for a library. This is made by doing: dune build @doc However, this generates signatures like: val print : Stdlib.Format.formatter -> t -> unit While what i would like is: val print :…
ghilesZ
  • 1,502
  • 1
  • 18
  • 30
2
votes
1 answer

Can OCaml dune build a project that has a flat directory structure?

Suppose I want to use dune to build a project that has a flat directory structure: my_project/ ├── dune ├── basics.ml ├── basics.mli ├── utils.ml ├── utils.mli └── main.ml main.ml is the main program (the entry point). main.ml depends on utils.ml,…
Flux
  • 9,805
  • 5
  • 46
  • 92
2
votes
1 answer

OCaml and dune : Integrate small libraries in a larger library

I am developing a big library with dune. Let us call this library L. To avoid creating a big mess, the dune project has many smaller libraries : A, B, C, ... These libraries depend on each other. I would like the users to be able to opam install L,…
Anthony Scemama
  • 1,563
  • 12
  • 19
2
votes
1 answer

OCaml - Is it possible to define external (system) dependencies in dune?

I made an OCaml library that relies on an external/system package (namely libnauty2-dev). Since I would like my library to be installed via opam I looked for a way to specify the external lib as a dependency. So far I have found that .opam files can…
zajer
  • 649
  • 6
  • 17