Exemplo n.º 1
0
    def build(self):
        if not self.ctx.targets or self.ctx.targets == '*':
            digraph = buildconfigutil.get_uor_digraph(
                self.build_config)
            self.draw_imp(digraph, 'UORs', '__all__')
            return
        elif self.ctx.targets in self.build_config.package_groups:
            group_name = self.ctx.targets
            digraph = buildconfigutil.get_package_digraph(
                self.build_config, group_name)
            self.draw_imp(digraph, group_name, group_name)
            return

        package = None
        if self.ctx.targets in self.build_config.stdalone_packages:
            package = self.build_config.stdalone_packages[self.ctx.targets]
        elif self.ctx.targets in self.build_config.inner_packages:
            package = self.build_config.inner_packages[self.ctx.targets]

        if not package or package.type_ == repounits.PackageType.PACKAGE_PLUS:
            Logs.warn('Graph target must be either empty, '
                      'a package group, or a package that is not '
                      'a + package.')
            return

        digraph = cpreproc.get_component_digraph(
            package, self.ctx.options.use_test_only == 'yes')
        prefix = package.name + '_'

        def remove_prefix(str_):
            if str_.startswith(prefix):
                return str_[len(prefix):]
            return str_

        # Remove prefix
        digraph_new = {}
        for node in digraph:
            digraph_new[remove_prefix(node)] = [remove_prefix(c) for
                                                c in digraph[node]]

        self.draw_imp(digraph_new, package.name, package.name)
Exemplo n.º 2
0
    def build(self):
        if not self.ctx.targets or self.ctx.targets == '*':
            digraph = buildconfigutil.get_uor_digraph(self.build_config)
            self.draw_imp(digraph, 'UORs', '__all__')
            return
        elif self.ctx.targets in self.build_config.package_groups:
            group_name = self.ctx.targets
            digraph = buildconfigutil.get_package_digraph(
                self.build_config, group_name)
            self.draw_imp(digraph, group_name, group_name)
            return

        package = None
        if self.ctx.targets in self.build_config.stdalone_packages:
            package = self.build_config.stdalone_packages[self.ctx.targets]
        elif self.ctx.targets in self.build_config.inner_packages:
            package = self.build_config.inner_packages[self.ctx.targets]

        if not package or package.type_ == repounits.PackageType.PACKAGE_PLUS:
            Logs.warn('Graph target must be either empty, '
                      'a package group, or a package that is not '
                      'a + package.')
            return

        digraph = cpreproc.get_component_digraph(
            package, self.ctx.options.use_test_only == 'yes')
        prefix = package.name + '_'

        def remove_prefix(str_):
            if str_.startswith(prefix):
                return str_[len(prefix):]
            return str_

        # Remove prefix
        digraph_new = {}
        for node in digraph:
            digraph_new[remove_prefix(node)] = [
                remove_prefix(c) for c in digraph[node]
            ]

        self.draw_imp(digraph_new, package.name, package.name)
