def _MapFileToMsBuildSourceType(source, rule_dependencies,
                                extension_to_rule_name):
  """Returns the group and element type of the source file.

  Arguments:
      source: The source file name.
      extension_to_rule_name: A dictionary mapping file extensions to rules.

  Returns:
      A pair of (group this file should be part of, the label of element)
  """
  _, ext = os.path.splitext(source)
  if ext in extension_to_rule_name:
    group = 'rule'
    element = extension_to_rule_name[ext]
  elif ext in ['.cc', '.cpp', '.c', '.cxx']:
    group = 'compile'
    element = 'ClCompile'
  elif ext in ['.h', '.hxx']:
    group = 'include'
    element = 'ClInclude'
  elif ext == '.rc':
    group = 'resource'
    element = 'ResourceCompile'
  elif ext == '.asm':
    group = 'masm'
    element = 'MASM'
  elif ext == '.idl':
    group = 'midl'
    element = 'Midl'
  elif source in rule_dependencies:
    group = 'rule_dependency'
    element = 'CustomBuild'
  else:
    group = 'none'
    element = 'None'
  return (group, element)
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/generator/msvs.py/_MapFileToMsBuildSourceType/original