Android, Development Tools, Work

Android AOSP Build – Selective Repo Sync for faster synchronization

Lately, I wrote and customize a lot of android modules on AOSP – and somehow run lot of repo sync — all AOSP builder should know by now that it is super slow (even though I use custom beefy instance on GCP to compile my AOSP code)

Googling for solution e.g. StackOverflow only give recommendation to to a shallow clone by adding --depth 1 to repo init to make sure we shallow clone the repo and also to run sync as below

repo sync  -f --force-sync --no-clone-bundle --no-tags -j$(nproc --all)

But it still took around 1-hour to completely finish.

One Friggin Hour, specially on 98-99% part of the project

Now this may be obvious for some experienced AOSP builder that we can run selective sync on specific projects such as below:

repo sync {project-name} {project2-name}

Note that the project-name is the one listed on your manifest entry <project name="x".

But it’s dawning on me (as super inexperienced AOSP customizer) that we can also run selective sync for new project that we just added on main manifest or local manifests.

For example – I just add new project to my local manifests

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="common/drivers/amlogic" name="l9_amlogic_driver" remote="lumio" revision="master" groups="v11" />
</manifest>

Commit and push the local-manifest . Pull it on the compiling instance

cd .repo/local_manifests/
git pull origin main
cd ../..
repo sync l9_amlogic_driver
> remote: Total 0 (delta 0), reused 0 (delta 0)
> Fetching: 100% (1/1), done in 1.144s
> Garbage collecting: 100% (1/1), done in 0.004s
> repo sync has finished successfully.

So there you go, repo sync for selective project sync (new project or updated project)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.