KBEA-00165 - Best Practices for Android Builds Using CloudBees Build Acceleration 10.1 and Newer Versions

Article ID:360032822972
3 minute readKnowledge base

This KB article applies to CloudBees Build Acceleration 10.1 and newer versions. For information about best practices for 10.0 and older versions, see KBEA-00130 - Best Practices for Android Builds Using CloudBees Build Acceleration 10.0 and Older Versions.

Overview

This article describes the best practices for running Android builds. It contains the following topics:

  • <<%E2%80%9CRecomAgentDeploySizing%E2%80%9D,Recommended Agent Deployment and Sizing>>

  • <<%E2%80%9CRAM_ForAgentHosts%E2%80%9D,Minimum RAM Requirements for Agent Hosts>>

  • <<%E2%80%9CRequiredPackages%E2%80%9D,Required Packages>>

  • <<%E2%80%9CeMakeOptionsForAndroid%E2%80%9D,eMake Options for Android Builds>>

  • <<%E2%80%9CNotes%E2%80%9D,Notes>>

  • <<%E2%80%9CSupportedVersions%E2%80%9D,Supported Versions>>

  • <<%E2%80%9CSeeAlso%E2%80%9D,See Also>>

For the fastest Android builds, you should have at least 16 Accelerator agents.

Minimum RAM Requirements for Agent Hosts

The minimum recommended total amount of RAM for an agent host is at least 2 GB per CloudBees Build Acceleration agent plus the amount of RAM normally needed by your build. For example, if you run four agents and your build normally needs 16 GB, you need ((2 * 4) + 16) = 24 GB.

Required Installed Packages

The patch utility is required. This is supplied by the Linux distribution in a package named patch on Ubuntu, Fedora, and Red Hat.

To install the package on Ubuntu, enter:

sudo apt-get install patch

To install the package on Fedora, log in as root and enter:

dnf install patch

To install the package on Red Hat, log in as root and enter:

yum install patch -`uname -r`

eMake Options for Android Builds

Using eMake for Android builds requires two eMake options, which you use to specify your Android version and your Android source file location. eMake uses these options to automatically configure the build for best performance and compatibility with Android:

--emake-android-version=

where is 7.0.0, 8.0.0, or 9.0.0

and

--emake-android-root=

where is the directory path to your source files.

What eMake Options Does --emake-android-version Set Automatically?

The --emake-android-version option sets many build-related command-line options such as parse avoidance and whether to ignore directory read conflicts ("readdir-conflicts"). eMake sets --emake-readdir-conflicts=1 in a learning build to ensure a comprehensive history. In non-learning builds, it is set to 0 for the best performance.

Following is the full list of options that it automatically sets:

--emake-assetdir=
--emake-history`=`
--emake-historyfile`=`
--emake-root`=`
--emake-readdir-conflicts`=``--emake-blind-create=1`
--emake-parse-avoidance=1
--emake-suppress-include=*.d
--emake-suppress-include=*.P
--emake-optimize-schedule=1
--emake-optimize-deps=1
--emake-jobcache=gcc,jack,javac
--emake-pragmafile=/emake.pragmas
--emake-parse-avoidance-ignore-env=EMAKE_DEBUG
--emake-parse-avoidance-ignore-env=EMAKEFLAGS
--emake-parse-avoidance-ignore-env=EMAKE_LICENSE_FILE
--emake-parse-avoidance-ignore-env=WRAPPER_BITS
--emake-parse-avoidance-ignore-env=WRAPPER_PID
--emake-parse-avoidance-ignore-env=XDG_SESSION_COOKIE
--emake-parse-avoidance-ignore-env=TMPDIR
--emake-parse-avoidance-ignore-env=TERM
--emake-parse-avoidance-ignore-env=EMAKE_READDIR_CONFLICTS
--emake-parse-avoidance-ignore-env=COMMANDER_WORKSPACE_WINDRIVE
--emake-parse-avoidance-ignore-env=COMMANDER_WORKSPACE_NAME
--emake-parse-avoidance-ignore-env=COMMANDER_WORKSPACE_UNIX
--emake-parse-avoidance-ignore-env=COMMANDER_WORKSPACE_WINUNC
--emake-parse-avoidance-ignore-env=COMMANDER_SESSIONID
--emake-parse-avoidance-ignore-env=COMMANDER_JOBSTEPID
--emake-parse-avoidance-ignore-env=COMMANDER_JOBID
--emake-parse-avoidance-ignore-env=PROMPT_COMMAND
--emake-autodepend=1

Except for the --emake-historyfile option, if you must specify other values for any of these options, you must place those options in the eMake command after the --emake-android-version option so that they are not overridden.

How eMake Detects and "Kickstarts" Android Learning Builds

eMake tries to determine if you lack a history file (if so, the build is a "learning" build). In this case, eMake creates a "kickstart" history file for your Android version to help reduce the build duration.

eMake uses the name that you set for your history file. It also sets --emake-history=create so that the new history from your learning build omits the kickstart history.

Using --emake-android-root for Builds That Do Not Start in the Android Source Root

A build might start with a top-level makefile other than the one belonging to Android. For example, if a makefile contains the following line:

# do some other stuff

#.......

now_build_android:

    **cd $(ANDROID_ROOT) \&\& $(MAKE)**

Then eMake would be unable to find the original files in the current directory of the top-level Make. To avoid this issue, you should always use the --emake-android-root eMake option to set the path to the Android source files.

Sample eMake Command for an Android Build

Following is an example eMake invocation that uses both Android-specific options:

emake --emake-android-version=9.0.0 --emake-android-root=../AndroidP  -f MyTopLevelMakefile.mk

Notes

As of the August 2019 preview release, the Accelerator Android integration supports Android builds that are invoked as components of another build.

Supported Versions

  • Accelerator 10.1

  • Android N, O, and P

See Also