Search code examples
androidcompilationandroid-sourcecyanogenmodccache

What happens if compiling AOSP/CM is interrupted


I have two guesses:

It compiled from the start, but uses CCACHE to go much quicker

It continues, by detecting which modules have been compiled

What would happen if I clear the CCACHE but not the OUT directory? Would it continue or restart?


Solution

  • There are multiple layers that matter here.

    • At the top-level, you have (at least that's my impression from briefly looking at the build system) a make-system (or something similar). Make builds specific 'targets' by invoking commands. If a target already exists and is up-to-date (the source files on which it is based are not newer than the created target), make will not invoke any commands
    • One command make can invoke is a compile command (optionally prefixed with 'ccache'). If the command, prefixed with ccache, is called, ccache will check its cache directory to see if there's anything it can reuse. If something's available, ccache will simply copy a file from its cache to the desired location. If nothing's available, ccache will invoke the compiler command (and fill its cache with the result afterwards).

    If you clear the ccache cache directory, it means the make 'targets' still exist and are up-to-date. This means make will decide no recompilation is needed for those targets. In other words: it will continue, not restart. Ccache doesn't even come into the picture yet at this point.