Refactor cordova.buildPlatforms and cordova.runPlatforms