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