コード例 #1
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 optimize,
                 extra_cppflags,
                 blade,
                 kwargs):
        """Init method.

        Init the cc target.

        """
        CcTarget.__init__(self,
                          name,
                          'resource_library',
                          srcs,
                          deps,
                          '',
                          [],
                          [],
                          [],
                          optimize,
                          extra_cppflags,
                          [],
                          blade,
                          kwargs)
コード例 #2
0
ファイル: cu_targets.py プロジェクト: 343829084/typhoon-blade
    def __init__(self,
                 name,
                 target_type,
                 srcs,
                 deps,
                 warning,
                 defs,
                 incs,
                 extra_cppflags,
                 extra_linkflags,
                 blade,
                 kwargs):
        """Init method.

        Init the cu target.

        """
        srcs = var_to_list(srcs)
        deps = var_to_list(deps)
        extra_cppflags = var_to_list(extra_cppflags)
        extra_linkflags = var_to_list(extra_linkflags)

        CcTarget.__init__(self,
                          name,
                          target_type,
                          srcs,
                          deps,
                          warning,
                          defs,
                          incs,
                          [], [],
                          extra_cppflags,
                          extra_linkflags,
                          blade,
                          kwargs)
コード例 #3
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 recursive,
                 prefix,
                 blade,
                 kwargs):
        """Init method.

        Init the cc lex yacc target

        """
        if len(srcs) != 2:
            raise Exception, ('"srcs" for lex_yacc_library should '
                              'be a pair of (lex_source, yacc_source)')
        CcTarget.__init__(self,
                          name,
                          'lex_yacc_library',
                          srcs,
                          deps,
                          'yes',
                          [], [], [], [], [], [],
                          blade,
                          kwargs)
        self.data['recursive'] = recursive
        self.data['prefix'] = prefix
コード例 #4
0
    def __init__(self, name, srcs, deps, recursive, prefix, blade, kwargs):
        """Init method.

        Init the cc lex yacc target

        """
        if len(srcs) != 2:
            raise Exception, ('"srcs" for lex_yacc_library should ' "be a pair of (lex_source, yacc_source)")
        CcTarget.__init__(self, name, "lex_yacc_library", srcs, deps, "yes", [], [], [], [], [], [], blade, kwargs)
        self.data["recursive"] = recursive
        self.data["prefix"] = prefix
コード例 #5
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 optimize,
                 deprecated,
                 blade,
                 kwargs):
        """Init method.

        Init the thrift target.

        """
        srcs = var_to_list(srcs)
        self._check_thrift_srcs_name(srcs)
        CcTarget.__init__(self,
                          name,
                          'thrift_library',
                          srcs,
                          deps,
                          '',
                          [], [], [], optimize, [], [],'',[],
                          blade,
                          kwargs)
        self.data['python_vars'] = []
        self.data['python_sources'] = []

        thrift_config = configparse.blade_config.get_config('thrift_config')
        thrift_lib = var_to_list(thrift_config['thrift_libs'])
        thrift_bin = thrift_config['thrift']
        if thrift_bin.startswith("//"):
            dkey = self._convert_string_to_target_helper(thrift_bin)
            if dkey not in self.expanded_deps:
                self.expanded_deps.append(dkey)
            if dkey not in self.deps:
                self.deps.append(dkey)


        # Hardcode deps rule to thrift libraries.
        self._add_hardcode_library(thrift_lib)

        # Link all the symbols by default
        self.data['link_all_symbols'] = True
        self.data['deprecated'] = deprecated
        self.data['java_sources_explict_dependency'] = []

        # For each thrift file initialize a ThriftHelper, which will be used
        # to get the source files generated from thrift file.
        self.thrift_helpers = {}
        for src in srcs:
            self.thrift_helpers[src] = ThriftHelper(
                    os.path.join(self.path, src))
コード例 #6
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 optimize,
                 deprecated,
                 blade,
                 kwargs):
        """Init method.

        Init the thrift target.

        """
        srcs = var_to_list(srcs)
        self._check_thrift_srcs_name(srcs)
        CcTarget.__init__(self,
                          name,
                          'fbthrift_library',
                          srcs,
                          deps,
                          None,
                          '',
                          [], [], [], optimize, [], [],
                          blade,
                          kwargs)

        fbthrift_config = configparse.blade_config.get_config('fbthrift_config')
        fbthrift_libs = var_to_list(fbthrift_config['fbthrift_libs'])
        fbthrift1_bin = fbthrift_config['fbthrift1']
        fbthrift2_bin = fbthrift_config['fbthrift2']


        # Hardcode deps rule to thrift libraries.
        self._add_hardcode_library(fbthrift_libs)

        # Link all the symbols by default
        self.data['link_all_symbols'] = True

        # For each thrift file initialize a FBThriftHelper, which will be used
        # to get the source files generated from thrift file.
        self.fbthrift_helpers = {}
        for src in srcs:
            self.fbthrift_helpers[src] = FBThriftHelper(
                    os.path.join(self.path, src))