Exemplo n.º 3
0
    def __init__(self, ctx):
        for class_name in ('cxx', 'cxxprogram', 'cxxshlib', 'cxxstlib',
                           'c', 'cprogram', 'cshlib', 'cstlib'):
            waftweaks.activate_custom_exec_command(class_name)

        self.ctx = ctx

        # Use the same index for all task generators.  Since we don't ever
        # build the same source file using two different build options, this is
        # safe to do.  Doing so saves us from having to manually make task
        # generators for builds with and without test drivers to have the same
        # index.
        self.global_taskgen_idx = 1
        self.build_config = buildconfig.BuildConfig.from_pickle_str(
            self.ctx.env['build_config'])
        self.install_config = installconfig.InstallConfig.from_pickle_str(
            self.ctx.env['install_config'])

        self.uor_digraph = buildconfigutil.get_uor_digraph(self.build_config)

        if self.ctx.cmd in ('install', 'uninstall'):
            self.install_config.setup_install_uors(
                self.ctx.targets, self.ctx.options.install_dep == 'yes',
                self.uor_digraph)

            all_parts = ("lib", "bin", "h", "pc")
            install_part = self.ctx.options.install_parts

            for attr in ("is_install_" + part for part in all_parts):
                setattr(self.install_config, attr, True)
            if install_part != "all":
                for attr in ("is_install_" + part for part in all_parts
                             if part != install_part):
                    setattr(self.install_config, attr, False)

            Logs.info('Waf: Installing UORs: %s' %
                      ','.join(sorted(self.install_config.install_uors)))

        self.third_party_lib_targets = set(
            [d + '_lib' for d in self.build_config.third_party_dirs.keys()])

        if 'shr' in self.build_config.ufid.flags:
            self.libtype_features = ['cxxshlib']
        else:
            self.libtype_features = ['cxxstlib']

        self.is_run_tests = self.ctx.options.test in ('run', 'changed')
        self.is_build_tests = self.is_run_tests or \
            self.ctx.options.test == 'build'

        self.ctx.env['env'] = os.environ.copy()
        self.ctx.env['env'].update(self.build_config.custom_envs)

        if self.build_config.uplid.os_type == 'windows':
            # Use forward slash for paths on windows to be compatible with
            # pykg-config.py.
            self.ctx.env['PREFIX'] = self.ctx.env['PREFIX'].replace('\\', '/')

        if (any(t.endswith('.t') for t in self.ctx.targets.split(',')) and
                not self.is_build_tests):
            msg = """Did you forget to use the option '--test build'?
You must use the option '--test build' to build test drivers and the option
'--test run' to run test drivers.  For example, to build the test driver for
the bdlt_date component:

$ waf build --target bdlt_date.t --test build"""
            Logs.warn(msg)

        self.export_third_party_flags()
Exemplo n.º 4
0
    def __init__(self, ctx):
        for class_name in ('cxx', 'cxxprogram', 'cxxshlib', 'cxxstlib', 'c',
                           'cprogram', 'cshlib', 'cstlib'):
            waftweaks.activate_custom_exec_command(class_name)

        self.ctx = ctx

        # Use the same index for all task generators.  Since we don't ever
        # build the same source file using two different build options, this is
        # safe to do.  Doing so saves us from having to manually make task
        # generators for builds with and without test drivers to have the same
        # index.
        self.global_taskgen_idx = 1
        self.build_config = buildconfig.BuildConfig.from_pickle_str(
            self.ctx.env['build_config'])
        self.install_config = installconfig.InstallConfig.from_pickle_str(
            self.ctx.env['install_config'])

        self.uor_digraph = buildconfigutil.get_uor_digraph(self.build_config)

        if self.ctx.cmd in ('install', 'uninstall'):
            self.install_config.setup_install_uors(
                self.ctx.targets, self.ctx.options.install_dep == 'yes',
                self.uor_digraph)

            all_parts = ("lib", "bin", "h", "pc")
            install_part = self.ctx.options.install_parts

            for attr in ("is_install_" + part for part in all_parts):
                setattr(self.install_config, attr, True)
            if install_part != "all":
                for attr in ("is_install_" + part for part in all_parts
                             if part != install_part):
                    setattr(self.install_config, attr, False)

            Logs.info('Waf: Installing UORs: %s' %
                      ','.join(sorted(self.install_config.install_uors)))

        self.third_party_lib_targets = set(
            [d + '_lib' for d in self.build_config.third_party_dirs.keys()])

        if 'shr' in self.build_config.ufid.flags:
            self.libtype_features = ['cxxshlib']
        else:
            self.libtype_features = ['cxxstlib']

        self.is_run_tests = self.ctx.options.test in ('run', 'changed')
        self.is_build_tests = self.is_run_tests or \
            self.ctx.options.test == 'build'

        self.ctx.env['env'] = os.environ.copy()
        self.ctx.env['env'].update(self.build_config.custom_envs)

        if self.build_config.uplid.os_type == 'windows':
            # Use forward slash for paths on windows to be compatible with
            # pykg-config.py.
            self.ctx.env['PREFIX'] = self.ctx.env['PREFIX'].replace('\\', '/')

        if (any(t.endswith('.t') for t in self.ctx.targets.split(','))
                and not self.is_build_tests):
            msg = """Did you forget to use the option '--test build'?
You must use the option '--test build' to build test drivers and the option
'--test run' to run test drivers.  For example, to build the test driver for
the bdlt_date component:

$ waf build --target bdlt_date.t --test build"""
            Logs.warn(msg)

        self.export_third_party_flags()