Example #1
0
    def __get_compile_cmds(self, task: Task, args: list):
        """
        Get compilation command to compile all of the task source files.

        :param task: related task
        :param args: additional arguments
        :return: list of compilation commands
        """
        compiler = task.get_compiler()
        if '' != compiler:
            bin_path = task.path_to_task_bin(self.__workdir)
            if not os.path.exists(bin_path):
                os.makedirs(bin_path)

            path = task.path_to_task_src(self.__workdir)
            if task.is_file_archive():
                if self.__cmake_handler is not None and task.uses_cmake():
                    if not self.__cmake_handler.is_cmake_target(path):
                        self.__cmake_handler.create_cmake_lists(task)
                    commands = self.__cmake_handler.get_compilation_commands_using_cmake(
                        task)
                else:
                    commands = self.__no_cmake_compile_cmd(
                        compiler, task, args)
            else:
                commands = self.__get_compile_cmd_for_single_file(
                    compiler, task, args)

            self.__log_writer.log(json.dumps(commands, indent=4),
                                  level=LogLevel.DEBUG)
            return commands
        else:
            raise RuntimeError('No compiler is set for the task: {}'.format(
                task.get_name()))
Example #2
0
    async def write_recvd_data(self, task: Task, recv_name: str,
                               recvd_data: bytes):
        # Create directory for task files if it doesn't exist
        srcdir = task.path_to_task_src(self.workdir)
        if not os.path.exists(srcdir):
            os.makedirs(srcdir)

        # Write incoming file on disk
        recv_file = os.path.join(srcdir, recv_name)
        await self.__async_rw.async_write_file(recv_file, recvd_data)

        if task.is_file_archive():
            await self.__executor.async_execution(self.__handle_archive, task,
                                                  srcdir, recv_file)

        return