Start to build small application code to native small application code.

@param {Object} buildConf the config to build
@param {boolean} clear whether clear the old build output before start build
@return {Promise}
function startBuild(buildConf, clear) {
    // init build manager
    let buildManager = BuildManager.create(buildConf.appType, buildConf);

    if (clear) {
        buildManager.clear();
    }

    startDevServer(buildConf, buildManager);
    let doneHandler = function () {
        startFileChangeMonitor(buildConf, buildManager);
    };

    // run build
    return runBuild(buildConf, buildManager).then(
        doneHandler,
        doneHandler
    );
}