2013年10月12日 星期六

[AOSP] ninja build system design

Build system performs 3 main tasks
  1. load and analyze build goals
  2. figure out what steps need to run
  3. execute those steps

Optimization

Use GYP save intermediate state for ninja to load when it generate ninja build files. It can reduce ninja load time.

Use lookup table to check input character which can reduce parsing time.

In order to represent file dependency of nodes and graph which make checking  Canonicalize file path and map the name to an internal Node object which can reduce file name comparison.

Use build log to check whether it should rebuild the command since we can see whether different compilation flags.

When compiler compile the file, it knows what header files the file needs. Record the compiler to output dependent header files can reduce "header scanner" time. Of course first time build need to compile all files since there is no record files. (file name should be canonicalize before output)

Alternative design

ninja run as memory-resident daemon which monitor file modification and avoid load/write data time between build.

Reference
http://aosabook.org/en/posa/ninja.html




沒有留言:

張貼留言