예제 #1
0
    def plan(self, scheduler, product_type, subject, configuration=None):
        sources = list(
            subject.sources.iter_paths(base_path=subject.address.spec_path,
                                       ext=self.source_ext))
        if not sources:
            # TODO(John Sirois): Abstract a ~SourcesConsumerPlanner that can grab sources of given types
            # or else defer to a code generator like we do here.  As it stands, the planner must
            # explicitly allow for code generators and this repeated code / foresight can easily be
            # missed in new compilers, and other source-using tasks.  Once done though, code gen can be
            # introduced to any nesting depth, ie: code gen '.thrift' files.

            # This is a dep graph "hole", we depend on the thing but don't know what it is.  Either it
            # could be something that gets transformed in to our compile input source extension (codegen)
            # or transformed into a `Classpath` product by some other compiler targeting the jvm.
            sources = scheduler.promise(subject,
                                        Sources.of(self.source_ext),
                                        configuration=configuration)
            subject = sources.subject

        classpath_promises = []
        for dep, dep_config in self.iter_configured_dependencies(subject):
            # This could recurse to us (or be satisfied by IvyResolve, another jvm compiler, etc.
            # depending on the dep type).
            classpath = scheduler.promise(dep,
                                          Classpath,
                                          configuration=dep_config)
            classpath_promises.append(classpath)

        return Plan(func_or_task_type=self.compile_task_type,
                    subjects=(subject, ),
                    sources=sources,
                    classpath=classpath_promises)
예제 #2
0
파일: planners.py 프로젝트: simudream/pants
  def plan(self, scheduler, product_type, subject, configuration=None):
    sources = list(subject.sources.iter_paths(base_path=subject.address.spec_path,
                                              ext=self.source_ext))
    if not sources:
      # TODO(John Sirois): Abstract a ~SourcesConsumerPlanner that can grab sources of given types
      # or else defer to a code generator like we do here.  As it stands, the planner must
      # explicitly allow for code generators and this repeated code / foresight can easily be
      # missed in new compilers, and other source-using tasks.  Once done though, code gen can be
      # introduced to any nesting depth, ie: code gen '.thrift' files.

      # This is a dep graph "hole", we depend on the thing but don't know what it is.  Either it
      # could be something that gets transformed in to our compile input source extension (codegen)
      # or transformed into a `Classpath` product by some other compiler targeting the jvm.
      sources = scheduler.promise(subject,
                                  Sources.of(self.source_ext),
                                  configuration=configuration)
      subject = sources.subject

    classpath_promises = []
    for dep, dep_config in self.iter_configured_dependencies(subject):
      # This could recurse to us (or be satisfied by IvyResolve, another jvm compiler, etc.
      # depending on the dep type).
      classpath = scheduler.promise(dep, Classpath, configuration=dep_config)
      classpath_promises.append(classpath)

    return Plan(func_or_task_type=self.compile_task_type,
                subjects=(subject,),
                sources=sources,
                classpath=classpath_promises)
예제 #3
0
파일: planners.py 프로젝트: simudream/pants
 def product_types(self):
   # A convenient product type only, will never be used outside engine internals.
   return {Sources.of('unpickleable_result'): [[Sources.of('unpickleable_inputs')]]}
예제 #4
0
파일: planners.py 프로젝트: simudream/pants
 def product_types(self):
   return {Classpath: [[Sources.of(self.source_ext)]]}
예제 #5
0
파일: planners.py 프로젝트: simudream/pants
 def product_type_by_config_type(self):
   return {
       ScroogeJavaConfiguration: Sources.of('.java'),
       ScroogeScalaConfiguration: Sources.of('.scala'),
     }
예제 #6
0
파일: planners.py 프로젝트: simudream/pants
 def product_type_by_config_type(self):
   return {
       ApacheThriftJavaConfiguration: Sources.of('.java'),
       ApacheThriftPythonConfiguration: Sources.of('.py'),
     }
예제 #7
0
파일: planners.py 프로젝트: simudream/pants
 def product_types(self):
   return {product_type: [[Sources.of('.thrift'), config_type]]
           for config_type, product_type in self.product_type_by_config_type.items()}
예제 #8
0
파일: planners.py 프로젝트: simudream/pants
def _create_sources(ext):
  # A pickle-compatible top-level function for custom unpickling of Sources per-extension types.
  return Sources.of(ext)
예제 #9
0
 def product_types(self):
     # A convenient product type only, will never be used outside engine internals.
     return {
         Sources.of('unpickleable_result'):
         [[Sources.of('unpickleable_inputs')]]
     }
예제 #10
0
 def product_types(self):
     return {Classpath: [[Sources.of(self.source_ext)]]}
예제 #11
0
 def product_type_by_config_type(self):
     return {
         ScroogeJavaConfiguration: Sources.of('.java'),
         ScroogeScalaConfiguration: Sources.of('.scala'),
     }
예제 #12
0
 def product_type_by_config_type(self):
     return {
         ApacheThriftJavaConfiguration: Sources.of('.java'),
         ApacheThriftPythonConfiguration: Sources.of('.py'),
     }
예제 #13
0
 def product_types(self):
     return {
         product_type: [[Sources.of('.thrift'), config_type]]
         for config_type, product_type in
         self.product_type_by_config_type.items()
     }
예제 #14
0
def _create_sources(ext):
    # A pickle-compatible top-level function for custom unpickling of Sources per-extension types.
    return Sources.of(ext)