Beispiel #1
0
    def setUp(self):
        super(GroupTaskTest, self).setUp()

        self.a = self.make_target('src/java:a', JavaLibrary)
        self.b = self.make_target('src/scala:b',
                                  ScalaLibrary,
                                  dependencies=[self.a])
        self.c = self.make_target('src/java:c',
                                  JavaLibrary,
                                  dependencies=[self.b])
        self.d = self.make_target('src/scala:d',
                                  ScalaLibrary,
                                  dependencies=[self.c])
        self.e = self.make_target('src/java:e',
                                  JavaLibrary,
                                  dependencies=[self.d])
        f = self.make_target('src/python:f', PythonLibrary)

        self._context = self.context(target_roots=[self.e, f])

        exclusives_mapping = ExclusivesMapping(self._context)
        exclusives_mapping._populate_target_maps(self._context.targets())
        self._context.products.safe_create_data('exclusives_groups',
                                                lambda: exclusives_mapping)

        self.recorded_actions = []
Beispiel #2
0
 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)
Beispiel #3
0
  def setUp(self):
    super(GroupTaskTest, self).setUp()

    self.a = self.make_target('src/java:a', JavaLibrary)
    self.b = self.make_target('src/scala:b', ScalaLibrary, dependencies=[self.a])
    self.c = self.make_target('src/java:c', JavaLibrary, dependencies=[self.b])
    self.d = self.make_target('src/scala:d', ScalaLibrary, dependencies=[self.c])
    self.e = self.make_target('src/java:e', JavaLibrary, dependencies=[self.d])
    f = self.make_target('src/python:f', PythonLibrary)

    self._context = self.context(target_roots=[self.e, f])

    exclusives_mapping = ExclusivesMapping(self._context)
    exclusives_mapping._populate_target_maps(self._context.targets())
    self._context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping)

    self.recorded_actions = []
Beispiel #4
0
  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)
Beispiel #5
0
  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)
Beispiel #6
0
  def setUp(self):
    super(BaseGroupTaskTest, self).setUp()
    self._context = self.context(target_roots=self.create_targets())

    exclusives_mapping = ExclusivesMapping(self._context)
    exclusives_mapping._populate_target_maps(self._context.targets())
    self._context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping)

    self.recorded_actions = []
    # NB: GroupTask has a cache of tasks by name... use a distinct name
    self.group_task = GroupTask.named('jvm-compile-%s' % uuid.uuid4().hex,
                                      ['classes_by_target', 'classes_by_source'])
    self.group_task.add_member(self.group_member('javac', lambda t: t.is_java))
    self.group_task.add_member(self.group_member('scalac', lambda t: t.is_scala))

    self.task = self.group_task(self._context, workdir='/not/real')
    self.task.prepare(round_manager=RoundManager(self._context))
    self.task.execute()
Beispiel #7
0
  def setUp(self):
    super(BaseGroupTaskTest, self).setUp()
    self._context = self.context(target_roots=self.create_targets())

    exclusives_mapping = ExclusivesMapping(self._context)
    exclusives_mapping._populate_target_maps(self._context.targets())
    self._context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping)

    self.recorded_actions = []
    # NB: GroupTask has a cache of tasks by name... use a distinct name
    self.group_task = GroupTask.named('jvm-compile-%s' % uuid.uuid4().hex,
                                      ['classes_by_target', 'classes_by_source'])
    self.group_task.add_member(self.group_member('javac', lambda t: t.is_java))
    self.group_task.add_member(self.group_member('scalac', lambda t: t.is_scala))

    self.task = self.group_task(self._context, workdir='/not/real')
    self.task.prepare(round_manager=RoundManager(self._context))
    self.task.execute()
Beispiel #8
0
  def setUp(self):
    super(JvmTaskTest, self).setUp()
    self.workdir = safe_mkdtemp()

    self.t1 = self.make_target('t1', exclusives={'foo': 'a'})
    self.t2 = self.make_target('t2', exclusives={'foo': 'a'})
    self.t3 = self.make_target('t3', exclusives={'foo': 'b'})
    # Force exclusive propagation on the targets.
    self.t1.get_all_exclusives()
    self.t2.get_all_exclusives()
    self.t3.get_all_exclusives()
    context = self.context(target_roots=[self.t1, self.t2, self.t3])

    # Create the exclusives mapping.
    exclusives_mapping = ExclusivesMapping(context)
    exclusives_mapping.add_conflict('foo', ['a', 'b'])
    exclusives_mapping._populate_target_maps(context.targets())
    context.products.safe_create_data('exclusives_groups', lambda: exclusives_mapping)

    self.task = DummyJvmTask(context, self.workdir)
Beispiel #9
0
    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)
Beispiel #10
0
    def setUp(self):
        super(JvmTaskTest, self).setUp()
        self.workdir = safe_mkdtemp()

        self.t1 = self.make_target('t1', exclusives={'foo': 'a'})
        self.t2 = self.make_target('t2', exclusives={'foo': 'a'})
        self.t3 = self.make_target('t3', exclusives={'foo': 'b'})
        # Force exclusive propagation on the targets.
        self.t1.get_all_exclusives()
        self.t2.get_all_exclusives()
        self.t3.get_all_exclusives()
        context = self.context(target_roots=[self.t1, self.t2, self.t3])

        # Create the exclusives mapping.
        exclusives_mapping = ExclusivesMapping(context)
        exclusives_mapping.add_conflict('foo', ['a', 'b'])
        exclusives_mapping._populate_target_maps(context.targets())
        context.products.safe_create_data('exclusives_groups',
                                          lambda: exclusives_mapping)

        self.task = DummyJvmTask(context, self.workdir)
Beispiel #11
0
    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)