Ejemplo n.º 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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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')]]}
Ejemplo n.º 4
0
 def product_types(self):
   return {Classpath: [[Sources.of(self.source_ext)]]}
Ejemplo n.º 5
0
 def product_type_by_config_type(self):
   return {
       ScroogeJavaConfiguration: Sources.of('.java'),
       ScroogeScalaConfiguration: Sources.of('.scala'),
     }
Ejemplo n.º 6
0
 def product_type_by_config_type(self):
   return {
       ApacheThriftJavaConfiguration: Sources.of('.java'),
       ApacheThriftPythonConfiguration: Sources.of('.py'),
     }
Ejemplo n.º 7
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()}
Ejemplo n.º 8
0
def _create_sources(ext):
  # A pickle-compatible top-level function for custom unpickling of Sources per-extension types.
  return Sources.of(ext)
Ejemplo n.º 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')]]
     }
Ejemplo n.º 10
0
 def product_types(self):
     return {Classpath: [[Sources.of(self.source_ext)]]}
Ejemplo n.º 11
0
 def product_type_by_config_type(self):
     return {
         ScroogeJavaConfiguration: Sources.of('.java'),
         ScroogeScalaConfiguration: Sources.of('.scala'),
     }
Ejemplo n.º 12
0
 def product_type_by_config_type(self):
     return {
         ApacheThriftJavaConfiguration: Sources.of('.java'),
         ApacheThriftPythonConfiguration: Sources.of('.py'),
     }
Ejemplo n.º 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()
     }
Ejemplo n.º 14
0
def _create_sources(ext):
    # A pickle-compatible top-level function for custom unpickling of Sources per-extension types.
    return Sources.of(ext)