@@ -42,30 +42,31 @@ let cmt_rule =
4242
4343 depend on (package) to get all files installed, e.g. json conf files
4444*)
45- let analyze_rule =
46- Sexplib.Sexp. of_string
45+ let analyze_rules =
46+ Sexplib.Sexp. of_string_many
4747 {|
4848 (rule
49- (enabled_if % {bin- available :lintcstubs})
5049 (targets % {log} % {sarif})
51- (deps compile_commands.json (:primitives) (:model) % {bin :lintcstubs} (package lintcstubs))
50+ (enabled_if % {bin- available :lintcstubs})
51+ (deps (:primitives) (:model) % {bin :lintcstubs} (package lintcstubs))
5252 (action
5353 (with - stdout- to % {log}
5454 (run % {bin :lintcstubs} -- conf lintcstubs.json - o % {sarif} - I % {ocaml_where} -- set dbg.solver- stats- interval 0 compile_commands.json % {model})
5555 )
5656 )
5757 )
58- | }
5958
60- let analyze_alias_rule =
61- Sexplib.Sexp. of_string
62- {|
59+ (rule
60+ (action (with - stdout- to compile_commands.json (echo [] )))
61+ (mode fallback)
62+ )
63+
6364 (rule
6465 (alias analyze)
65- (deps (: log) )
66+ (deps % { log} )
6667 (action (diff lintcstubs.out.reference % {deps}))
6768 )
68- | }
69+ | }
6970
7071let incgen_rule =
7172 Sexplib.Sexp. of_string_many
@@ -84,20 +85,9 @@ let incgen_rule =
8485
8586(rule
8687 (alias runtest)
87- (package lintcstubs)
8888 (enabled_if % {bin- available :lintcstubs})
8989 (action
9090 (diff dune.analysis.inc dune.analysis.inc.gen)))
91-
92- (rule
93- (target compile_commands.json)
94- (action
95- (pipe- stdout
96- (run dune rules)
97- (run % {bin :dune- compiledb})
98- )
99- )
100- )
10191| }
10292
10393let group_by_dirs paths =
@@ -163,18 +153,17 @@ let () =
163153 in
164154 let log_file = Fpath. (dir / " lintcstubs.log" ) in
165155 let sarif_file = Fpath. set_ext " .sarif" log_file in
166- let analyze_rule =
167- analyze_rule
168- |> apply_template' " %{log} " log_file
169- |> apply_template' " %{sarif} " sarif_file
170- |> apply_template " :primitives " [primitives_file]
171- |> apply_template " :model " ( Fpath.Set. to_seq model_files |> List. of_seq)
172- in
173- let analyze_alias_rule =
174- analyze_alias_rule |> apply_template " :log " [log_file]
156+ let analyze_rules =
157+ analyze_rules
158+ |> List. map @@ fun analyze_rule ->
159+ analyze_rule
160+ |> apply_template' " %{log} " log_file
161+ |> apply_template' " %{sarif} " sarif_file
162+ |> apply_template " :primitives " [primitives_file]
163+ |> apply_template " :model "
164+ ( Fpath.Set. to_seq model_files |> List. of_seq)
175165 in
166+ List. iter (Format. printf " %a@." Sexplib.Sexp. pp_hum) analyze_rules ;
176167 cmt_rules
177168 |> List. iter @@ fun cmt_rule ->
178- Format. printf " %a@." Sexplib.Sexp. pp_hum cmt_rule ;
179- Format. printf " %a@." Sexplib.Sexp. pp_hum analyze_rule ;
180- Format. printf " %a@." Sexplib.Sexp. pp_hum analyze_alias_rule
169+ Format. printf " %a@." Sexplib.Sexp. pp_hum cmt_rule
0 commit comments