How to debug sbt itself? Is there anything like best practics?

300 views
Skip to first unread message

Ezh

unread,
Jun 23, 2012, 11:05:15 AM6/23/12
to simple-b...@googlegroups.com
For example, trivial situation, I add this to sbt plugin:

val key = AttributeKey[Int]("load-count")
val onLoadHook = (s: State) => {
    val previous = s get key getOrElse 0
    System.err.println("Project load count: " + previous)
    s.put(key, previous + 1)
    s.addExitHook(() => { System.err.print("!!!!!!!!!") })
}
onLoad in Global ~= (onLoadHook compose _)

I saw "Project load count: ...", but lost "!!!!!!!!!" output.
How to find the reason why addExitHook not working? I suspect that it must more simple than recompile sbt every time with huge System.err.print messages.
What is the best practice of sbt debug in general? Wiki hasn't such information.

Please without logLevel := ... pack of useless trace messages isn't a solution especially against interactive debugging. What you use to handle such issues?

Ezh

unread,
Oct 14, 2012, 6:07:00 AM10/14/12
to simple-b...@googlegroups.com
I did it. Now I may debug sbt projects or plugins at runtime in Eclipse with breakpoints, code lookup and so on.

look at https://github.com/sbt-android-mill/sbt-source-align. I create little video. Link at the bottom of description.

King regards,
Alexey

Reply all
Reply to author
Forward
0 new messages