Exemplo n.º 1
0
    def main(self, *, context):  # noqa: D102
        check_and_mark_build_tool(context.args.build_base)

        base_handler_extensions = get_base_handler_extensions()
        base_paths = set()

        args = context.args

        for base_name in args.base_select:
            if base_name in base_handler_extensions:
                base_handler_extension = base_handler_extensions[base_name]
                workspace_paths = \
                    base_handler_extension.get_workspace_paths(args=args)
                for workspace_path in workspace_paths:
                    workspace_path = Path(os.path.abspath(workspace_path))
                    base_paths.add(workspace_path)
            else:
                logger.warning(
                    "No base handler for selction '{base_name}'".format_map(
                        locals()))

        confirmed = args.yes
        clean_paths(base_paths, confirmed)

        return 0
Exemplo n.º 2
0
    def main(self, *, context):  # noqa: D102
        check_and_mark_build_tool(context.args.build_base)

        base_handler_extensions = get_base_handler_extensions()
        base_paths = set()

        args = context.args
        decorators = get_packages(args)

        for base_name in args.base_select:
            if base_name in base_handler_extensions:
                base_handler_extension = base_handler_extensions[base_name]
                for decorator in decorators:
                    if not decorator.selected:
                        continue
                    pkg = decorator.descriptor
                    package_paths = \
                        base_handler_extension.get_package_paths(
                            args=args, pkg=pkg)
                    for package_path in package_paths:
                        package_path = Path(os.path.abspath(package_path))
                        base_paths.add(package_path)
            else:
                logger.warning(
                    "No base handler for selction '{base_name}'"
                    .format_map(locals()))

        confirmed = args.yes
        clean_paths(base_paths, confirmed)

        return 0
Exemplo n.º 3
0
    def _get_jobs(self, args, decorators, install_base):
        jobs = OrderedDict()
        unselected_packages = set()
        for decorator in decorators:
            pkg = decorator.descriptor

            if not decorator.selected:
                unselected_packages.add(pkg)
                continue

            extension = get_task_extension('colcon_core.task.build', pkg.type)
            if not extension:
                logger.warning(
                    "No task extension to 'build' a '{pkg.type}' package".
                    format_map(locals()))
                continue

            recursive_dependencies = OrderedDict()
            for dep_name in decorator.recursive_dependencies:
                dep_path = install_base
                if not args.merge_install:
                    dep_path = os.path.join(dep_path, dep_name)
                recursive_dependencies[dep_name] = dep_path

            package_args = BuildPackageArguments(
                pkg,
                args,
                additional_destinations=self.task_argument_destinations.values(
                ))
            ordered_package_args = ', '.join([
                ('%s: %s' % (repr(k), repr(package_args.__dict__[k])))
                for k in sorted(package_args.__dict__.keys())
            ])
            logger.debug(
                "Building package '{pkg.name}' with the following arguments: "
                '{{{ordered_package_args}}}'.format_map(locals()))
            task_context = TaskContext(pkg=pkg,
                                       args=package_args,
                                       dependencies=recursive_dependencies)

            job = Job(identifier=pkg.name,
                      dependencies=set(recursive_dependencies.keys()),
                      task=extension,
                      task_context=task_context)

            jobs[pkg.name] = job
        return jobs, unselected_packages