ancient-stone-50795
12/11/2015, 5:18 PM# TODO(Eric Ayers) Extract this logic for general use? When using unpacked_jars it is needed
# to get the correct source root for paths outside the current BUILD tree.
for target in gentargets:
for source in target.sources_relative_to_buildroot():
src_root = self.context.source_roots.find_by_path(source)
base = src_root.path if src_root else None
if not base:
base, _ = target.target_base, target.sources_relative_to_buildroot()
self.context.log.debug('Could not find source root for {source}. Fell back to {base}.'
.format(source=source, base=base))
if base not in sources_by_base:
sources_by_base[base] = OrderedSet()
sources_by_base[base].add(source)
return sources_by_base