1List Installed Files from Source Directories
2============================================
3
4`list_installed_file_from_source.py` helps users to list the vendor source
5files or vendor prebuilts that will be installed into the system image.
6
7This tool lists all *possible* file that *may* be installed to the system
8image.  Some listed files are not actually installed because they are not
9specified in `PRODUCT_PACKAGES`.
10
11
12## Usage
13
14First, build an Android target:
15
16```
17lunch aosp_sailfish-userdebug
18make -j8
19```
20
21Then, in `${ANDROID_BUILD_TOP}`, run `list_installed_file_from_source.py`:
22
23```
24./development/vndk/tools/sourcedr/sourcedr/list_installed_file_from_source.py \
25    out/combined-sailfish.ninja \
26    --ninja-deps out/.ninja_deps \
27    | tee files.txt
28```
29
30Be patient.  It may take for 3-5 mintues.
31
32
33## Re-use the Parsed Dependency Graph
34
35`list_installed_file_from_source.py` spends a lot of time parsing ninja
36files.  It is desirable to keep the parsed dependency graph for further
37investigation.  You can create a parsed dependency graph with:
38
39```
40./development/vndk/tools/sourcedr/sourcedr/ninja.py pickle \
41    out/combined-sailfish.ninja \
42    --ninja-deps out/.ninja_deps \
43    -o sailfish.pickle
44```
45
46And then, load dependency graph with:
47
48```
49./development/vndk/tools/sourcedr/sourcedr/list_installed_file_from_source.py \
50    sailfish.pickle
51```
52
53
54## Filters
55
56By default, `list_installed_file_from_source.py` lists the files that are from
57`device` or `vendor` directories and installed to the system partition.  This
58can be tweaked with `--installed-filter` and `--source-filter`:
59
60* `--installed-filter` filters the paths of the files that may be installed to
61  the device.  The specified path must be relative to the file system root of
62  the device.  The default value is `system`.
63
64* `--source-filter` filters the paths of the source files.  The paths must be
65  relative to Android source tree root (i.e. `${ANDROID_BUILD_TOP}`).  Multiple
66  paths may be specified and separated by semicolons.  The default value is
67  `device:vendor`.
68
69
70### Examples
71
72List the files from `device/google` and installed to `/system`:
73
74```
75./development/vndk/tools/sourcedr/sourcedr/list_installed_file_from_source.py \
76    sailfish.pickle \
77    --source-filter device/google \
78    --installed-filter system
79```
80
81
82List the files from `device/google` and installed into `/system/lib64` with:
83
84```
85./development/vndk/tools/sourcedr/sourcedr/list_installed_file_from_source.py \
86    sailfish.pickle \
87    --source-filter device/google \
88    --installed-filter system/lib64
89```
90
91
92List the files from `frameworks/base` or `frameworks/native` and installed
93into `/system/lib` or `/system/lib64` with:
94
95```
96./development/vndk/tools/sourcedr/sourcedr/list_installed_file_from_source.py \
97    sailfish.pickle \
98    --source-filter frameworks/base:frameworks/native \
99    --installed-filter system/lib:system/lib64
100```
101