.then(function(manifestJson) {
   var configXmlData = fs.readFileSync('config.xml', 'utf8');
   var analyzedManifest = ccaManifestLogic.analyseManifest(manifestJson);
   var configXmlDom = new xmldom.DOMParser().parseFromString(configXmlData);
   ccaManifestLogic.updateConfigXml(manifestJson, analyzedManifest, configXmlDom);
   configXmlData = new xmldom.XMLSerializer().serializeToString(configXmlDom);
   fs.writeFileSync('config.xml', configXmlData);
   return require('./write-out-cca-version')();
 })
  .then(function(manifestData) {
    pluginsToBeInstalled = manifestData.pluginsToBeInstalled.concat(['org.chromium.cca-hooks']);
    pluginsToBeNotInstalled = manifestData.pluginsToBeNotInstalled.concat();
    pluginsNotRecognized = manifestData.pluginsNotRecognized;
    whitelist = manifestData.whitelist;

    var configXmlData = fs.readFileSync('config.xml', 'utf8');
    var configXmlDom = new xmldom.DOMParser().parseFromString(configXmlData);
    ccaManifestLogic.updateConfigXml(manifest, manifestData, configXmlDom);
    var newConfigData = new xmldom.XMLSerializer().serializeToString(configXmlDom);
    // Don't write out if nothing actually changed
    if (newConfigData != configXmlData) {
      console.log('## Updating config.xml from manifest.json');
      fs.writeFileSync('config.xml', newConfigData);
    }
  })