AOSP Android build project

Note

TL;DR - How to configure a Jenkins multi-configuration project for AOSP (Android Open Source Project) builds — combining the repo plugin for multi-repository management with the matrix plugin for build variant handling (e.g., userdebug vs. eng, different devices). - Uses custom child workspaces and build variant-aware output directories.

Android is multi-configuration Jenkins project. We need to combine repo plugin with matrix plugin.

../../../_images/android_aosp_pipeline.png

Important options are:

  • Use custom child workspace in Advanced Project Options

  • Definition of the correct repo manifest as shown in the follow picture

  • Definition of build matrix in order to have the output of all the artifacts

../../../_images/android_aosp_pipeline_2.png

Execution shell needs to take in account the variant for clean the project and for the output directory.

#!/bin/bash -xe

OUT_DIR=out_$BuildVariant
export OUT_DIR

source build/envsetup.sh
lunch rtc700m-$BuildVariant

make clean

# export WITHOUT_HOST_CLANG=true
CPUS=$(getconf _NPROCESSORS_ONLN)
echo "Build on " $CPUS " cores machine"
make -j $CPUS

Tip

Need automated AOSP builds in your CI/CD pipeline? Amarula Solutions sets up multi-configuration Jenkins projects for Android OS development with repo management, matrix builds, and artifact deployment. Contact our Android CI team