code: def process_remote_sources(self):
      
      unpacked_sources = self.context.products.get_data(UnpackedArchives)
      remote_sources_targets = self.context.targets(predicate=lambda t: isinstance(t, RemoteSources))
      if not remote_sources_targets:
        return
  
      snapshot_specs = []
      filespecs = []
      unpack_dirs = []
      for target in remote_sources_targets:
        unpacked_archive = unpacked_sources[target.sources_target]
        sources = unpacked_archive.found_files
        rel_unpack_dir = unpacked_archive.rel_unpack_dir
        self.context.log.debug('target: {}, rel_unpack_dir: {}, sources: {}'
                               .format(target, rel_unpack_dir, sources))
        sources_in_dir = tuple(os.path.join(rel_unpack_dir, source) for source in sources)
        snapshot_specs.append(PathGlobsAndRoot(
          PathGlobs(sources_in_dir),
          get_buildroot(),
        ))
        filespecs.append({'globs': sources_in_dir})
        unpack_dirs.append(rel_unpack_dir)
  
      snapshots = self.context._scheduler.capture_snapshots(tuple(snapshot_specs))
      for target, snapshot, filespec, rel_unpack_dir in \
        zip(remote_sources_targets, snapshots, filespecs, unpack_dirs):
        synthetic_target = self.context.add_new_target(
          address=Address(os.path.relpath(self.workdir, get_buildroot()), target.id),
          target_type=target.destination_target_type,
          dependencies=target.dependencies,
          sources=EagerFilesetWithSpec(rel_unpack_dir, filespec, snapshot),
          derived_from=target,
          **target.destination_target_args
        )
        self.context.log.debug('synthetic_target: {}'.format(synthetic_target))
        for dependent in self.context.build_graph.dependents_of(target.address):
          self.context.build_graph.inject_dependency(dependent, synthetic_target.address)
docs: Create synthetic targets with populated sources from remote_sources targets.