This page is no longer maintained — Please continue to the home page at www.scala-lang.org

sbt11/scala-2.9.1 code coverage?

11 replies
d_m
Joined: 2010-11-11,
User offline. Last seen 35 weeks 2 days ago.

Greetings,

Does anyone have a good recipe for code coverage with sbt-11 and
scala-2.9.1? I was happily using scct with sbt-7 and scala-2.8 but
getting it to work with sbt-11 seems non-trivial (for me at least).

Does anyone here use scct in this way? Some other tool? I would love a
pointer to someone's github project which is doing code coverage with
sbt-11/scala-2.9.1.

Thanks,

Ismael Juma 2
Joined: 2011-01-22,
User offline. Last seen 42 years 45 weeks ago.
Re: sbt11/scala-2.9.1 code coverage?
On Wed, Jan 11, 2012 at 4:11 PM, Erik Osheim <erik [at] plastic-idolatry [dot] com> wrote:
Does anyone here use scct in this way? Some other tool? I would love a
pointer to someone's github project which is doing code coverage with
sbt-11/scala-2.9.1.

Have you seen:
https://github.com/quelgar/sbt-scct
Best, Ismael
Ismael Juma 2
Joined: 2011-01-22,
User offline. Last seen 42 years 45 weeks ago.
Re: sbt11/scala-2.9.1 code coverage?
On Wed, Jan 11, 2012 at 4:19 PM, Ismael Juma <ismael [at] juma [dot] me [dot] uk> wrote:
https://github.com/quelgar/sbt-scct

Oh, I noticed that this was merged to the main fork, so sorry for the noise.
Best,Ismael
d_m
Joined: 2010-11-11,
User offline. Last seen 35 weeks 2 days ago.
Re: sbt11/scala-2.9.1 code coverage?

On Wed, Jan 11, 2012 at 04:24:04PM +0000, Ismael Juma wrote:
> On Wed, Jan 11, 2012 at 4:19 PM, Ismael Juma wrote:
> >
> > https://github.com/quelgar/sbt-scct
> >
>
> Oh, I noticed that this was merged to the main fork, so sorry for the noise.

Ismael,

