<commit_before>
open Ocamlbuild_plugin;;
open Command;;

let ocamlify = A"ocamlify";;

rule "ocamlify: %.mlify.depends %.mlify -> %.ml"
  ~prod:"%.ml"
  ~deps:["%.mlify"; "%.mlify.depends"]
  begin 
    fun env build ->
      let depends = 
        env "%.mlify.depends"
      in
      let mlify = 
        env "%.mlify"
      in
      let ml =
        env "%.ml"
      in
      let depends_lst = 
        let deps = 
          ref []
        in
        let fd = 
          open_in depends
        in
          (
            try
              while true; do
                deps := (input_line fd) :: !deps
              done;
            with End_of_file ->
              ()
          );
          List.rev !deps
      in
      let () = 
        List.iter
          (function
             | Outcome.Good _ -> ()
             | Outcome.Bad exn -> raise exn
          ) 
          (build [depends_lst])
      in
      Cmd(S[ocamlify; 
            T(tags_of_pathname mlify++"ocamlify"++"compile");
            A"--output"; P(ml);
            P(mlify)])
  end
;;

rule "ocamlify: %.mlify -> %.mlify.depends"
  ~prod:"%.mlify.depends"
  ~dep:"%.mlify"
  begin
    fun env _ -> 
      Cmd(S[ocamlify; 
            T(tags_of_pathname (env "%.mlify")++"ocamlify"++"depends");
            A"--depends"; 
            A"--output"; P(env "%.mlify.depends"); 
            P(env "%.mlify");])
  end
;;<commit_msg>Fix build dependency of ocamlify file<commit_after>
open Ocamlbuild_plugin;;
open Command;;

let ocamlify = A"ocamlify";;

rule "ocamlify: %.mlify.depends %.mlify -> %.ml"
  ~prod:"%.ml"
  ~deps:["%.mlify"; "%.mlify.depends"]
  begin 
    fun env build ->
      let depends = 
        env "%.mlify.depends"
      in
      let mlify = 
        env "%.mlify"
      in
      let ml =
        env "%.ml"
      in
      let depends_lst = 
        let deps = 
          ref []
        in
        let fd = 
          open_in depends
        in
          (
            try
              while true; do
                deps := (input_line fd) :: !deps
              done;
            with End_of_file ->
              ()
          );
          List.rev !deps
      in
      let () = 
        List.iter 
          (fun fn ->
             List.iter
               (function
                  | Outcome.Good _ -> ()
                  | Outcome.Bad exn -> raise exn
               ) 
               (build [[fn]])
          )
          depends_lst
      in
      Cmd(S[ocamlify; 
            T(tags_of_pathname mlify++"ocamlify"++"compile");
            A"--output"; P(ml);
            P(mlify)])
  end
;;

rule "ocamlify: %.mlify -> %.mlify.depends"
  ~prod:"%.mlify.depends"
  ~dep:"%.mlify"
  begin
    fun env _ -> 
      Cmd(S[ocamlify; 
            T(tags_of_pathname (env "%.mlify")++"ocamlify"++"depends");
            A"--depends"; 
            A"--output"; P(env "%.mlify.depends"); 
            P(env "%.mlify");])
  end
;;
{'fraction_non_alphanumeric': 0.14412872304005478, 'fraction_numerical': 0.0, 'mean_word_length': 1.22883295194508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1495779', 'n_tokens_mistral': 1006, 'n_tokens_neox': 966, 'n_words': 205}