-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
melange: interpret melc --where
as a list of :
-separated paths
#7176
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -466,12 +466,20 @@ module Unprocessed = struct | |
} as t) sctx ~dir ~more_src_dirs ~expander = | ||
let open Action_builder.O in | ||
let+ config = | ||
let* stdlib_dir = | ||
let* stdlib_dir, extra_obj_dirs = | ||
Action_builder.of_memo | ||
@@ | ||
match t.config.mode with | ||
| `Ocaml -> Memo.return (Some stdlib_dir) | ||
| `Melange -> Melange_binary.where sctx ~loc:None ~dir | ||
| `Ocaml -> Memo.return (Some stdlib_dir, []) | ||
| `Melange -> ( | ||
let open Memo.O in | ||
let+ dirs = Melange_binary.where sctx ~loc:None ~dir in | ||
match dirs with | ||
| [] -> (None, []) | ||
| [ stdlib_dir ] -> (Some (Path.external_ stdlib_dir), []) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we are converting to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #7176 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it to use |
||
| stdlib_dir :: extra_obj_dirs -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it a little weird that the first directory is being special cased? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, and it might not necessarily be the stdlib if we're not careful, I think that might not matter though? |
||
( Some (Path.external_ stdlib_dir) | ||
, List.map ~f:Path.external_ extra_obj_dirs )) | ||
in | ||
let* flags = flags | ||
and* src_dirs, obj_dirs = | ||
|
@@ -481,7 +489,10 @@ module Unprocessed = struct | |
let+ dirs = src_dirs sctx lib in | ||
(lib, dirs)) | ||
>>| List.fold_left | ||
~init:(Path.set_of_source_paths source_dirs, objs_dirs) | ||
~init: | ||
( Path.set_of_source_paths source_dirs | ||
, Path.Set.union objs_dirs (Path.Set.of_list extra_obj_dirs) | ||
) | ||
~f:(fun (src_dirs, obj_dirs) (lib, more_src_dirs) -> | ||
( Path.Set.union src_dirs more_src_dirs | ||
, let public_cmi_dir = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be more readable (imo) and consistent with code style above without
Option
functions: