Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option -dot-report-short to produce dot reports without installed deps #119

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ opam --version
opam --git-version

opam init
opam switch $OCAML_VERSION

opam switch create $OCAML_VERSION
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ env:
- OCAML_VERSION=4.04.0
- OCAML_VERSION=4.05.0
- OCAML_VERSION=4.06.1
- OCAML_VERSION=4.07.1
3 changes: 3 additions & 0 deletions tools/ocp-build/actions/buildActionMake.ml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ let arg_list =
"--dot-report", Arg.Set BuildGlobals.dot_report_arg,
" Create a DOT report in _obuild/_reports";

"--dot-report-short", Arg.Set BuildGlobals.dot_report_short_arg,
" Create a DOT report in _obuild/_reports without installed deps";

"--replay-script", Arg.Set BuildEngineReport.output_replay_script,
" Generates _obuild/_reports/build-replay.sh";

Expand Down
1 change: 1 addition & 0 deletions tools/ocp-build/buildGlobals.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ let autogen_arg = ref false
let list_ocp_files = ref false
let html_report_arg = ref false
let dot_report_arg = ref false
let dot_report_short_arg = ref false

let new_builder_context b = {
build_context = b;
Expand Down
26 changes: 15 additions & 11 deletions tools/ocp-build/ocaml/buildOCamlDotReport.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ open BuildValue.TYPES
open BuildOCPTypes
open Ocamldot.TYPES

let report_dir = "_obuild/_reports"
let report_dot = "project.dot"
let report_pdf = "project.pdf"

let report_dot = Filename.concat report_dir report_dot
let report_pdf = Filename.concat report_dir report_pdf

type node = {
node_name : string;
mutable node_requires : node StringMap.t;
Expand All @@ -26,7 +19,7 @@ type node = {
}


let report packages =
let report ~full_graph packages =

let nodes = ref StringMap.empty in
let add_node node_name =
Expand Down Expand Up @@ -110,8 +103,9 @@ let report packages =
(NodeColor "red"):: attrs
end in
let attrs = if n.node_exists then attrs else (NodeShape Diamond) :: attrs in
let node = Ocamldot.node t n.node_name attrs in
n.node_node <- Some node
if full_graph || not n.node_installed then
let node = Ocamldot.node t n.node_name attrs in
n.node_node <- Some node
) !nodes;

StringMap.iter (fun _ n ->
Expand All @@ -120,7 +114,8 @@ let report packages =
| Some node ->
StringMap.iter (fun _ n2 ->
match n2.node_node with
| None -> assert false
| None ->
assert (not full_graph && n2.node_installed)
| Some node2 ->
let _edge = Ocamldot.edge node node2 [] in
()
Expand Down Expand Up @@ -171,6 +166,15 @@ let report packages =
) !nodes;
*)

let report_dir = "_obuild/_reports" in

let report_dot, report_pdf =
if full_graph then "project.dot", "project.pdf"
else "project-short.dot", "project-short.pdf"
in
let report_dot = Filename.concat report_dir report_dot in
let report_pdf = Filename.concat report_dir report_pdf in

BuildMisc.safe_mkdir report_dir;
Ocamldot.save t report_dot;
let cmd = Printf.sprintf "dot -Tpdf %s -o %s" report_dot report_pdf in
Expand Down
1 change: 1 addition & 0 deletions tools/ocp-build/ocaml/buildOCamlDotReport.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
open OcpCompat

val report :
full_graph : bool ->
BuildOCamlTypes.ocaml_description StringMap.t -> unit
5 changes: 4 additions & 1 deletion tools/ocp-build/ocaml/buildOCamlVerifyPackages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ let verify_packages w state =
let packages = get_uniq_ocaml_packages w state in

if !BuildGlobals.dot_report_arg then
BuildOCamlDotReport.report packages;
BuildOCamlDotReport.report ~full_graph:true packages;

if !BuildGlobals.dot_report_short_arg then
BuildOCamlDotReport.report ~full_graph:false packages;

let packages = build_dependency_graph w packages in

Expand Down