Dependency Optimization

2 minute read

CloudBees Accelerator includes a dependency optimization feature to improve performance. By learning which dependencies are actually needed for a build, Accelerator can use that information to improve performance in subsequent builds.

When dependency optimization is enabled, eMake maintains a dependency information file for each makefile. If a build’s dependencies have not changed from its previous build, eMake can use that stored dependency information file for subsequent builds.

Enabling Dependency Optimization

You must first run a "learning" build with the dependency optimization feature enabled. To enable dependency optimization, set the following: --emake-optimize-deps=1

For the learning build, (because there is no stored dependency information file for that specific makefile) the argument only saves a new result. For subsequent builds, the argument enables the reuse of stored dependency information and saves a new file as appropriate. If you do not specify --emake-optimize-deps=1, then dependency information is not saved or accessed.

The following table describes dependency optimization-related options.

eMake Option Description

--emake-assetdir=< path >

Use the specified directory for assets such as saved dependency information. The default directory is named .emake. (This option also determines the cache locations for the parse avoidance feature and for JobCache.)

--emake-optimize-deps= < 0/1 >

Use the saved dependency information file for a makefile when dependencies are the same and save new dependency information when appropriate.

Dependency Optimization File Location and Naming

Dependency information files are saved in the working directory where eMake was invoked under <assetdir>/deps. (The default asset directory is .emake.) The file is named from the MD5 hash of the root-relative path of the "main" makefile for the make instance that the dependency information file belongs to. For example:

  • If your eMake root is /tmp/src, and your makefile is /tmp/src/Makefile, then the dependency information file is named after the MD5 hash of the string "Makefile".

  • If your root is /tmp/src and your makefile is /tmp/src/foo/Makefile, the file is named after the MD5 hash of the string "foo/Makefile".