Example #1
0
 def console_output(self, targets):
   sources = self.get_passthru_args()
   if not sources:
     raise TaskError('No source was specified')
   elif len(sources) > 1:
     raise TaskError('Too many sources specified.')
   lazy_source_mapper = LazySourceMapper(self.context.address_mapper, self.context.build_graph)
   for source in sources:
     target_addresses_for_source = lazy_source_mapper.target_addresses_for_source(source)
     for address in target_addresses_for_source:
       yield address.spec
Example #2
0
 def console_output(self, targets):
     sources = self.get_passthru_args()
     if not sources:
         raise TaskError('No source was specified')
     elif len(sources) > 1:
         raise TaskError('Too many sources specified.')
     lazy_source_mapper = LazySourceMapper(self.context.address_mapper,
                                           self.context.build_graph)
     for source in sources:
         target_addresses_for_source = lazy_source_mapper.target_addresses_for_source(
             source)
         for address in target_addresses_for_source:
             yield address.spec
Example #3
0
 def console_output(self, targets):
   sources = self.get_passthru_args()
   if not sources:
     raise TaskError('No source was specified')
   lazy_source_mapper = LazySourceMapper(self.context.address_mapper, self.context.build_graph)
   owner_info = {}
   for source in sources:
     owner_info[source] = []
     target_addresses_for_source = lazy_source_mapper.target_addresses_for_source(source)
     for address in target_addresses_for_source:
       owner_info[source].append(address.spec)
   if self.get_options().output_format == 'json':
     yield json.dumps(owner_info, indent=4, separators=(',', ': '))
   else:
     if len(sources) > 1:
       raise TaskError('Too many sources specified for {} output format.'
                       .format(self.get_options().output_format))
     if owner_info.values():
       for address_spec in owner_info.values()[0]:
         yield address_spec
Example #4
0
 def console_output(self, targets):
   sources = self.get_passthru_args()
   if not sources:
     raise TaskError('No source was specified')
   lazy_source_mapper = LazySourceMapper(self.context.address_mapper, self.context.build_graph)
   owner_info = {}
   for source in sources:
     owner_info[source] = []
     target_addresses_for_source = lazy_source_mapper.target_addresses_for_source(source)
     for address in target_addresses_for_source:
       owner_info[source].append(address.spec)
   if self.get_options().output_format == 'json':
     yield json.dumps(owner_info, indent=4, separators=(',', ': '))
   else:
     if len(sources) > 1:
       raise TaskError('Too many sources specified for {} output format.'
                       .format(self.get_options().output_format))
     if owner_info.values():
       for address_spec in owner_info.values()[0]:
         yield address_spec
Example #5
0
 def execute(self):
   products = self.context.products
   source_to_addresses_mapper = LazySourceMapper(
     self.context.address_mapper,
     self.context.build_graph,
     stop_after_match=True,
   )
   for target in self.context.build_graph.targets():
     for source in target.sources_relative_to_buildroot():
       source_to_addresses_mapper._source_to_address[source].add(target.address)
   products.safe_create_data('source_to_addresses_mapper',
                             lambda: source_to_addresses_mapper)
 def set_mapper(self, fast=False):
     self._mapper = LazySourceMapper(self.address_mapper, self.build_graph,
                                     fast)