tools/android/modularization/convenience/build_gn_editor.py
def replace_target(self, target: BuildTarget) -> None:
    """Replaces an existing target and returns True on success."""
    pattern = re.compile(fr'^\s*{target.get_type()}\(\"{target.get_name()}\"\)',
                         re.MULTILINE)
    match = pattern.search(self._content)
    if not match:
      raise BuildFileUpdateError(
          f'{target.get_type()}("{target.get_name()}") not found. '
          'Unable to replace.')

    start, end = _find_block(self._content, match.end(), '{', '}')
    if end <= start:
      raise BuildFileUpdateError(
          f'{target.get_type()}("{target.get_name()}") invalid. '
          'Unable to replace.')

    self._content = (self._content[:match.start()] + target.serialize() +
                     self._content[end + 1:])
Replaces an existing target and returns True on success.
Replaces an existing target and returns True on success.
Replaces an existing target and returns True on success .
def replace_target(self, target: BuildTarget) -> None:
    pattern = re.compile(fr'^\s*{target.get_type()}\(\"{target.get_name()}\"\)',
                         re.MULTILINE)
    match = pattern.search(self._content)
    if not match:
      raise BuildFileUpdateError(
          f'{target.get_type()}("{target.get_name()}") not found. '
          'Unable to replace.')
    start, end = _find_block(self._content, match.end(), '{', '}')
    if end <= start:
      raise BuildFileUpdateError(
          f'{target.get_type()}("{target.get_name()}") invalid. '
          'Unable to replace.')
    self._content = (self._content[:match.start()] + target.serialize() +
                     self._content[end + 1:])
def replace_target ( self , target : BuildTarget ) -> None : pattern = re . compile ( fr'^\s*{target.get_type()}\(\"{target.get_name()}\"\)' , re . MULTILINE ) match = pattern . search ( self . _content ) if not match : raise BuildFileUpdateError ( f'{target.get_type()}("{target.get_name()}") not found. ' 'Unable to replace.' ) start , end = _find_block ( self . _content , match . end ( ) , '{' , '}' ) if end <= start : raise BuildFileUpdateError ( f'{target.get_type()}("{target.get_name()}") invalid. ' 'Unable to replace.' ) self . _content = ( self . _content [ : match . start ( ) ] + target . serialize ( ) + self . _content [ end + 1 : ] )
Replaces an existing target and returns True on success.
Replaces an existing target and returns True on success .
"""Replaces an existing target and returns True on success."""
self
target
BuildTarget