Saturday, January 7, 2012, utility for analysing android module dependency

There are thousands of modules within android system. They form a very complicated dependency graph. When we want to learn about a particular module in android system, it's not easy to find out where modules that are dependent on by the module we mainly focus on are located. To make this task easier, I wrote, which can be used to analysis dependency relationship between modules. It's capable of:
  1. List modules defined within a directory
  2. Generate a graphviz dot based diagram file to show dependency relationship
To show which modules are defined in a directory, we can use this command: " -l DIRECTORY_NAME". For example, if we run " -l external/protobuf/" command, we get below output:

To generate a dependency diagram for a particular module, we can use this command: " -o -m module_name". For example, if we're interested in the dependency diagram for charger module,  we can use this command: " -o -m charger". After the command finished, we have in current directory. Then we run "dot -Tpng -ooutput.png" to generate a png file for the diagram. And the diagram is shown below:

Each ellipse represents a module, the top line shows the module name, and the bottom line shows the directory that the module is defined. The arrowed edge represents the dependency relationship between two modules.