分析 sbt 构建 [英] Profiling sbt builds

查看:50
本文介绍了分析 sbt 构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要很长时间的 sbt 版本.它又大又复杂,很难知道从哪里开始清理.似乎 sbt 保留了很多关于构建结构的元数据,具有相互依赖性、命名任务、范围等.有了所有这些元数据,似乎很容易跳入并测量每个不同的任务,以及范围,需要多少时间.在代码中而不是基于日志消息执行此操作不仅感觉更干净,而且具有很好地处理并发构建和其他可能导致日志时间误导的复杂内容的优势.

I have an sbt build that takes ages. It's big and complex and it's hard to know where to start cleaning it up. It seems like sbt retains a lot of metadata about the structure of the build, with interdependencies, named tasks, scoping, and so on. With all this metadata, it seems like it would be quite easy to jump in and measure how much time each distinct task, with scope, takes. Doing this in code rather than based on log messages not only feels cleaner, but has the advantage of dealing nicely with concurrent builds and other complicated stuff that could cause the log times to be misleading.

目前是否有任何设施可以做到这一点?感觉不像我们可以在用户"构建中做的事情,但也许 SBT 插件可以挂钩任务启动器并在最后维护/生成一个大的计时报告.这真的有助于我将精力集中在改进缓慢的事情上,而不会在立即发生的事情上浪费时间.

Are there any facilities to do this currently? It doesn't feel like something we could do in a "user" build, but perhaps an SBT plugin could hook a task starter and maintain/produce a big report of timings at the end. It would really help focus my efforts on improving the slow things without wasting time on things that happen instantly.

推荐答案

我前段时间遇到了完全相同的问题.查看https://github.com/sbt-android-mill/的源码sbt-android-mill

I had absolutely the same problem some time ago. Look at source code of https://github.com/sbt-android-mill/sbt-android-mill

这里是公告 - https://groups.google.com/forum/#!msg/scala-on-android/TsmmJA4uvQ4/LMvAxuovXoMJ 注意 SBT 日志中的时间字段.

Here is announce - https://groups.google.com/forum/#!msg/scala-on-android/TsmmJA4uvQ4/LMvAxuovXoMJ Pay attention to time field in SBT log.

很少的包装器+诸如秒表之类的东西(在依赖项中),您将拥有带有分析统计数据的有吸引力的 HTML 报告.

Few wrappers + something like stopwatch(in dependencies) and you will have attractive HTML reports with profiling statistics.

这篇关于分析 sbt 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