def METHOD_NAME():
  deleted_sources = set()
  errors_by_file = defaultdict(lambda: defaultdict(set))
  with TemporaryDirectory() as tmp_dir:
    mb_script_path = os.path.join(SCRIPT_DIR, 'mb', 'mb.py')
    mb_config_file_path = os.path.join(SCRIPT_DIR, 'mb', 'mb_config.pyl')
    mb_gen_command = ([
        mb_script_path,
        'gen',
        tmp_dir,
        '--config-file',
        mb_config_file_path,
    ] + sys.argv[1:])
  mb_output = Run(mb_gen_command)
  errors = mb_output[0].split('ERROR')[1:]
  if mb_output[1]:
    print(mb_output[1])
    return 1
  for error in errors:
    error = error.split('\n')
    target_msg = 'The target:'
    if target_msg not in error:
      target_msg = 'It is not in any dependency of'
    if target_msg not in error:
      print('\n'.join(error))
      continue
    index = error.index(target_msg) + 1
    path, target = error[index].strip().split(':')
    if error[index + 1] in ('is including a file from the target:',
                            'The include file is in the target(s):'):
      dep = error[index + 2].strip()
      dep_path, dep = dep.split(':')
      dep = Rebase(path, dep_path, dep)
      # Replacing /target:target with /target
      dep = re.sub(r'/(\w+):(\1)$', r'/\1', dep)
      # Replacing target:target with target
      dep = re.sub(r'^(\w+):(\1)$', r'\1', dep)
      path = os.path.join(path[2:], 'BUILD.gn')
      errors_by_file[path][target].add(dep)
    elif error[index + 1] == 'has a source file:':
      deleted_file = '"' + os.path.basename(error[index + 2].strip()) + '",'
      deleted_sources.add(deleted_file)
    else:
      print('\n'.join(error))
      continue
  for path, missing_deps in list(errors_by_file.items()):
    FixErrors(path, missing_deps, deleted_sources)
  return 0