Terra BOM

The keyword BOM( Bill of Materials) has not been a strange name for mobile developers recently, especially in Android development (Firebase BOM has been a prevalent example).
A BOM is explained as a blueprint for manufacturing a product that consists of materials, components... to create items. But in this article, we just use BOM as the dependency management. The BOM is special kind of software component which does not contain any sources and was mainly used to reference other libraries

Feature#

Terra BOM can help you to manage all library versions of the Terra platform easily by using only one version - The BOM version. All you need is to define the provided BOM version - the Terra BOM will choose an individual library version mapped to the BOM version. Therefore, we will take some advantage of it:

  • Terra team has provided some core libraries(Terra Core, Apollo...) that have been used in the whole Teko Mobile SDK teams and some services have depends on each other so BOM was build to ensure that every release of each library is compatible with others, you do not need to specify which version is compatible with another Terra library
  • When we upgrade Terra BOM features, these dependencies are upgraded as well in a consistent way.\

Usage#

In Android Approach, we use Java Platform Plugin to define a set of dependency constraints across the project. After determining the suitable BOM version, you can define Terra dependencies easily like this: 

dependencies {
implementation(platform("vn.teko.terra:terra-bom:1.0.0"))
//Auth
implementation("vn.teko.android.auth:auth-login")
implementation("vn.teko.android.auth:login-ui")
//Payment
implementation("vn.teko.android.payment:payment-core-v2")
implementation("vn.teko.android.payment:payment-ui")
implementation("vn.teko.android.payment:payment-kit")
}

Dependency Management#





Currently, the Terra team has been using a dynamic minor version to manage their dependencies to reduce many changes on each release, Terra BOM is therefore dynamic at minor version too. It means you will pull the latest version in a range of versions by default. Example:

constraints {
api("vn.teko.android.auth:login-ui:[1.4, 2.0)")
api("vn.teko.android.payment:payment-ui:[1.10, 2.0)")
}

Assume that login-ui had the latest version at v1.8 and in Terra BOM was define in a range from v1.4 to v2.0, so the BOM will decide to pull v1.8 for your project.

In case you do not want to get the latest version automatically, you can still specify a version and override the version recommended in BOM:

dependencies {
implementation(platform("vn.teko.terra:terra-bom:1.0.0"))
//Auth
// v0.01 is a version you want to override in BOM
implementation("vn.teko.android.auth:auth-login:0.01")
//Payment
implementation("vn.teko.android.payment:payment-core-v2")
implementation("vn.teko.android.payment:payment-ui")
}