예제 #1
0
 def classname_for_classfile(self, target, classpath_products):
   contents = ClasspathUtil.classpath_contents((target,), classpath_products)
   for f in contents:
     classname = ClasspathUtil.classname_for_rel_classfile(f)
     # None for non `.class` files
     if classname:
       yield classname
예제 #2
0
 def classname_for_classfile(self, target, classpath_products):
     contents = ClasspathUtil.classpath_contents((target, ),
                                                 classpath_products)
     for f in contents:
         classname = ClasspathUtil.classname_for_rel_classfile(f)
         # None for non `.class` files
         if classname:
             yield classname
예제 #3
0
 def _classnames_from_source_file(self, context):
   source_products = context.products.get_data('classes_by_source').get(self._sourcefile)
   if not source_products:
     # It's valid - if questionable - to have a source file with no classes when, for
     # example, the source file has all its code commented out.
     context.log.warn('Source file {0} generated no classes'.format(self._sourcefile))
   else:
     for _, classes in source_products.rel_paths():
       for cls in classes:
         yield ClasspathUtil.classname_for_rel_classfile(cls)
예제 #4
0
 def _calculate_tests_from_targets(self, targets):
   """
   :param list targets: list of targets to calculate test classes for.
   generates tuples (class_name, target).
   """
   classpath_products = self.context.products.get_data('runtime_classpath')
   for target in targets:
     contents = ClasspathUtil.classpath_contents((target,), classpath_products, confs=self.confs)
     for f in contents:
       classname = ClasspathUtil.classname_for_rel_classfile(f)
       if classname:
         yield (classname, target)
예제 #5
0
  def _target_classes(self, target):
    """Set of target's provided classes.

    Call at the target level is to memoize efficiently.
    """
    target_classes = set()
    contents = ClasspathUtil.classpath_contents((target,), self.runtime_classpath)
    for f in contents:
      classname = ClasspathUtil.classname_for_rel_classfile(f)
      if classname:
        target_classes.add(classname)
    return target_classes
예제 #6
0
 def _calculate_tests_from_targets(self, targets):
   """
   :param list targets: list of targets to calculate test classes for.
   generates tuples (Test, Target).
   """
   classpath_products = self.context.products.get_data('runtime_classpath')
   for target in targets:
     contents = ClasspathUtil.classpath_contents((target,), classpath_products, confs=self.confs)
     for f in contents:
       classname = ClasspathUtil.classname_for_rel_classfile(f)
       if classname:
         yield Test(classname=classname), target
예제 #7
0
    def _target_classes(self, target):
        """Set of target's provided classes.

        Call at the target level is to memoize efficiently.
        """
        target_classes = set()
        contents = ClasspathUtil.classpath_contents((target,), self.runtime_classpath)
        for f in contents:
            classname = ClasspathUtil.classname_for_rel_classfile(f)
            if classname:
                target_classes.add(classname)
        return target_classes
예제 #8
0
 def _calculate_tests_from_targets(self, targets):
     """
 :param list targets: list of targets to calculate test classes for.
 generates tuples (class_name, target).
 """
     classpath_products = self._context.products.get_data(
         'runtime_classpath')
     for target in targets:
         contents = ClasspathUtil.classpath_contents(
             (target, ),
             classpath_products,
             confs=self._task_exports.confs,
             transitive=False)
         for f in contents:
             classname = ClasspathUtil.classname_for_rel_classfile(f)
             if classname:
                 yield (classname, target)
예제 #9
0
 def classname_for_classfile(self, compile_context, class_file_name):
   assert class_file_name.startswith(compile_context.classes_dir)
   return ClasspathUtil.classname_for_rel_classfile(class_file_name[len(compile_context.classes_dir) + 1:])
예제 #10
0
파일: jvm_compile.py 프로젝트: awiss/pants
 def classname_for_classfile(self, compile_context, class_file_name):
     assert class_file_name.startswith(compile_context.classes_dir)
     rel_classfile_path = class_file_name[len(compile_context.classes_dir) +
                                          1:]
     return ClasspathUtil.classname_for_rel_classfile(rel_classfile_path)
예제 #11
0
def _classfile_to_classname(cls):
  return ClasspathUtil.classname_for_rel_classfile(cls)
예제 #12
0
def _classfile_to_classname(cls):
  return ClasspathUtil.classname_for_rel_classfile(cls)