function checkNonAutostartNonRemoteModules() {
  const errors = [];
  const gnVariable = 'generated_non_autostart_non_remote_modules';
  const lines = selectGNLines(`${gnVariable} = [`, ']');
  if (!lines.length) {
    return [
      'Could not identify non-autostart non-remote modules in gn file',
      'Please look at: ' + __filename,
    ];
  }
  const text = lines.join('\n');
  const modules = manifestModules.filter(m => m.type !== 'autostart' && m.type !== 'remote').map(m => m.name);

  const missingModules = modules.filter(m => !utils.includes(text, `${m}/${m}_module.js`));
  if (missingModules.length)
    errors.push(`Check that you've included [${missingModules.join(', ')}] modules in: ` + gnVariable);

  // e.g. "$resources_out_dir/audits/audits_module.js" => "audits"
  const mapLineToModuleName = line => line.split('/')[2].split('_module')[0];

  const extraneousModules = lines.map(mapLineToModuleName).filter(module => !utils.includes(modules, module));
  if (extraneousModules.length)
    errors.push(`Found extraneous modules [${extraneousModules.join(', ')}] in: ` + gnVariable);

  return errors;
}
/**
 * Ensures that generated module files are in the right list in BUILD.gn.
 * This is primarily to avoid remote modules from accidentally getting
 * bundled with the main Chrome binary.
 */
Ensures that generated module files are in the right list in BUILD.gn.
This is primarily to avoid remote modules from accidentally getting
bundled with the main Chrome binary.
Ensures that generated module files are in the right list in BUILD . gn . This is primarily to avoid remote modules from accidentally getting bundled with the main Chrome binary .
function checkNonAutostartNonRemoteModules() {
  const errors = [];
  const gnVariable = 'generated_non_autostart_non_remote_modules';
  const lines = selectGNLines(`${gnVariable} = [`, ']');
  if (!lines.length) {
    return [
      'Could not identify non-autostart non-remote modules in gn file',
      'Please look at: ' + __filename,
    ];
  }
  const text = lines.join('\n');
  const modules = manifestModules.filter(m => m.type !== 'autostart' && m.type !== 'remote').map(m => m.name);
  const missingModules = modules.filter(m => !utils.includes(text, `${m}/${m}_module.js`));
  if (missingModules.length)
    errors.push(`Check that you've included [${missingModules.join(', ')}] modules in: ` + gnVariable);
  const mapLineToModuleName = line => line.split('/')[2].split('_module')[0];
  const extraneousModules = lines.map(mapLineToModuleName).filter(module => !utils.includes(modules, module));
  if (extraneousModules.length)
    errors.push(`Found extraneous modules [${extraneousModules.join(', ')}] in: ` + gnVariable);
  return errors;
}
function checkNonAutostartNonRemoteModules ( ) { const errors = [ ] ; const gnVariable = 'generated_non_autostart_non_remote_modules' ; const lines = selectGNLines ( ` ${ gnVariable } ` , ']' ) ; if ( ! lines . length ) { return [ 'Could not identify non-autostart non-remote modules in gn file' , 'Please look at: ' + __filename , ] ; } const text = lines . join ( '\n' ) ; const modules = manifestModules . filter ( m => m . type !== 'autostart' && m . type !== 'remote' ) . map ( m => m . name ) ; const missingModules = modules . filter ( m => ! utils . includes ( text , ` ${ m } ${ m } ` ) ) ; if ( missingModules . length ) errors . push ( ` ${ missingModules . join ( ', ' ) } ` + gnVariable ) ; const mapLineToModuleName = line => line . split ( '/' ) [ 2 ] . split ( '_module' ) [ 0 ] ; const extraneousModules = lines . map ( mapLineToModuleName ) . filter ( module => ! utils . includes ( modules , module ) ) ; if ( extraneousModules . length ) errors . push ( ` ${ extraneousModules . join ( ', ' ) } ` + gnVariable ) ; return errors ; }
Ensures that generated module files are in the right list in BUILD.gn.
Ensures that generated module files are in the right list in BUILD . gn .
// e.g. "$resources_out_dir/audits/audits_module.js" => "audits"