Is there some way to log passed compiler phases?

61 views
Skip to first unread message

Rogach

unread,
Jul 4, 2013, 5:10:02 AM7/4/13
to simple-b...@googlegroups.com
I have a project, that usually compiles for 30-60 seconds. It would be really nice if there was some way to print a message to sbt console when one of compiler phases finishes (so to provide some progress indication).

Is there some built-in way to do this?

Mark Harrah

unread,
Jul 4, 2013, 7:03:01 PM7/4/13
to simple-b...@googlegroups.com
There is not a built-in progress indicator. There is a CompileProgress interface, but it is not exposed:

https://github.com/sbt/sbt/blob/0.13/interface/src/main/java/xsbti/compile/CompileProgress.java

https://github.com/sbt/sbt/blob/0.13/compile/integration/src/main/scala/sbt/compiler/AggressiveCompile.scala#L23

There isn't a general mechanism in sbt for providing a progress indicator in a concurrent build environment. The "Resolving ..." messages can overwrite previous ones because only one 'update' is allowed to run at a time. I'm not sure how it would work for multiple compiles running at the same time.

-Mark

>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-t...@googlegroups.com.
> To post to this group, send email to simple-b...@googlegroups.com.
> Visit this group at http://groups.google.com/group/simple-build-tool.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Grzegorz Kossakowski

unread,
Jul 5, 2013, 7:50:28 PM7/5/13
to simple-b...@googlegroups.com
On 4 July 2013 16:03, Mark Harrah <dmha...@gmail.com> wrote:
On Thu, 4 Jul 2013 02:10:02 -0700 (PDT)
Rogach <platon...@gmail.com> wrote:

> I have a project, that usually compiles for 30-60 seconds. It would be
> really nice if there was some way to print a message to sbt console when
> one of compiler phases finishes (so to provide some progress indication).
>
> Is there some built-in way to do this?

There is not a built-in progress indicator.  There is a CompileProgress interface, but it is not exposed:

 https://github.com/sbt/sbt/blob/0.13/interface/src/main/java/xsbti/compile/CompileProgress.java

 https://github.com/sbt/sbt/blob/0.13/compile/integration/src/main/scala/sbt/compiler/AggressiveCompile.scala#L23

There isn't a general mechanism in sbt for providing a progress indicator in a concurrent build environment.  The "Resolving ..." messages can overwrite previous ones because only one 'update' is allowed to run at a time.  I'm not sure how it would work for multiple compiles running at the same time.

What about the idea that each concurrent process gets separate buffer of fixed number of lines assigned (a box, almost like a window) to it and then sbt would concatenate them one after another?

This way each process could log at their pace and user would get a nice overview if number of processes is not too large (e.g. up to 8) which is exactly the case when people compile projects.

--
Grzegorz Kossakowski
Scalac hacker at Typesafe
twitter: @gkossakowski

Doug Tangren

unread,
Jul 6, 2013, 12:08:52 AM7/6/13
to simple-b...@googlegroups.com


On Jul 5, 2013 7:50 PM, "Grzegorz Kossakowski" <grzegorz.k...@gmail.com> wrote:
>
> On 4 July 2013 16:03, Mark Harrah <dmha...@gmail.com> wrote:
>>
>> On Thu, 4 Jul 2013 02:10:02 -0700 (PDT)
>> Rogach <platon...@gmail.com> wrote:
>>
>> > I have a project, that usually compiles for 30-60 seconds. It would be
>> > really nice if there was some way to print a message to sbt console when
>> > one of compiler phases finishes (so to provide some progress indication).
>> >
>> > Is there some built-in way to do this?
>>
>> There is not a built-in progress indicator.  There is a CompileProgress interface, but it is not exposed:
>>
>>  https://github.com/sbt/sbt/blob/0.13/interface/src/main/java/xsbti/compile/CompileProgress.java
>>
>>  https://github.com/sbt/sbt/blob/0.13/compile/integration/src/main/scala/sbt/compiler/AggressiveCompile.scala#L23
>>
>> There isn't a general mechanism in sbt for providing a progress indicator in a concurrent build environment.  The "Resolving ..." messages can overwrite previous ones because only one 'update' is allowed to run at a time.  I'm not sure how it would work for multiple compiles running at the same time.
>
>
> What about the idea that each concurrent process gets separate buffer of fixed number of lines assigned (a box, almost like a window) to it and then sbt would concatenate them one after another?
>

+1

> This way each process could log at their pace and user would get a nice overview if number of processes is not too large (e.g. up to 8) which is exactly the case when people compile projects.
>
> --
> Grzegorz Kossakowski
> Scalac hacker at Typesafe
> twitter: @gkossakowski
> github: @gkossakowski
>

Mark Harrah

unread,
Jul 8, 2013, 11:35:52 AM7/8/13
to simple-b...@googlegroups.com
I agree that a nonlinear display might be the only way to make it work. I don't know that it would work in practice or not. A nonlinear display would probably fragment and need constant rearranging, which could be confusing. There are many short-lived tasks or tasks that won't do status updates. I think there would have to be a new Logger method for status updates and one window would have to be for normal linear logging.

In any case, it would be interesting to see someone create a prototype and to see if it runs into these or other problems.

-Mark
Reply all
Reply to author
Forward
0 new messages