parameters: (target_list, target_dicts, toplevel_dir)
docstring: Generates a sequence of all likely java package root directories.
docstring_summary: Generates a sequence of all likely java package root directories.
docstring_tokens: Generates a sequence of all likely java package root directories .
function: def GetJavaSourceDirs(target_list, target_dicts, toplevel_dir):
    '''Generates a sequence of all likely java package root directories.'''
    for target_name in target_list:
      target = target_dicts[target_name]
      for action in target.get('actions', []):
        for input_ in action['inputs']:
          if (os.path.splitext(input_)[1] == '.java' and
              not input_.startswith('$')):
            dir_ = os.path.dirname(os.path.join(os.path.dirname(target_name),
                                                input_))
            # If there is a parent 'src' or 'java' folder, navigate up to it -
            # these are canonical package root names in Chromium.  This will
            # break if 'src' or 'java' exists in the package structure. This
            # could be further improved by inspecting the java file for the
            # package name if this proves to be too fragile in practice.
            parent_search = dir_
            while os.path.basename(parent_search) not in ['src', 'java']:
              parent_search, _ = os.path.split(parent_search)
              if not parent_search or parent_search == toplevel_dir:
                # Didn't find a known root, just return the original path
                yield dir_
                break
            else:
              yield parent_search
function_tokens: def GetJavaSourceDirs ( target_list , target_dicts , toplevel_dir ) : for target_name in target_list : target = target_dicts [ target_name ] for action in target . get ( 'actions' , [ ] ) : for input_ in action [ 'inputs' ] : if ( os . path . splitext ( input_ ) [ 1 ] == '.java' and not input_ . startswith ( '$' ) ) : dir_ = os . path . dirname ( os . path . join ( os . path . dirname ( target_name ) , input_ ) ) # If there is a parent 'src' or 'java' folder, navigate up to it - # these are canonical package root names in Chromium.  This will # break if 'src' or 'java' exists in the package structure. This # could be further improved by inspecting the java file for the # package name if this proves to be too fragile in practice. parent_search = dir_ while os . path . basename ( parent_search ) not in [ 'src' , 'java' ] : parent_search , _ = os . path . split ( parent_search ) if not parent_search or parent_search == toplevel_dir : # Didn't find a known root, just return the original path yield dir_ break else : yield parent_search