Skip to content

Adapt the tool to projects compiled with dune - #9

Merged
alainfrisch merged 2 commits into
LexiFi:masterfrom
krizex:dune
Mar 27, 2018
Merged

Adapt the tool to projects compiled with dune#9
alainfrisch merged 2 commits into
LexiFi:masterfrom
krizex:dune

Conversation

@krizex

@krizex krizex commented Mar 27, 2018

Copy link
Copy Markdown
Contributor

After compiling project with dune, it will generates the *.cmi/*.cmt files in a separate folder named .<name>.objs or .<name>.eobjs. Refer to: https://github.com/ocaml/dune/blob/master/src/utils.ml#L111 and https://github.com/ocaml/dune/blob/master/src/utils.ml#L116

For example:
When compiling https://github.com/xapi-project/xen-api project (Of course I haved added the flag -keep-locs and -bin-annot), the cmi and cmt files will be put into _build/default/ocaml/xapi/.xapi_internal.objs/ while the corresponding mli and ml files are in _build/default/ocaml/xapi.

So this patch aims to fix the search path when searching source files.

P.S. It also contains the fix of #8 as a separate small commit.

Signed-off-by: Yang Qian <yang.qian@citrix.com>
@alainfrisch

Copy link
Copy Markdown
Contributor

Thanks!

The project is used in a context where the Str library is not available. Would you be as kind as to replace the single use of it by a more manual string analysis?

When processing the artifacts in a dune project, the *.cmi and *.cmt files are
located in a separate folder named ".<name>.objs" or ".<name>.eobjs", so when
searching for source files, we should consider searching them in the upper level
folder in this case.

Signed-off-by: Yang Qian <yang.qian@citrix.com>
@krizex

krizex commented Mar 27, 2018

Copy link
Copy Markdown
Contributor Author

@alainfrisch Sure, changes updated.

  1. Remove the Str dependency
  2. Consider folder name both .<name>.objs and .<name>.eobjs
    Refer to dune code:
    https://github.com/ocaml/dune/blob/master/src/utils.ml#L111
    https://github.com/ocaml/dune/blob/master/src/utils.ml#L116

@alainfrisch

Copy link
Copy Markdown
Contributor

Thanks!

@alainfrisch
alainfrisch merged commit 3a29186 into LexiFi:master Mar 27, 2018
@krizex

krizex commented Mar 27, 2018

Copy link
Copy Markdown
Contributor Author

Thanks @alainfrisch . BTW, as the release on opam is quite out of date, do you have a plan to release a new version so that we can use this tool with compiler 4.04.x ?

@fantazio fantazio mentioned this pull request Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants