Skip to content

Commit

Permalink
refactor: lib_rules clean up (#11390)
Browse files Browse the repository at this point in the history
Remove duplicate flag handling code

Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored Jan 25, 2025
1 parent f5984c7 commit 5a0c4da
Show file tree
Hide file tree
Showing 2 changed files with 222 additions and 224 deletions.
21 changes: 11 additions & 10 deletions src/dune_rules/gen_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ end = struct
{ (with_cctx_merlin ~loc:exes.buildable.loc cctx_merlin) with
js =
Some
(List.concat_map (Nonempty_list.to_list exes.names) ~f:(fun (_, exe) ->
(Nonempty_list.to_list exes.names
|> List.concat_map ~f:(fun (_, exe) ->
List.map Js_of_ocaml.Mode.all ~f:(fun mode ->
Path.Build.relative dir (exe ^ Js_of_ocaml.Ext.exe ~mode))))
})
Expand All @@ -150,15 +151,15 @@ end = struct
| Copy_files.T { files = glob; _ } ->
let+ source_dirs =
let+ src_glob = Expander.No_deps.expand_str expander glob in
if Filename.is_relative src_glob
then (
match
let error_loc = String_with_vars.loc glob in
Path.relative (Path.source src_dir) src_glob ~error_loc
with
| In_source_tree s -> Some (Path.Source.parent_exn s)
| In_build_dir _ | External _ -> None)
else None
match Filename.is_relative src_glob with
| false -> None
| true ->
(match
let error_loc = String_with_vars.loc glob in
Path.relative (Path.source src_dir) src_glob ~error_loc
with
| In_source_tree s -> Some (Path.Source.parent_exn s)
| In_build_dir _ | External _ -> None)
in
{ empty_none with source_dirs }
| Install_conf.T i ->
Expand Down
Loading

0 comments on commit 5a0c4da

Please sign in to comment.