def BuildArtifactSourceTree(files, file_open=open):
  """Builds a dependency tree using from dependency mapping files.

  Args:
   files: A comma separated list of dependency mapping files.
   file_open: Reference to the builtin open function so it may be overridden for
     testing.

  Returns:
   A dict mapping build artifacts (possibly generated source files) to the
   corresponding direct dependent source files.
  """
  tree = dict()
  if not files:
    return tree
  for filename in files.split(','):
    with file_open(filename, 'r') as f:
      for line in f:
        entry = line.strip().split(':')[0]
        dep = line.strip().split(':')[1]
        if entry in tree:
          tree[entry].append(dep)
        else:
          tree[entry] = [dep]
  return tree