My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

day11/doc: remove build_hash_universe, use doc_dep_hashes consistently

The link phase and link DAG node construction now use doc_dep_hashes
(the wider set including {post} and x-extra-doc-deps) instead of
build_hash_universe (all packages in the same solution). This is more
precise — the link phase should only see dependencies it actually
needs for cross-referencing, not the entire solution.

Removes the build_hash_universe hashtable and universe_hashes parameter
from link_package and doc_all_package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+18 -51
+18 -51
day11/doc/generate.ml
··· 170 170 let link_package env benv ~os_dir ~driver_tool ~odoc_tools 171 171 ~build_hash_blessed ~find_odoc_tool ~compile_results 172 172 ~doc_dep_hashes 173 - ~build_hash ~universe_hashes 173 + ~build_hash 174 174 (node : build) = 175 175 match Hashtbl.find_opt compile_results build_hash with 176 176 | None -> None ··· 179 179 ~build_hash_blessed ~find_odoc_tool node with 180 180 | None -> None 181 181 | Some (composite_tool_hash, universe, blessed, _pkg_loc, mounts, prep_dir) -> 182 - (* Collect compile layer dirs from doc_deps (wider set) *) 182 + (* Collect compile layers from doc_deps (wider set, includes {post} 183 + and x-extra-doc-deps for cross-referencing) *) 183 184 let doc_dep_bhs = match Hashtbl.find_opt doc_dep_hashes build_hash with 184 185 | Some bhs -> bhs | None -> [] in 185 - let dep_compile_dirs = List.filter_map (fun bh -> 186 - match Hashtbl.find_opt compile_results bh with 187 - | Some bl -> Some (Build.dir ~os_dir bl) 188 - | None -> None 186 + let dep_compile_layers = List.filter_map (fun bh -> 187 + Hashtbl.find_opt compile_results bh 189 188 ) doc_dep_bhs in 189 + let dep_compile_dirs = List.map (Build.dir ~os_dir) dep_compile_layers in 190 + let dep_hashes = List.map (fun (bl : build) -> bl.hash) 191 + dep_compile_layers in 190 192 (* Also include own compile layer *) 191 193 let own_compile_dir = match Hashtbl.find_opt compile_results build_hash with 192 194 | Some bl -> [ Build.dir ~os_dir bl ] ··· 197 199 let html_mount = Day11_container.Mount.bind_rw 198 200 ~src:(Fpath.to_string html_base) 199 201 Odoc_store.container_html in 200 - let dep_compile_layers = 201 - List.filter_map (fun dep_bh -> 202 - if String.equal dep_bh build_hash then None 203 - else Hashtbl.find_opt compile_results dep_bh 204 - ) universe_hashes 205 - in 206 - let dep_hashes = List.map (fun (bl : build) -> bl.hash) 207 - dep_compile_layers in 208 202 let cmd = 209 203 "export PATH=/home/opam/doc-tools/bin:$PATH && eval $(opam env) && " ^ 210 204 Command.odoc_driver_voodoo ~pkg:node.pkg ~universe ··· 245 239 246 240 let doc_all_package env benv ~os_dir ~driver_tool ~odoc_tools 247 241 ~build_hash_blessed ~find_odoc_tool ~compile_results 248 - ~build_hash ~universe_hashes:_ 242 + ~build_hash 249 243 (node : build) = 250 244 match prepare_package ~os_dir ~driver_tool ~odoc_tools 251 245 ~build_hash_blessed ~find_odoc_tool node with ··· 480 474 Hashtbl.replace build_hash_blessed node.hash true 481 475 | _ -> () 482 476 ) nodes; 483 - (* Build hash -> universe of build hashes (for link/doc-all deps) *) 484 - let build_hash_universe : (string, string list) Hashtbl.t = 485 - Hashtbl.create 64 in 486 - List.iter (fun (_target, (result : Day11_solution.Solve_result.t)) -> 487 - let solution = result.build_deps in 488 - let compiler = find_compiler solution in 489 - let compiler_s = match compiler with 490 - | Some c -> OpamPackage.to_string c 491 - | None -> "" 492 - in 493 - let bh_list = OpamPackage.Map.fold (fun pkg _deps acc -> 494 - let pkg_s = OpamPackage.to_string pkg in 495 - match Hashtbl.find_opt pkg_compiler_to_hash (pkg_s, compiler_s) with 496 - | Some h -> h :: acc 497 - | None -> acc 498 - ) solution [] in 499 - List.iter (fun bh -> 500 - Hashtbl.replace build_hash_universe bh bh_list 501 - ) bh_list 502 - ) solutions; 503 477 (* Build doc DAG nodes. 504 478 For packages that DON'T need separate link: "doc-all" node 505 479 depends on build(A), tool finals, and compile/doc-all of deps ··· 567 541 Hashtbl.iter (fun build_hash _cn -> 568 542 let build_node = Hashtbl.find build_by_hash build_hash in 569 543 let dep_compile_layers = 570 - match Hashtbl.find_opt build_hash_universe build_hash with 571 - | None -> [] 572 - | Some universe_hashes -> 573 - List.filter_map (fun dep_bh -> 574 - match Hashtbl.find_opt compile_nodes dep_bh with 575 - | Some cn -> Some cn 576 - | None -> Hashtbl.find_opt doc_all_nodes dep_bh 577 - ) universe_hashes 544 + let dep_bhs = match Hashtbl.find_opt doc_dep_hashes build_hash with 545 + | Some bhs -> bhs | None -> [] in 546 + List.filter_map (fun dep_bh -> 547 + match Hashtbl.find_opt compile_nodes dep_bh with 548 + | Some cn -> Some cn 549 + | None -> Hashtbl.find_opt doc_all_nodes dep_bh 550 + ) dep_bhs 578 551 in 579 552 let own_compile = Hashtbl.find compile_nodes build_hash in 580 553 let odoc_tool = Option.get (find_odoc_tool_for_hash build_hash) in ··· 735 708 | Some build_hash -> 736 709 let build_node = Hashtbl.find build_by_hash build_hash in 737 710 current_build_hash := build_hash; 738 - let universe_hashes = 739 - match Hashtbl.find_opt build_hash_universe build_hash with 740 - | Some hs -> hs | None -> [] in 741 711 (match doc_all_package env benv ~os_dir ~driver_tool ~odoc_tools 742 712 ~build_hash_blessed ~find_odoc_tool ~compile_results 743 - ~build_hash ~universe_hashes 713 + ~build_hash 744 714 build_node with 745 715 | Some n -> 746 716 Atomic.incr doc_count; ··· 754 724 | Some build_hash -> 755 725 let build_node = Hashtbl.find build_by_hash build_hash in 756 726 current_build_hash := build_hash; 757 - let universe_hashes = 758 - match Hashtbl.find_opt build_hash_universe build_hash with 759 - | Some hs -> hs | None -> [] in 760 727 (match link_package env benv ~os_dir ~driver_tool ~odoc_tools 761 728 ~build_hash_blessed ~find_odoc_tool ~compile_results 762 729 ~doc_dep_hashes 763 - ~build_hash ~universe_hashes 730 + ~build_hash 764 731 build_node with 765 732 | Some n -> 766 733 Atomic.incr doc_count;