Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incremental build for Android Opensource Project

I am working with the Android Opensource Project. It's going well, except the build times. I only use AOSP on the emulator that comes with it, so I generally do

. build/environment.sh
lunch aosp_arm-eng
make -j4

after every modification to rebuild aosp.

Problem is, this appears to do a full rebuild of the entire AOSP, regardless of what has been built already or what I have modified. If I only make a tiny change in ART, it rebuilds everything, which takes hours.

Now my question is - how to avoid that? From what I understand, make should by itself figure out what it needs to rebuild and what not. Right?

Perhaps I shouldnt run lunch everytime? What else can I try/do?

Notes:

  • Ubuntu 16.04, gcc 5.4.0 (default), x64
  • Latest 7.x tag of Nougat (7.1.1)
  • I make changes the android runtime
  • ccache configured & running
like image 606
skipsilver Avatar asked Oct 18 '25 16:10

skipsilver


2 Answers

I think you need to enable ccache. For this run the following command

$ export USE_CCACHE=1
$ export CCACHE_DIR=/home/itc/.ccache  // this is the path of your ccache dir
$ prebuilts/misc/linux-x86/ccache/cache -M 50G  // this for allocate ccache size

After this you should run a clean build for the first time only. The next build with only consider your changed code and use prebuild

I you need a clean build you have to run

$ make clean
$ make clobber

If you need to change any file from core libs run

$ make installclean

Then as usual

$ . build/envsetup.sh && lunch aosp_arm-eng && make -j16 
like image 112
Godslave Avatar answered Oct 21 '25 05:10

Godslave


I assume that you make modifications in art folder. To build only art project, you should use the following set of commands (after the first build):

source build/envsetup.sh
lunch aosp_arm-eng
mmm art

This commands should recompile your changes (see http://elinux.org/Android_Build_System for details of the commands). However, so as all other applications and framework depends on the runtime environment it may happen that AOSP will require to recompile all dependencies after you've made changes to art. In this case, you will need to recompile them all (I faced with the same problems before with Dalvik, but I did not verify this with art).

like image 33
Yury Avatar answered Oct 21 '25 04:10

Yury



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!