コード例 #7
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 optimize,
                 deprecated,
                 blade,
                 kwargs):
        """Init method.

        Init the thrift target.

        """
        srcs = var_to_list(srcs)
        self._check_thrift_srcs_name(srcs)
        CcTarget.__init__(self,
                          name,
                          'thrift_library',
                          srcs,
                          deps,
                          '',
                          [], [], [], optimize, [], [],
                          blade,
                          kwargs)

        thrift_config = configparse.blade_config.get_config('thrift_config')
        thrift_lib = var_to_list(thrift_config['thrift_libs'])

        # Hardcode deps rule to thrift libraries.
        self._add_hardcode_library(thrift_lib)

        # Link all the symbols by default
        self.data['options']['link_all_symbols'] = True
        self.data['options']['deprecated'] = deprecated

        # For each thrift file initialize a ThriftHelper, which will be used
        # to get the source files generated from thrift file.
        self.thrift_helpers = {}
        for src in srcs:
            self.thrift_helpers[src] = ThriftHelper(
                    os.path.join(self.data['path'], src))
コード例 #8
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 warning,
                 defs,
                 incs,
                 allow_undefined,
                 recursive,
                 prefix,
                 blade,
                 kwargs):
        """Init method.

        Init the cc lex yacc target

        """
        if (len(srcs) != 2 or
            (not (srcs[0].endswith('.l') or srcs[0].endswith('.ll'))) or
            (not (srcs[1].endswith('.y') or srcs[1].endswith('.yy')))):
            console.error_exit('%s: srcs for lex_yacc_library should be '
                               'a pair of (lex_source, yacc_source)' % self.fullname)

        CcTarget.__init__(self,
                          name,
                          'lex_yacc_library',
                          srcs,
                          deps,
                          None,
                          warning,
                          defs,
                          incs,
                          [], [], [], [],
                          blade,
                          kwargs)

        self.data['recursive'] = recursive
        self.data['prefix'] = prefix
        self.data['allow_undefined'] = allow_undefined
        self.data['link_all_symbols'] = True
コード例 #9
0
    def __init__(self, name, srcs, deps, optimize, deprecated, blade, kwargs):
        """Init method.

        Init the proto target.

        """
        srcs_list = var_to_list(srcs)
        self._check_proto_srcs_name(srcs_list)
        CcTarget.__init__(self, name, "proto_library", srcs, deps, "", [], [], [], optimize, [], [], blade, kwargs)

        proto_config = configparse.blade_config.get_config("proto_library_config")
        protobuf_lib = var_to_list(proto_config["protobuf_libs"])

        # Hardcode deps rule to thirdparty protobuf lib.
        self._add_hardcode_library(protobuf_lib)

        # Link all the symbols by default
        self.data["link_all_symbols"] = True
        self.data["deprecated"] = deprecated
        self.data["java_sources_explict_dependency"] = []
        self.data["python_vars"] = []
        self.data["python_sources"] = []
コード例 #10
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 optimize,
                 deprecated,
                 generate_descriptors,
                 blade,
                 kwargs):
        """Init method.

        Init the proto target.

        """
        srcs_list = var_to_list(srcs)
        self._check_proto_srcs_name(srcs_list)
        CcTarget.__init__(self,
                          name,
                          'proto_library',
                          srcs,
                          deps,
                          '',
                          [], [], [], optimize, [], [],
                          blade,
                          kwargs)

        proto_config = configparse.blade_config.get_config('proto_library_config')
        protobuf_lib = var_to_list(proto_config['protobuf_libs'])

        # Hardcode deps rule to thirdparty protobuf lib.
        self._add_hardcode_library(protobuf_lib)

        # Link all the symbols by default
        self.data['link_all_symbols'] = True
        self.data['deprecated'] = deprecated
        self.data['java_sources_explict_dependency'] = []
        self.data['python_vars'] = []
        self.data['python_sources'] = []
        self.data['generate_descriptors'] = generate_descriptors
コード例 #11
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 optimize,
                 deprecated,
                 blade,
                 kwargs):
        """Init method.

        Init the protorpc target.

        """
        srcs_list = var_to_list(srcs)
        self._check_proto_srcs_name(srcs_list)
        CcTarget.__init__(self,
                          name,
                          'protorpc_library',
                          srcs,
                          deps,
                          '',
                          [], [], [], optimize, [], [],
                          blade,
                          kwargs)

        proto_config = configparse.blade_config.get_config('proto_library_config')
        protobuf_lib = var_to_list(proto_config['protobuf_libs'])

        protorpc_config = configparse.blade_config.get_config('protorpc_library_config')
        protorpc_lib = var_to_list(protorpc_config['protorpc_libs'])

        # Hardcode deps rule to thirdparty protobuf lib.
        self._add_hardcode_library(protobuf_lib)
        self._add_hardcode_library(protorpc_lib);

        # Link all the symbols by default
        self.data['link_all_symbols'] = True
        self.data['deprecated'] = deprecated
コード例 #12
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 warning,
                 java_package,
                 java_lib_packed,
                 optimize,
                 extra_swigflags,
                 blade,
                 kwargs):
        """Init method.

        Init the cc target.

        """
        CcTarget.__init__(self,
                          name,
                          'swig_library',
                          srcs,
                          deps,
                          None,
                          warning,
                          [], [], [], optimize, extra_swigflags, [],
                          blade,
                          kwargs)
        self.data['cpperraswarn'] = warning
        self.data['java_package'] = java_package
        self.data['java_lib_packed'] = java_lib_packed
        self.data['java_dep_var'] = []
        self.data['java_sources_explict_dependency'] = []
        self.data['python_vars'] = []
        self.data['python_sources'] = []

        scons_platform = self.blade.get_scons_platform()
        self.php_inc_list = scons_platform.get_php_include()
        self.options = self.blade.get_options()
コード例 #13
0
    def __init__(self, name, srcs, deps, optimize, deprecated, blade, kwargs):
        """Init method.

        Init the proto target.

        """
        srcs_list = var_to_list(srcs)
        self._check_proto_srcs_name(srcs_list)
        CcTarget.__init__(self, name, 'proto_library', srcs, deps, '', [], [],
                          [], optimize, [], [], blade, kwargs)

        proto_config = configparse.blade_config.get_config(
            'proto_library_config')
        protobuf_lib = var_to_list(proto_config['protobuf_libs'])

        # Hardcode deps rule to thirdparty protobuf lib.
        self._add_hardcode_library(protobuf_lib)

        # Link all the symbols by default
        self.data['link_all_symbols'] = True
        self.data['deprecated'] = deprecated
        self.data['java_sources_explict_dependency'] = []
        self.data['python_vars'] = []
        self.data['python_sources'] = []
コード例 #14
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 warning,
                 java_package,
                 java_lib_packed,
                 optimize,
                 extra_swigflags,
                 blade,
                 kwargs):
        """Init method.

        Init the cc target.

        """
        CcTarget.__init__(self,
                          name,
                          'swig_library',
                          srcs,
                          deps,
                          warning,
                          [], [], [], optimize, extra_swigflags, [],
                          blade,
                          kwargs)
        self.data['cpperraswarn'] = warning
        self.data['java_package'] = java_package
        self.data['java_lib_packed'] = java_lib_packed
        self.data['java_dep_var'] = []
        self.data['java_sources_explict_dependency'] = []
        self.data['python_vars'] = []
        self.data['python_sources'] = []

        scons_platform = self.blade.get_scons_platform()
        self.php_inc_list = scons_platform.get_php_include()
        self.options = self.blade.get_options()
コード例 #15
0
 def _prepare_to_generate_rule(self):
     CcTarget._prepare_to_generate_rule(self)
     self._check_proto_deps()
コード例 #16
0
    def __init__(self, name, srcs, deps, optimize, deprecated,
                 generate_descriptors, plugins, source_encoding, blade,
                 kwargs):
        """Init method.

        Init the proto target.

        """
        srcs = var_to_list(srcs)
        self._check_proto_srcs_name(srcs)
        CcTarget.__init__(self, name, 'proto_library', srcs, deps, None, '',
                          [], [], [], optimize, [], [], blade, kwargs)
        if srcs:
            self.data['public_protos'] = [
                self._source_file_path(s) for s in srcs
            ]

        proto_config = configparse.blade_config.get_config(
            'proto_library_config')
        protobuf_libs = var_to_list(proto_config['protobuf_libs'])
        protobuf_java_libs = var_to_list(proto_config['protobuf_java_libs'])
        protobuf_python_libs = var_to_list(
            proto_config['protobuf_python_libs'])

        # Hardcode deps rule to thirdparty protobuf lib.
        self._add_hardcode_library(protobuf_libs)
        self._add_hardcode_java_library(protobuf_java_libs)
        self._add_hardcode_library(protobuf_python_libs)

        plugins = var_to_list(plugins)
        self.data['protoc_plugins'] = plugins
        # Handle protoc plugin deps according to the language
        protoc_plugin_config = configparse.blade_config.get_config(
            'protoc_plugin_config')
        protoc_plugin_deps = set()
        protoc_plugin_java_deps = set()
        for plugin in plugins:
            if plugin not in protoc_plugin_config:
                console.error_exit('%s: Unknown plugin %s' %
                                   (self.fullname, plugin))
            p = protoc_plugin_config[plugin]
            for language, v in p.code_generation.iteritems():
                for key in v['deps']:
                    if key not in self.deps:
                        self.deps.append(key)
                    if key not in self.expanded_deps:
                        self.expanded_deps.append(key)
                    protoc_plugin_deps.add(key)
                    if language == 'java':
                        protoc_plugin_java_deps.add(key)
        self.data['protoc_plugin_deps'] = list(protoc_plugin_deps)

        # Normally a proto target depends on another proto target when
        # it references a message defined in that target. Then in the
        # generated code there is public API with return type/arguments
        # defined outside and in java it needs to export that dependency,
        # which is also the case for java protobuf library.
        self.data['exported_deps'] = self._unify_deps(var_to_list(deps))
        self.data['exported_deps'] += self._unify_deps(protobuf_java_libs)
        self.data['exported_deps'] += list(protoc_plugin_java_deps)

        # Link all the symbols by default
        self.data['link_all_symbols'] = True
        self.data['deprecated'] = deprecated
        self.data['source_encoding'] = source_encoding

        self.data['java_sources_explict_dependency'] = []
        self.data['python_vars'] = []
        self.data['python_sources'] = []
        self.data['generate_descriptors'] = generate_descriptors
コード例 #17
0
 def _prepare_to_generate_rule(self):
     CcTarget._prepare_to_generate_rule(self)
     self._check_proto_deps()
コード例 #18
0
    def __init__(self,
                 name,
                 srcs,
                 deps,
                 optimize,
                 deprecated,
                 generate_descriptors,
                 plugins,
                 source_encoding,
                 blade,
                 kwargs):
        """Init method.

        Init the proto target.

        """
        srcs_list = var_to_list(srcs)
        self._check_proto_srcs_name(srcs_list)
        CcTarget.__init__(self,
                          name,
                          'proto_library',
                          srcs,
                          deps,
                          None,
                          '',
                          [], [], [], optimize, [], [],
                          blade,
                          kwargs)

        proto_config = configparse.blade_config.get_config('proto_library_config')
        protobuf_libs = var_to_list(proto_config['protobuf_libs'])
        protobuf_java_libs = var_to_list(proto_config['protobuf_java_libs'])

        # Hardcode deps rule to thirdparty protobuf lib.
        self._add_hardcode_library(protobuf_libs)
        self._add_hardcode_java_library(protobuf_java_libs)

        plugins = var_to_list(plugins)
        self.data['protoc_plugins'] = plugins
        # Handle protoc plugin deps according to the language
        protoc_plugin_config = configparse.blade_config.get_config('protoc_plugin_config')
        protoc_plugin_deps = set()
        protoc_plugin_java_deps = set()
        for plugin in plugins:
            if plugin not in protoc_plugin_config:
                console.error_exit('%s: Unknown plugin %s' % (self.fullname, plugin))
            p = protoc_plugin_config[plugin]
            for language, v in p.code_generation.iteritems():
                for key in v['deps']:
                    if key not in self.deps:
                        self.deps.append(key)
                    if key not in self.expanded_deps:
                        self.expanded_deps.append(key)
                    protoc_plugin_deps.add(key)
                    if language == 'java':
                        protoc_plugin_java_deps.add(key)
        self.data['protoc_plugin_deps'] = list(protoc_plugin_deps)

        # Normally a proto target depends on another proto target when
        # it references a message defined in that target. Then in the
        # generated code there is public API with return type/arguments
        # defined outside and in java it needs to export that dependency,
        # which is also the case for java protobuf library.
        self.data['exported_deps'] = self._unify_deps(var_to_list(deps))
        self.data['exported_deps'] += self._unify_deps(protobuf_java_libs)
        self.data['exported_deps'] += list(protoc_plugin_java_deps)

        # Link all the symbols by default
        self.data['link_all_symbols'] = True
        self.data['deprecated'] = deprecated
        self.data['source_encoding'] = source_encoding

        self.data['java_sources_explict_dependency'] = []
        self.data['python_vars'] = []
        self.data['python_sources'] = []
        self.data['generate_descriptors'] = generate_descriptors