build.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:SublimeAnarchy 作者: AnarchyTools 项目源码 文件源码
def run(self, *args, **kwargs):
        tool = kwargs.get("tool", "atllbuild")
        build_last = kwargs.get("build_last", False)
        if not self.window.project_file_name():
            return

        pkg = Package.fromFile(atpkgTools.findAtpkg(self.window.project_file_name()))   
        probable_task = pkg.task_for_file(self.window.active_view().file_name())

        if not build_last:
            tasks = []
            idx = 0
            for (name, task) in pkg.tasks.items():
                if task.tool != tool:
                    continue
                desc = "Task group"
                if task.tool == "atllbuild":
                    desc = "Compile Swift " + task.output_type.replace("-", " ")
                elif task.tool == "shell":
                    desc = "Run Shell script"
                elif task.tool == "xctestrun":
                    desc = "Execute Tests"
                if task == probable_task:
                    idx = len(tasks)
                tasks.append([name, desc])

            if len(tasks) == 0:
                sublime.message_dialog("SublimeAnarchy\n\nThere are no tasks to run")
                return

            if len(tasks) == 1:
                self.build(pkg, tasks, 0)
                return

            self.window.show_quick_panel(tasks, lambda x: self.build(pkg, tasks, x), 0, idx)
        else:
            if self.window.id() in last_build_target:
                BuildWithATBuild(self.window, pkg, last_build_target[self.window.id()]).start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号