This is intended as a discussion page for the question of supporting other build systems than Dune in Ocamlgrep.
Currently, Ocamlgrep supports only Dune projects. Supporting another build system would require:
- detecting the project root;
- listing the cmt files (typed ASTs) for the project, each corresponding to an ml file;
- listing the include dirs (which contain the cmi files) for each executable and library built by the project, as well as for the external libraries they depend on. This is used to detect type equivalences.
The actual source files are specified as part of a location record for each node of the AST found in the cmt file. This is why we don't need a list of source files, only the cmt file for each compilation unit (top-level module).
Ocamlgrep obtains this information from the output of dune describe workspace. This works regardless of the build status of the project, allowing us to report incomplete scans due to missing cmt files. To support another build system, we would need something similar.
This is intended as a discussion page for the question of supporting other build systems than Dune in Ocamlgrep.
Currently, Ocamlgrep supports only Dune projects. Supporting another build system would require:
The actual source files are specified as part of a location record for each node of the AST found in the cmt file. This is why we don't need a list of source files, only the cmt file for each compilation unit (top-level module).
Ocamlgrep obtains this information from the output of
dune describe workspace. This works regardless of the build status of the project, allowing us to report incomplete scans due to missing cmt files. To support another build system, we would need something similar.