Revert "Revert "Revert "Optimize the CM builds"""

This reverts commit efcf686ff76dc4cfdaab7b0bdf91d1eff0410b65

Change-Id: I61e589e3130b999e3a10a9a4db3baba31eaa621f