def prepare_exclusives(self, context, key=None, classpath=None): # TODO(John Sirois): Push this prep up into a test helper - its too much detail to replicate # in tasks needing a classpath. exclusives_mapping = ExclusivesMapping(context) exclusives_mapping.set_base_classpath_for_group( key or '<none>', [('default', entry) for entry in classpath or ['none']]) exclusives_mapping._populate_target_maps(context.targets()) context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping)
def setUp(self): super(JvmdocGenTest, self).setUp() self.workdir = safe_mkdtemp() self.t1 = self.make_target('t1', exclusives={'foo': 'a'}) # Force exclusive propagation on the targets. self.t1.get_all_exclusives() context = self.context(target_roots=[self.t1], options=options) # Create the exclusives mapping. exclusives_mapping = ExclusivesMapping(context) exclusives_mapping._populate_target_maps(context.targets()) exclusives_mapping.set_base_classpath_for_group('foo=a', ['baz']) context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping) self.task = DummyJvmdocGen(context, self.workdir)
def populate_exclusive_groups(self, context, key=None, classpaths=None, target_predicate=None): """ Helps actual test cases to populate the "exclusives_groups" products data mapping in the context, which holds the classpath values for targets. :param context: The execution context where the products data mapping lives. :param key: key for list of classpaths in the "exclusives_groups" data mapping. None is the default value for most common cases. :param classpaths: a list of classpath strings. If not specified, ['none'] will be used. :param target_predicate: filter predicate for the context.targets(). For most common test cases, None value is good enough. """ exclusives_mapping = ExclusivesMapping(context) exclusives_mapping.set_base_classpath_for_group( key or '<none>', [('default', entry) for entry in classpaths or ['none']]) exclusives_mapping._populate_target_maps(context.targets(target_predicate)) context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping)
def populate_exclusive_groups(self, context, key=None, classpaths=None, target_predicate=None): """ Helps actual test cases to populate the "exclusives_groups" products data mapping in the context, which holds the classpath values for targets. :param context: The execution context where the products data mapping lives. :param key: key for list of classpaths in the "exclusives_groups" data mapping. None is the default value for most common cases. :param classpaths: a list of classpath strings. If not specified, ['none'] will be used. :param target_predicate: filter predicate for the context.targets(). For most common test cases, None value is good enough. """ exclusives_mapping = ExclusivesMapping(context) exclusives_mapping.set_base_classpath_for_group( key or '<none>', [('default', entry) for entry in classpaths or ['none']]) exclusives_mapping._populate_target_maps( context.targets(target_predicate)) context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping)