コード例 #1
0
ファイル: task.py プロジェクト: xtfvje/ambuild
    def doResource(self, message):
        task_folder = message['task_folder']
        task_data = message['task_data']
        cl_argv = task_data['cl_argv']
        rc_argv = task_data['rc_argv']

        with util.FolderChanger(task_folder):
            # Includes go to stderr when we preprocess to stdout.
            p, out, err = util.Execute(cl_argv)
            out, deps = util.ParseMSVCDeps(self.vars, err)
            paths = self.rewriteDeps(deps)

            if p.returncode == 0:
                p, out, err = util.Execute(rc_argv)

        reply = {
            'ok':
            p.returncode == 0,
            'cmdline': (' '.join([arg for arg in cl_argv]) + ' && ' +
                        ' '.join([arg for arg in rc_argv])),
            'stdout':
            out,
            'stderr':
            err,
            'deps':
            paths,
        }
        return reply
コード例 #2
0
    def doResource(self, message):
        task_folder = message['task_folder']
        task_data = message['task_data']
        tools_env = message['task_tools_env']
        cl_argv = task_data['cl_argv']
        rc_argv = task_data['rc_argv']

        inclusion_pattern = GetMsvcInclusionPattern(self.vars, tools_env)

        env = None
        if tools_env is not None:
            if tools_env.env_cmds is not None:
                env = util.BuildEnv(tools_env.env_cmds)
            if 'cl' in tools_env.tools:
                cl_argv[0] = tools_env.tools['cl']
            if 'rc' in tools_env.tools:
                rc_argv[0] = tools_env.tools['rc']

        with util.FolderChanger(task_folder):
            # Includes go to stderr when we preprocess to stdout.
            p, out, err = util.Execute(cl_argv, env=env)
            out, deps = util.ParseMSVCDeps(err, inclusion_pattern)
            paths = self.rewriteDeps(deps)

            if p.returncode == 0:
                p, out, err = util.Execute(rc_argv, env=env)

        reply = {
            'ok': p.returncode == 0,
            'cmdline': self.task_argv_debug(message),
            'stdout': out,
            'stderr': err,
            'deps': paths,
        }
        return reply
コード例 #3
0
    def doCompile(self, message):
        task_folder = message['task_folder']
        task_data = message['task_data']
        tools_env = message['task_tools_env']
        cc_type = task_data['type']
        argv = task_data['argv']

        if 'deps' in task_data:
            dep_type, dep_info = task_data['deps']
        else:
            dep_type = cc_type
            dep_info = None

        env = None
        if tools_env is not None:
            if tools_env.env_cmds is not None:
                env = util.BuildEnv(tools_env.env_cmds)
            if 'cl' in tools_env.tools:
                argv[0] = tools_env.tools['cl']

        with util.FolderChanger(task_folder):
            p, out, err = util.Execute(argv, env=env)
            out, err, paths = self.parseDependencies(tools_env, out, err,
                                                     dep_type, dep_info)

        reply = {
            'ok': p.returncode == 0,
            'cmdline': self.task_argv_debug(message),
            'stdout': out,
            'stderr': err,
            'deps': paths,
        }
        return reply
コード例 #4
0
    def doCommand(self, message):
        task_folder = message['task_folder']
        tools_env = message['task_tools_env']
        argv = message['task_data']

        env = None
        if tools_env is not None:
            if tools_env.env_cmds is not None:
                env = util.BuildEnv(tools_env.env_cmds)
            if argv[0] in tools_env.tools:
                argv[0] = tools_env.tools[argv[0]]

        with util.FolderChanger(task_folder):
            try:
                p, stdout, stderr = util.Execute(argv, env=env)
                status = p.returncode == 0
            except Exception as exn:
                status = False
                stdout = ''
                stderr = '{0}'.format(exn)

        reply = {
            'ok': status,
            'cmdline': self.task_argv_debug(message),
            'stdout': stdout,
            'stderr': stderr,
        }
        return reply
コード例 #5
0
    def doCompile(self, message):
        task_folder = message['task_folder']
        task_data = message['task_data']
        cc_type = task_data['type']
        argv = task_data['argv']

        with util.FolderChanger(task_folder):
            p, out, err = util.Execute(argv)
            if cc_type == 'gcc':
                err, deps = util.ParseGCCDeps(err)
            elif cc_type == 'msvc':
                out, deps = util.ParseMSVCDeps(self.vars, out)
            elif cc_type == 'sun':
                err, deps = util.ParseSunDeps(err)
            elif cc_type == 'fxc':
                out, deps = util.ParseFXCDeps(out)
            else:
                raise Exception('unknown compiler type')

            paths = self.rewriteDeps(deps)

        reply = {
            'ok': p.returncode == 0,
            'cmdline': self.task_argv_debug(message),
            'stdout': out,
            'stderr': err,
            'deps': paths,
        }
        return reply
コード例 #6
0
    def doCommand(self, message):
        task_folder = message['task_folder']
        argv = message['task_data']
        with util.FolderChanger(task_folder):
            try:
                p, stdout, stderr = util.Execute(argv)
                status = p.returncode == 0
            except Exception as exn:
                status = False
                stdout = ''
                stderr = '{0}'.format(exn)

        reply = {
            'ok': status,
            'cmdline': self.task_argv_debug(message),
            'stdout': stdout,
            'stderr': stderr,
        }
        return reply
コード例 #7
0
ファイル: task.py プロジェクト: peace-maker/ambuild
    def doCompile(self, message):
        task_folder = message['task_folder']
        task_data = message['task_data']
        tools_env = message['task_tools_env']
        cc_type = task_data['type']
        argv = task_data['argv']

        env = None
        if tools_env is not None:
            if tools_env.env_cmds is not None:
                env = util.BuildEnv(tools_env.env_cmds)
            if 'cl' in tools_env.tools:
                argv[0] = tools_env.tools['cl']

        with util.FolderChanger(task_folder):
            p, out, err = util.Execute(argv, env=env)
            if cc_type == 'gcc':
                err, deps = util.ParseGCCDeps(err)
            elif cc_type == 'msvc':
                inclusion_pattern = GetMsvcInclusionPattern(
                    self.vars, tools_env)
                out, deps = util.ParseMSVCDeps(out, inclusion_pattern)
            elif cc_type == 'sun':
                err, deps = util.ParseSunDeps(err)
            elif cc_type == 'fxc':
                out, deps = util.ParseFXCDeps(out)
            else:
                raise Exception('unknown compiler type')

            paths = self.rewriteDeps(deps)

        reply = {
            'ok': p.returncode == 0,
            'cmdline': self.task_argv_debug(message),
            'stdout': out,
            'stderr': err,
            'deps': paths,
        }
        return reply