Open ghost opened 4 years ago
I had noticed this error while running dune-deps on dune, but I quickly brushed it off, wrongly assuming that it was an intentionally broken test case :-p
The solutions you suggest look promising. Not sure what's best at the moment. To be continued.
I haven't added support for the real dune syntax, but I added a --exclude
or -x
option to work around it. :-p
Together with the new -h
option, we're getting something which looks usable.
The command to make the image above is:
$ cd dune # dune git repo
$ dune-deps -h dune -x test | tred | dot -Tpng > dune.png
Nice :)
BTW, I started working on a small separate library for parsing and editing dune files, in particular so that users can apply automatic transformations to dune files (cf https://github.com/ocaml/dune/issues/3337). It's not yet ready, but if you want to experiment with it, I'm happy to put it up.
I like the idea of relying on a dune-compatible S-expression library, rather than depending on dune as a whole. For the sake of maintenance, I like that dune-deps doesn't depend on a specific version of dune. I don't mind if certain things don't work perfectly, such as the exclusion of files using (dirs ...)
.
I'm happy to create a branch for testing the new parsing library. I'd need a public git URL and a build/install command.
Alright, so I got a first version there: https://github.com/diml/dune-files. make&make install
should do. A good entry point is Dune_files.Parser.load
.
The name is not great BTW, but I don't know how to call it. If you have some ideas, I'm interested :)
Looking good so far, thank you! I'll let you know how it goes.
I created a parsing
branch which works (as of commit ef75f53). You can try it out if you want. make && make test && make install
should work if you have dune-files
installed.
Regarding the name: dune-file
sounds better to me than the plural version. I'm not great with names in general, though.
I also have a couple questions which I'll post on the dune-files repo.
dune-file
seems better indeed, I'll remove the s
There are a few differences between the format of
dune
files and the s-expressions parsed by sexplib. As a result,dune-deps
cannot parse certain files. For instance, if I calldune-deps
on dune itself, I get:Eventually, we will probably extract a small stable library as we did for csexp and pp for parsing dune files. Another idea would be to rely on dune describe, which is meant precisely for this purpose: providing a stable interface for extracting information out of a dune project.