feat(oxcaml): support parameter implementation#12392
Conversation
f7c52d8 to
08b368d
Compare
a9b566d to
dcb3793
Compare
|
Thanks for the fixes, @art-w! I'll let you take this from here :D IIUC, this is ready for review, so I will mark it as such. |
src/dune_rules/virtual_rules.ml
Outdated
| (Lib_name.to_string implements) | ||
| ]; | ||
| (match Lib_info.kind info with | ||
| | Parameter | Virtual -> () |
There was a problem hiding this comment.
The Parameter case should be "assert false" I believe
There was a problem hiding this comment.
Hm in the current implementation the Parameter case is useful, as a library that has an implements still get turned into a "vlib" which associates the library with the (virtual or parameter) lib it implements. I suppose we could avoid reusing parts of the virtual logic however, with a new sum type above. WDYT?
There was a problem hiding this comment.
I think it's confusing indeed then. Turning it into a sum type (or a record with a kind field) would clarify this.
There was a problem hiding this comment.
I pushed a refactoring of Virtual_rules to distinguish between the three implements possibilities: no implements, implementing a virtual module or implementing a parameter. I think virtual_rules.ml could be further renamed to implements.ml, if the name "virtual" has too much connotation? :)
rgrinberg
left a comment
There was a problem hiding this comment.
Just finished a round of review.
|
Thanks for the quick review! I've marked the simpler issues as resolved by the last commit, but I've left open the ones where I would appreciate your input :) |
| in | ||
| match argument with | ||
| | None -> [] | ||
| | Some parameter -> [ "-as-argument-for"; Module_name.to_string parameter ]) |
There was a problem hiding this comment.
Could you remind where we add a dependency on the cmi of the parameter? Is it added a library dependency somewhere?
There was a problem hiding this comment.
It looks like the dependency to the parameter is added by the pre-existing code for vlibs:
Lines 1025 to 1034 in 07d0a93
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
This version works only in the singleton case at it aggressively add the module implements to all the module. In the case of the singleton it will break. Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
This commit extends the support to find the root module from the library name which must always exists locally because we declare the implementation. Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <dev@maiste.fr> Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Etienne Marais <self@maiste.fr>
Signed-off-by: Shon Feder <shon.feder@gmail.com>
Signed-off-by: Shon Feder <shon.feder@gmail.com>
Signed-off-by: ArthurW <arthur@tarides.com>
Signed-off-by: ArthurW <arthur@tarides.com>
Signed-off-by: ArthurW <arthur@tarides.com>
Signed-off-by: ArthurW <arthur@tarides.com>
Signed-off-by: ArthurW <arthur@tarides.com>
3e40fdc to
c9fa595
Compare
| open Import | ||
| open Memo.O | ||
|
|
||
| let setup_copy_rules_for_impl ~sctx ~dir vimpl = |
There was a problem hiding this comment.
This was moved (unchanged) to Vimpl.setup_copy_rules: https://github.com/ocaml/dune/pull/12392/files#diff-654c4360f33ebd2b51644332b9d26dcf9d2e39b1a2125ae4bc9f6400a7cc412cR74
| "Library %s isn't virtual and cannot be implemented" | ||
| (Lib_name.to_string implements) | ||
| ]; | ||
| let+ vlib_modules, vlib_foreign_objects = |
There was a problem hiding this comment.
This was also moved (unchanged) to Vimpl.make: https://github.com/ocaml/dune/pull/12392/files#diff-654c4360f33ebd2b51644332b9d26dcf9d2e39b1a2125ae4bc9f6400a7cc412cR20
|
I think this is ready for another review :) . I had to move large chunks of code in the last commit to clarify the |
Closes #12085
Supersedes #12002
This PR is the second of a set of four PRs related to the introduction of Parameterized Libraries in Dune.
It contains multiples changes:
implementsfield.TODO
is_parametershould be removed (as per refactor: remove [Lib_info.is_parameter] #12298 (comment)).