ios/build/tools/convert_gn_xcodeproj.py
def GenerateSchemeForTarget(project, old_project, name, product_name, template):
  """Generates the .xcsheme file for target named |name|.

  The file is generated in the new project schemes directory from a template.
  If there is an existing previous project, then the old scheme file is copied
  and the lldbinit setting is set. If lldbinit setting is already correct, the
  file is not modified, just copied.
  """
  relative_path = os.path.join('xcshareddata', 'xcschemes', name + '.xcscheme')
  identifier = CreateIdentifier('%s %s' % (name, product_name))

  scheme_path = os.path.join(project, relative_path)
  if not os.path.isdir(os.path.dirname(scheme_path)):
    os.makedirs(os.path.dirname(scheme_path))

  old_scheme_path = os.path.join(old_project, relative_path)
  if os.path.exists(old_scheme_path):
    made_changes = False

    tree = xml.etree.ElementTree.parse(old_scheme_path)
    root = tree.getroot()

    for reference in root.findall('.//BuildableReference'):
      for (attr, value) in (
          ('BuildableName', product_name),
          ('BlueprintName', name),
          ('BlueprintIdentifier', identifier)):
        if reference.get(attr) != value:
          reference.set(attr, value)
          made_changes = True

    for child in root:
      if child.tag not in ('TestAction', 'LaunchAction'):
        continue

      if child.get('customLLDBInitFile') != LLDBINIT_PATH:
        child.set('customLLDBInitFile', LLDBINIT_PATH)
        made_changes = True

    if made_changes:
      tree.write(scheme_path, xml_declaration=True, encoding='UTF-8')

    else:
      shutil.copyfile(old_scheme_path, scheme_path)

  else:
    with open(scheme_path, 'w') as scheme_file:
      scheme_file.write(
          template.substitute(
              LLDBINIT_PATH=LLDBINIT_PATH,
              BLUEPRINT_IDENTIFIER=identifier,
              PRODUCT_NAME=product_name,
              TARGET_NAME=name))
Generates the .xcsheme file for target named |name|.

  The file is generated in the new project schemes directory from a template.
  If there is an existing previous project, then the old scheme file is copied
  and the lldbinit setting is set. If lldbinit setting is already correct, the
  file is not modified, just copied.
  
Generates the .xcsheme file for target named |name|.
The file is generated in the new project schemes directory from a template.
If there is an existing previous project, then the old scheme file is copied
and the lldbinit setting is set. If lldbinit setting is already correct, the
file is not modified, just copied.
Generates the . xcsheme file for target named |name| . The file is generated in the new project schemes directory from a template . If there is an existing previous project then the old scheme file is copied and the lldbinit setting is set . If lldbinit setting is already correct the file is not modified just copied .
def GenerateSchemeForTarget(project, old_project, name, product_name, template):
  relative_path = os.path.join('xcshareddata', 'xcschemes', name + '.xcscheme')
  identifier = CreateIdentifier('%s %s' % (name, product_name))
  scheme_path = os.path.join(project, relative_path)
  if not os.path.isdir(os.path.dirname(scheme_path)):
    os.makedirs(os.path.dirname(scheme_path))
  old_scheme_path = os.path.join(old_project, relative_path)
  if os.path.exists(old_scheme_path):
    made_changes = False
    tree = xml.etree.ElementTree.parse(old_scheme_path)
    root = tree.getroot()
    for reference in root.findall('.//BuildableReference'):
      for (attr, value) in (
          ('BuildableName', product_name),
          ('BlueprintName', name),
          ('BlueprintIdentifier', identifier)):
        if reference.get(attr) != value:
          reference.set(attr, value)
          made_changes = True
    for child in root:
      if child.tag not in ('TestAction', 'LaunchAction'):
        continue
      if child.get('customLLDBInitFile') != LLDBINIT_PATH:
        child.set('customLLDBInitFile', LLDBINIT_PATH)
        made_changes = True
    if made_changes:
      tree.write(scheme_path, xml_declaration=True, encoding='UTF-8')
    else:
      shutil.copyfile(old_scheme_path, scheme_path)
  else:
    with open(scheme_path, 'w') as scheme_file:
      scheme_file.write(
          template.substitute(
              LLDBINIT_PATH=LLDBINIT_PATH,
              BLUEPRINT_IDENTIFIER=identifier,
              PRODUCT_NAME=product_name,
              TARGET_NAME=name))
def GenerateSchemeForTarget ( project , old_project , name , product_name , template ) : relative_path = os . path . join ( 'xcshareddata' , 'xcschemes' , name + '.xcscheme' ) identifier = CreateIdentifier ( '%s %s' % ( name , product_name ) ) scheme_path = os . path . join ( project , relative_path ) if not os . path . isdir ( os . path . dirname ( scheme_path ) ) : os . makedirs ( os . path . dirname ( scheme_path ) ) old_scheme_path = os . path . join ( old_project , relative_path ) if os . path . exists ( old_scheme_path ) : made_changes = False tree = xml . etree . ElementTree . parse ( old_scheme_path ) root = tree . getroot ( ) for reference in root . findall ( './/BuildableReference' ) : for ( attr , value ) in ( ( 'BuildableName' , product_name ) , ( 'BlueprintName' , name ) , ( 'BlueprintIdentifier' , identifier ) ) : if reference . get ( attr ) != value : reference . set ( attr , value ) made_changes = True for child in root : if child . tag not in ( 'TestAction' , 'LaunchAction' ) : continue if child . get ( 'customLLDBInitFile' ) != LLDBINIT_PATH : child . set ( 'customLLDBInitFile' , LLDBINIT_PATH ) made_changes = True if made_changes : tree . write ( scheme_path , xml_declaration = True , encoding = 'UTF-8' ) else : shutil . copyfile ( old_scheme_path , scheme_path ) else : with open ( scheme_path , 'w' ) as scheme_file : scheme_file . write ( template . substitute ( LLDBINIT_PATH = LLDBINIT_PATH , BLUEPRINT_IDENTIFIER = identifier , PRODUCT_NAME = product_name , TARGET_NAME = name ) )
Generates the .xcsheme file for target named |name|.
Generates the . xcsheme file for target named |name| .
"""Generates the .xcsheme file for target named |name|.

  The file is generated in the new project schemes directory from a template.
  If there is an existing previous project, then the old scheme file is copied
  and the lldbinit setting is set. If lldbinit setting is already correct, the
  file is not modified, just copied.
  """
project
old_project
name
product_name
template