def __init__(self, context): CodeGen.__init__(self, context) self.protoc_supportdir = self.context.config.get('protobuf-gen', 'supportdir') self.protoc_version = self.context.config.get('protobuf-gen', 'version') self.output_dir = (context.options.protobuf_gen_create_outdir or context.config.get('protobuf-gen', 'workdir')) def resolve_deps(key): deps = OrderedSet() for dep in context.config.getlist('protobuf-gen', key): deps.update(context.resolve(dep)) return deps self.javadeps = resolve_deps('javadeps') self.java_out = os.path.join(self.output_dir, 'gen-java') self.pythondeps = resolve_deps('pythondeps') self.py_out = os.path.join(self.output_dir, 'gen-py') self.gen_langs = set(context.options.protobuf_gen_langs) for lang in ('java', 'python'): if self.context.products.isrequired(lang): self.gen_langs.add(lang) self.protobuf_binary = select_binary( self.protoc_supportdir, self.protoc_version, 'protoc', context.config )
def __init__(self, context): CodeGen.__init__(self, context) output_dir = ( context.options.thrift_gen_create_outdir or context.config.get('thrift-gen', 'workdir') ) self.combined_dir = os.path.join(output_dir, 'combined') self.session_dir = os.path.join(output_dir, 'sessions') self.strict = context.config.getbool('thrift-gen', 'strict') self.verbose = context.config.getbool('thrift-gen', 'verbose') def create_geninfo(key): gen_info = context.config.getdict('thrift-gen', key) gen = gen_info['gen'] deps = {} for category, depspecs in gen_info['deps'].items(): dependencies = OrderedSet() deps[category] = dependencies for depspec in depspecs: dependencies.update(context.resolve(depspec)) return self.GenInfo(gen, deps) self.gen_java = create_geninfo('java') self.gen_python = create_geninfo('python') self.gen_langs = set(context.options.thrift_gen_langs) for lang in ('java', 'python'): if self.context.products.isrequired(lang): self.gen_langs.add(lang) self.thrift_binary = select_thrift_binary(context.config, version=context.options.thrift_version)
def __init__(self, context, workdir): CodeGen.__init__(self, context, workdir) self.combined_dir = os.path.join(self.workdir, 'combined') self.combined_relpath = os.path.relpath(self.combined_dir, get_buildroot()) self.session_dir = os.path.join(self.workdir, 'sessions') self.strict = context.config.getbool('thrift-gen', 'strict') self.verbose = context.config.getbool('thrift-gen', 'verbose') def create_geninfo(key): gen_info = context.config.getdict('thrift-gen', key) gen = gen_info['gen'] deps = {} for category, depspecs in gen_info['deps'].items(): dependencies = OrderedSet() deps[category] = dependencies for depspec in depspecs: dependencies.update(context.resolve(depspec)) return self.GenInfo(gen, deps) self.gen_java = create_geninfo('java') self.gen_python = create_geninfo('python') self.gen_langs = set(context.options.thrift_gen_langs) for lang in ('java', 'python'): if self.context.products.isrequired(lang): self.gen_langs.add(lang) self.thrift_binary = select_thrift_binary( context.config, version=context.options.thrift_version) self.defaults = JavaThriftLibrary.Defaults(context.config)
def __init__(self, context): CodeGen.__init__(self, context) NailgunTask.__init__(self, context) # TODO(John Sirois): kill if not needed by prepare_gen self._classpath_by_compiler = {} active_compilers = set(map(lambda t: t.compiler, context.targets(predicate=self.is_gentarget))) for compiler, tools in self._all_possible_antlr_bootstrap_tools(): if compiler in active_compilers: self._jvm_tool_bootstrapper.register_jvm_tool(compiler, tools)