示例#1
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
示例#2
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
示例#3
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
示例#4
0
    def parseDependencies(self, tools_env, out, err, dep_type, dep_info):
        if dep_type == 'md':
            with open(dep_info) as fp:
                deps = make_parser.ParseDependencyFile(dep_info, fp)
        elif dep_type == 'gcc':
            err, deps = util.ParseGCCDeps(err)
        elif dep_type == 'msvc':
            inclusion_pattern = GetMsvcInclusionPattern(self.vars, tools_env)
            out, deps = util.ParseMSVCDeps(out, inclusion_pattern)
        elif dep_type == 'fxc':
            out, deps = util.ParseFXCDeps(out)
        else:
            raise Exception('unknown dependency type')

        paths = self.rewriteDeps(deps)
        return out, err, paths
示例#5
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']

        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