Thanks for your response. Have you been using the fork? I'm not having
any luck getting the plugin enabled in sbt11 (following a combining
of the README's instructions and the SBT wiki).

d_m
Joined: 2010-11-11,
User offline. Last seen 35 weeks 2 days ago.
Re: sbt11/scala-2.9.1 code coverage?

On Wed, Jan 11, 2012 at 01:23:07PM -0500, Erik Osheim wrote:
> Thanks for your response. Have you been using the fork? I'm not having
> any luck getting the plugin enabled in sbt11 (following a combining
> of the README's instructions and the SBT wiki).

(To clarify: it seems like that the fork only works with sbt-10. At
least, I can't get it working with sbt-11. I am probably going to put
this down for now but was just wondering what other people are doing.)

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: sbt11/scala-2.9.1 code coverage?

On Wed, Jan 11, 2012 at 14:11, Erik Osheim wrote:
> Greetings,
>
> Does anyone have a good recipe for code coverage with sbt-11 and
> scala-2.9.1? I was happily using scct with sbt-7 and scala-2.8 but
> getting it to work with sbt-11 seems non-trivial (for me at least).
>
> Does anyone here use scct in this way? Some other tool? I would love a
> pointer to someone's github project which is doing code coverage with
> sbt-11/scala-2.9.1.

There are two plugins listed in the wiki. Have you tested both?

d_m
Joined: 2010-11-11,
User offline. Last seen 35 weeks 2 days ago.
Re: sbt11/scala-2.9.1 code coverage?

On Wed, Jan 11, 2012 at 06:15:42PM -0200, Daniel Sobral wrote:
> There are two plugins listed in the wiki. Have you tested both?

I only saw the one plugin at:

https://github.com/dvc94ch/sbt-scct

I guess a deeper problem is that I don't really understand SBT plugins
well-enough to debug when they're not working. The final line from the
previous link's instructions doesn't seem to work for me, and I've
(haphazardly) tried a bunch of the strategies (without luck) from:

https://github.com/harrah/xsbt/wiki/Plugins

While this might very well be PEBKAC it's a bit frustrating that this
was so much easier previously (in sbt7). That's why I was wondering if
anyone else is actually using scct or has set this up correctly with
sbt11.

Thanks,

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: sbt11/scala-2.9.1 code coverage?

There's also a jacoco plugin listed at
https://github.com/harrah/xsbt/wiki/sbt-0.10-plugins-list under code
coverage.

On Wed, Jan 11, 2012 at 19:02, Erik Osheim wrote:
> On Wed, Jan 11, 2012 at 06:15:42PM -0200, Daniel Sobral wrote:
>> There are two plugins listed in the wiki. Have you tested both?
>
> I only saw the one plugin at:
>
>  https://github.com/dvc94ch/sbt-scct
>
> I guess a deeper problem is that I don't really understand SBT plugins
> well-enough to debug when they're not working. The final line from the
> previous link's instructions doesn't seem to work for me, and I've
> (haphazardly) tried a bunch of the strategies (without luck) from:
>
>  https://github.com/harrah/xsbt/wiki/Plugins
>
> While this might very well be PEBKAC it's a bit frustrating that this
> was so much easier previously (in sbt7). That's why I was wondering if
> anyone else is actually using scct or has set this up correctly with
> sbt11.
>
> Thanks,
>

Chris Twiner
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: sbt11/scala-2.9.1 code coverage?

That's looking interesting but doesn't work on sub-projects yet. Scct doesn't either for that matter, it hangs on sub-projects in a loop looking for changes in system properties that aren't seemingly ever changed at that time.

(seems like a task ordering issue but I have not been able to spend enough time on it to tell).

On Jan 11, 2012 10:31 PM, "Daniel Sobral" <dcsobral [at] gmail [dot] com> wrote:
There's also a jacoco plugin listed at
https://github.com/harrah/xsbt/wiki/sbt-0.10-plugins-list under code
coverage.

On Wed, Jan 11, 2012 at 19:02, Erik Osheim <erik [at] plastic-idolatry [dot] com> wrote:
> On Wed, Jan 11, 2012 at 06:15:42PM -0200, Daniel Sobral wrote:
>> There are two plugins listed in the wiki. Have you tested both?
>
> I only saw the one plugin at:
>
>  https://github.com/dvc94ch/sbt-scct
>
> I guess a deeper problem is that I don't really understand SBT plugins
> well-enough to debug when they're not working. The final line from the
> previous link's instructions doesn't seem to work for me, and I've
> (haphazardly) tried a bunch of the strategies (without luck) from:
>
>  https://github.com/harrah/xsbt/wiki/Plugins
>
> While this might very well be PEBKAC it's a bit frustrating that this
> was so much easier previously (in sbt7). That's why I was wondering if
> anyone else is actually using scct or has set this up correctly with
> sbt11.
>
> Thanks,
>
> -- Erik



--
Daniel C. Sobral

I travel to the future all the time.
dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: sbt11/scala-2.9.1 code coverage?

On Thu, Jan 12, 2012 at 04:31, Chris Twiner wrote:
> That's looking interesting but doesn't work on sub-projects yet. Scct
> doesn't either for that matter, it hangs on sub-projects in a loop looking
> for changes in system properties that aren't seemingly ever changed at that
> time.
>
> (seems like a task ordering issue but I have not been able to spend enough
> time on it to tell).

You should take this to the SBT mailing list. It's a fairly active
group, and people usually get their problems solved there.

d_m
Joined: 2010-11-11,
User offline. Last seen 35 weeks 2 days ago.
Re: sbt11/scala-2.9.1 code coverage?

On Wed, Jan 11, 2012 at 11:11:47AM -0500, Erik Osheim wrote:
> Does anyone here use scct in this way? Some other tool? I would love a
> pointer to someone's github project which is doing code coverage with
> sbt-11/scala-2.9.1.

Thanks to everyone who responded and helped out.

Just to follow up on my original post, I did get the sbt-scct project
[1] working for me. The big thing I had missed was syncing up the
build.settings sbt version in both the sbt-scct project and my own
project. Even when one was 0.11.0 and one was 0.11.2 things didn't
work. I should have realized this but didn't.

I also hadn't realized that you could have both build.sbt and
project/Build.scala (which we had already been using for some custom
caliper code). Now that I look I do see SBT documentation pointing this
out, so this was just my own ignorance.

I hope to write up a document that explains how to do this from start
to finish with all the necessary steps included, and submit it as a
patch for sbt-scct.

Anyway, thanks again for everyone's help!

mike.langen
Joined: 2012-01-18,
User offline. Last seen 38 weeks 2 days ago.
Re: sbt11/scala-2.9.1 code coverage?

I was struggling with this same problem yesterday. Here's what I
finally did to get sbt to pick up my "coverage:" tasks:

#1> I did a git clone git [at] github [dot] com:dvc94ch/sbt-scct.git into my
project directory
#2> I edited sbt-scct/project/build.properties to point to be:
sbt.version=0.11.2 and compiled using sbt 11.2
#3> I did a sbt publish-local in the sbt-scct project
#4> I edited my project/plugins.sbt and added:
addSbtPlugin("ch.craven" %% "scct-plugin" % "0.2")
#5> then I appendedmScctPlugin.scctSettings to my project's build
settings , i.e.

lazy val myProj = Project (
id = "myProj",
base = file ("."),
settings = buildSettings ++ ScctPlugin.scctSettings
)

On Jan 13, 3:15 pm, Erik Osheim wrote:
> On Wed, Jan 11, 2012 at 11:11:47AM -0500, Erik Osheim wrote:
> > Does anyone here use scct in this way? Some other tool? I would love a
> > pointer to someone's github project which is doing code coverage with
> > sbt-11/scala-2.9.1.
>
> Thanks to everyone who responded and helped out.
>
> Just to follow up on my original post, I did get the sbt-scct project
> [1] working for me. The big thing I had missed was syncing up the
> build.settings sbt version in both the sbt-scct project and my own
> project. Even when one was 0.11.0 and one was 0.11.2 things didn't
> work. I should have realized this but didn't.
>
> I also hadn't realized that you could have both build.sbt and
> project/Build.scala (which we had already been using for some custom
> caliper code). Now that I look I do see SBT documentation pointing this
> out, so this was just my own ignorance.
>
> I hope to write up a document that explains how to do this from start
> to finish with all the necessary steps included, and submit it as a
> patch for sbt-scct.
>
> Anyway, thanks again for everyone's help!
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland