Separate out the build command generation

Change-Id: I1b9f514947227eb73ec266ab06349826beaa694f