When developing an application, We most often follow the standard development life cycle pattern — development, testing, and production. For each of these stages, we have different API environments. For instance, when the app is in the development stage, it will communicate with olx.dev.api.com. Testing and production each have their respective API environments, too. Similarly when developing an application for different countries from a single source code, For each supported countries we need to take care of configuration, asset, etc. We at OLX Engineering team decided to utilize the knowledge of targets, schemes & configuration to improve the overall structure of developing an application considering multi-country support.
Today let us discuss how we at OLX manage, apps in multiple countries using the same codebase.
What was the requirement?
We needed to manage apps in multiple countries with one codebase, where we could even have a different set of features available as per country, or have different sets of configuration for the same.
How we did it?
We first used different targets for different countries, which used the same set of resources except for some configuration files which were different. This lead to problems such as whenever we needed to change something which was earlier common to all targets, multiple files had to be created in order to accommodate the changes, also increasing the build time as we had to compile the source code for each and every target.
What could be done to make it better?
We tried to further optimize our process thus coming up with a solution of using schemes for different countries, thus giving us the flexibility we were pushing for by having different configurations for different countries yet all running using the same codebase. So now even our build time was reduced as we didn’t have multiple targets to build but only one, which now could be resigned as per the configuration required for the country.
In order to appreciate what we are doing, we need to understand what are targets and schemes.