parameters: (build_file_path, packages, logger)
return_statement: return found_violations
docstring: Iterates oven all the targets of the given BUILD.gn file, and verifies that
    the source files referenced by it don't belong to any of it's subpackages.
    Returns True if a package boundary violation was found.
docstring_summary: Iterates oven all the targets of the given BUILD.gn file, and verifies that
    the source files referenced by it don't belong to any of it's subpackages.
    Returns True if a package boundary violation was found.
docstring_tokens: Iterates oven all the targets of the given BUILD . gn file and verifies that the source files referenced by it don t belong to any of it s subpackages . Returns True if a package boundary violation was found .
function: def _CheckBuildFile(build_file_path, packages, logger):
    """Iterates oven all the targets of the given BUILD.gn file, and verifies that
    the source files referenced by it don't belong to any of it's subpackages.
    Returns True if a package boundary violation was found.
    """
    found_violations = False
    package = os.path.dirname(build_file_path)
    subpackages_re = _BuildSubpackagesPattern(packages, package)
  
    build_file_contents = _ReadFileAndPrependLines(build_file_path)
    for target_match in TARGET_RE.finditer(build_file_contents):
      target_name = target_match.group('target_name')
      target_contents = target_match.group('target_contents')
      for sources_match in SOURCES_RE.finditer(target_contents):
        sources = sources_match.group('sources')
        for subpackages_match in subpackages_re.finditer(sources):
          subpackage = subpackages_match.group('subpackage')
          source_file = subpackages_match.group('source_file')
          line_number = subpackages_match.group('line_number')
          if subpackage:
            found_violations = True
            logger.Log(build_file_path, line_number, target_name, source_file,
                       subpackage)
  
    return found_violations
function_tokens: def _CheckBuildFile ( build_file_path , packages , logger ) : found_violations = False package = os . path . dirname ( build_file_path ) subpackages_re = _BuildSubpackagesPattern ( packages , package ) build_file_contents = _ReadFileAndPrependLines ( build_file_path ) for target_match in TARGET_RE . finditer ( build_file_contents ) : target_name = target_match . group ( 'target_name' ) target_contents = target_match . group ( 'target_contents' ) for sources_match in SOURCES_RE . finditer ( target_contents ) : sources = sources_match . group ( 'sources' ) for subpackages_match in subpackages_re . finditer ( sources ) : subpackage = subpackages_match . group ( 'subpackage' ) source_file = subpackages_match . group ( 'source_file' ) line_number = subpackages_match . group ( 'line_number' ) if subpackage : found_violations = True logger . Log ( build_file_path , line_number , target_name , source_file , subpackage ) return found_violations