These are chat archives for sbt/sbt

25th
May 2016
ayuudee
@ayuudee
May 25 2016 11:47
People of SBT: a quick question if anyone could help me. Is it possible to have an multi-project sbt project where one child project is an sbt-plugin and another depends on that plugin? I can't see that it could be (at least not in a single build.sbt) as I wouldn't be able to import the keys of the plugin in the root build.sbt. Thoughts?
ayuudee
@ayuudee
May 25 2016 11:57
Essentially, I've got a project with an sbt-web plugin which I'd like sibling projects to be able to depend on. Anyway, any help appreciated, but I'll keep digging. Thanks.
ayuudee
@ayuudee
May 25 2016 13:44
Was doing the right thing and filing on SO (apologies, only just notice the channel description) and noticed this: http://stackoverflow.com/questions/24228553/how-to-develop-sbt-plugin-in-multi-project-build-with-projects-that-use-it
Don't know how I missed it before, but this answers my question. Thanks.
Aaron S. Hawley
@ashawley
May 25 2016 17:49
Trying to write my first SBT task that calls the runMain task multiple times, but I run in to a compiler error: https://gist.github.com/ashawley/eaff3996a648d9339edb15b036870be3
Guillaume Martres
@smarter
May 25 2016 17:57
Is there a crude way to benchmark a task in sbt?
I'd like to run some task N times and take the average of the running time sbt outputs at the end
Aaron S. Hawley
@ashawley
May 25 2016 18:01
@smarter I second that. My next step was seeing if it was possible to call SBT tasks from eval
And have eval run the for-loop
Perry
@pfn
May 25 2016 18:06
eval sys.props("sbt.task.timings") = "true"
there's also sbt-optimizer
which does similar
but prettier
InTheNow
@InTheNow
May 25 2016 18:52
I'm just trying to fix the generation of scaladocs in cats. Running scaladoc from the command line, I can generate the docs, but not via sbt. Looking through the sbt code, it looks like there is no simple direct call to scaladoc - is that correct? So the general question is, what id sbt doing for scaladoc that is so different?
Aaron S. Hawley
@ashawley
May 25 2016 19:05
@InTheNow It's using sbt-unidoc, no?
InTheNow
@InTheNow
May 25 2016 19:05
Yes
But really that's just a call into Doc.scaladoc
Aaron S. Hawley
@ashawley
May 25 2016 19:06
So you ran the unidoc task?
InTheNow
@InTheNow
May 25 2016 19:07
yes
I see sbt uses its AnalyzingCompiler whereas in scala there is a DocFactory that is a "A simplified compiler instance"
InTheNow
@InTheNow
May 25 2016 19:12
Im wondering if I can use that in sbt/sbt-unidoc somehow
Looks like sbt does some smart caching etc, but for docs I would rather just call a simple compiler that works for docs
I'm using a local "hackable" sbt-unidoc so if anyone has some hints, I can easily hack away locally
this gist has the cmd line I'm using
it spews out a bunch of issues, but the generated docs look OK
eugene yokota
@eed3si9n
May 25 2016 19:21
@InTheNow could you report it to either sbt/sbt or sbt/sbt-unidoc Github issue?
I do like the idea of simpler implementation of doc rather than reusing the incremental compiler facility, if that's causing some of the issues
InTheNow
@InTheNow
May 25 2016 19:23
I can, np - but I would rather give you a working "prototype" if at all possible. eg calling the deprecated Doc.Scaladoc
if you have no easy suggestions, I'll just raise a new issue, np
eugene yokota
@eed3si9n
May 25 2016 19:24
I'd prefer a pull request too
InTheNow
@InTheNow
May 25 2016 19:24
:)
ok, bedtime for me, I'll carry on in morning and see how far I get
that's where sbt talks to the compiler bridge
InTheNow
@InTheNow
May 25 2016 19:29
ahh - nice
eugene yokota
@eed3si9n
May 25 2016 19:29
you need some contraption like that to abstract over Scala versions
InTheNow
@InTheNow
May 25 2016 19:30
so I could just call that from sbt-unidoc for now?
eugene yokota
@eed3si9n
May 25 2016 19:30
not sure what the failure of the unidoc is so i can't say if that's going to fix your issue or not
unidoc itself just gathers sources and passes it along to sbt
InTheNow
@InTheNow
May 25 2016 19:31
unidoc's not the issue, but it is easy to play with that
eugene yokota
@eed3si9n
May 25 2016 19:32
yea
if caching is the issue you might look into calling something in here directly too - https://github.com/sbt/sbt/blob/v0.13.11/main/actions/src/main/scala/sbt/Doc.scala
InTheNow
@InTheNow
May 25 2016 19:33
That's actually what I'm doing now ;)
So thx for the advice - looks like I'm heading in the right direction
eugene yokota
@eed3si9n
May 25 2016 19:33
but as you mentioned we might just need some lighter weight version of Scalac to avoid the implicits-created-by-macro issue
for Java side, I think we were heading towards calling the tool more directly iirc
InTheNow
@InTheNow
May 25 2016 19:37
the code you linked ^^ calls "xsbt.ScaladocInterface", "run", and that calls DocFactory so could give the required hook into scaladoc
fingers crossed, I'll look tomorrow
eugene yokota
@eed3si9n
May 25 2016 19:37
cool have gnite
InTheNow
@InTheNow
May 25 2016 19:38
:+1:
Vadim Shalts
@vshalts
May 25 2016 21:36
@ashawley if you still want to run task multiple times in SBT you need dynamic tasks (and dynamic input). In other case SBT will execute task just once (lazy evaluation and caching). This will work:
https://gist.github.com/vshalts/ed389bfb69b017f4dac7150cf0875529
Aaron S. Hawley
@ashawley
May 25 2016 21:41
@vshalts Nice! Hoping to use with runMain, and re-use the parser, but this looks pretty complicated
Vadim Shalts
@vshalts
May 25 2016 21:45
@ashawley yep, in this case you fight against SBT which try to do the best to not run task several times :)
Aaron S. Hawley
@ashawley
May 25 2016 21:50
My problem is I have multiple main classes
@vshalts But the prompt only happen once with runMany, so that's pretty awesome!
Vadim Shalts
@vshalts
May 25 2016 21:58
@ashawley you can replace run with runMain
(runMain in Compile).toTask(" " + args.mkString(" "))
and then second task parameter became name of class. Probably the way you want it.
Aaron S. Hawley
@ashawley
May 25 2016 22:02
@vshalts So it does! Thanks!