• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright 2019 PDFium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6#
7# Generate a chart of dependencies and includes in "dot" format.
8# Invoke in pdfium/ top-level directory
9
10BUILD_DIR=out/Default
11
12function crunch {
13  echo '  edge [color=black,constraint=true]'
14  gn desc $BUILD_DIR $1 deps | grep -v '//:' | grep -v test | \
15      grep -v constants | grep -v samples | grep -v matches | \
16      sed "s|\\(.*\\)|  \"$1\" -> \"\\1\"|"
17  echo '  edge [color=red,constraint=false]'
18  gn desc $BUILD_DIR $1 allow_circular_includes_from | grep -v '//:' | \
19      grep -v test | grep -v samples | grep -v matches | \
20      grep -v 'how to display' | sed "s|\\(.*\\)|  \"\\1\" -> \"$1\"|"
21}
22
23TARGETS=`gn ls $BUILD_DIR | grep -v test | grep -v v8 | grep -v third_party | \
24             grep -v build | grep -v '//:'`
25
26echo 'digraph FRED {'
27echo '  node [shape=rectangle]'
28for TARGET in $TARGETS; do
29  crunch $TARGET
30done
31echo '}'
32