Skip to content

Commit

Permalink
Merge pull request #15518 from MinaProtocol/georgeee/simplify-src-con…
Browse files Browse the repository at this point in the history
…fig-dune

Simplify `src/config/dune`, `dune` files
  • Loading branch information
georgeee authored Apr 15, 2024
2 parents 0ae51e3 + d53eb2d commit 10465f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 27 deletions.
6 changes: 4 additions & 2 deletions dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(rule
(targets graphql_schema.json)
(target graphql_schema.json)
(mode promote)
(action (with-stdout-to graphql_schema.json (run %{exe:src/app/graphql_schema_dump/graphql_schema_dump.exe}))))
(deps
(:< src/app/graphql_schema_dump/graphql_schema_dump.exe))
(action (with-stdout-to %{target} (run %{<}))))
30 changes: 5 additions & 25 deletions src/config/dune
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
(* -*- tuareg -*- *)

let rec find_all_files ~banlist_exts dirname basename =
let ext =
try String.split_on_char '.' basename |> List.rev |> List.hd with _ -> ""
in
if List.exists (String.equal ext) banlist_exts then []
else
let fullname = Filename.concat dirname basename in
if Sys.is_directory fullname then
Sys.readdir fullname |> Array.to_list
|> List.map (find_all_files ~banlist_exts fullname)
|> List.concat
else [fullname]

let () =
let config_deps =
find_all_files ~banlist_exts:["un~"] "." "" |> String.concat " "
in
Jbuild_plugin.V1.send
@@ "(rule\n\
\ (targets config.mlh)\n\
\ (mode fallback)\n\
\ (deps %{profile}.mlh " ^ config_deps ^ ")\n
\ (action (copy %{profile}.mlh config.mlh)))"
(rule
(targets config.mlh)
(mode fallback)
(deps (source_tree .))
(action (copy %{profile}.mlh config.mlh)))

0 comments on commit 10465f5

Please sign in to comment.