These are chat archives for sbt/sbt

6th
Apr 2017
zergin
@zergin
Apr 06 08:02

hi sbt, I'd like to get some input from you if you don't mind.

I need to generate some large data structures that take too much time during applications startup but can easily be generated offline during build. I was thinking about binary serialization and creating an sbt task for this. I would then plug this task as part of release process and be a happy camper.

Here are my questions though:

  • any general thoughs? ;-)
  • can I (in a simple way) use app's classes or do I have to stick to native types and still do some post processing on startup?
    • how do I include apps dependencies? via a simple import?

I'm still looking into how to do it best. Any input is greatly appreciated.

Dale Wijnand
@dwijnand
Apr 06 08:20
Sounds very reasonable to me. Look at resource generators.
zergin
@zergin
Apr 06 08:27
this is nice, I haven't seen this - thanks.
Sam Halliday
@fommil
Apr 06 18:38
when is sbt supposed to save the history file?
just typed some commands and the file is empty
Ichoran
@Ichoran
Apr 06 19:08
The documentation doesn't seem to provide any information about using git repositories as dependencies (aside from listing it as the only example of external dependencies which are one of SBT's 13 features worth mentioning). Is this correct? Is this intentional?
Ryan Williams
@ryan-williams
Apr 06 20:12
I just published a blog post about recent experiences with Maven and SBT: http://www.hammerlab.org/2017/04/06/scala-build-tools/ possibly relevant to folks here! s/o to @dwijnand for lots of help in here several months ago when I was brand new to SBT :)
eugene yokota
@eed3si9n
Apr 06 20:19
@Ichoran it is sort of a well hidden secret of sbt feature. part of the problem I think was that it doesn't automatically update when new commits are added etc, but I don't know if the lack of docs is intentional
Sam Halliday
@fommil
Apr 06 20:20
sbt history file is a total mystery, still empty after several sessions.
eugene yokota
@eed3si9n
Apr 06 20:22
@ryan-williams cool. RTed
Paul Draper
@pauldraper
Apr 06 20:22
@Ichoran it's mentioned in the docs on build loaders http://www.scala-sbt.org/0.13/docs/Build-Loaders.html
But only in passing.
eugene yokota
@eed3si9n
Apr 06 20:23
@fommil I think it's controlled by JLine. do you customize something related there?
Paul Draper
@pauldraper
Apr 06 20:23
Not updating on branch change doesn't seem like a big deal, because I always go on tag or commit anyway.
Ichoran
@Ichoran
Apr 06 20:38
@pauldraper - Thanks, I think that suggests that what I want is possible. Do you know if there is a way to compose the default git BuildLoader so you can e.g. flatMap the result? (In this case--let it pull down the source, but point not at the full project but at a directory inside it?)
Paul Draper
@pauldraper
Apr 06 20:39
I've done stuff like that before, but it's been awhile.
Ichoran
@Ichoran
Apr 06 20:42
@pauldraper - If you have any examples, I'd be grateful! Otherwise, the time taken for me to automate this will probably exceed the time to do it manually by around 10-100x, so I ought to abandon it as not worth it.
Paul Draper
@pauldraper
Apr 06 20:42
Excuses :)
I was adding a build.sbt to an unpublished (Maven) dependency.
Sam Halliday
@fommil
Apr 06 20:51
@eed3si9n i don't think so. We disable jline on Windows, but I've left those days behind me.
Ichoran
@Ichoran
Apr 06 21:19
@pauldraper Thanks!
Ruben Fiszel
@rubenfiszel
Apr 06 21:27
Hello, I'd like to write an sbt plugin which add a command that basically do "run" and provide a list of arguments to the main program
Ideally, if there is multiple app, I would still like to be able to choose the app as usual with a number. If the user provide the name of the App, I would like to run that App.
I followed the sbt guide to make a plugin and I am able to make a command to display hi. I feel like I should be able to accomplish what I want by using a "runCommand" but I don't find any doc
eugene yokota
@eed3si9n
Apr 06 21:40
@rubenfiszel i'd write that as a dynamic task
Ruben Fiszel
@rubenfiszel
Apr 06 21:41
Could you give me more details please ?
eugene yokota
@eed3si9n
Apr 06 21:41
there's already a task called run in sbt
so if you want to extend its behavior, you'd have better luck staying on the task land rather going to commands
in general plugins should try to define tasks, not commands
because commands don't compose
Ruben Fiszel
@rubenfiszel
Apr 06 21:43
Oh, that makes sense. I guess I am not really sure of the difference between a task and a command but I should read the doc for that
eugene yokota
@eed3si9n
Apr 06 21:44
yea. definately read through getting started before tackling plugins - http://www.scala-sbt.org/0.13/docs/Getting-Started.html
Ruben Fiszel
@rubenfiszel
Apr 06 21:45
thanks
Harit Himanshu
@hhimanshu
Apr 06 21:50
How do I setup an SBT project to use Java 7? I need to be able to run the final artifact on Java 7 JVM. The current versions 0.13.13 uses Java 8
I see
Error:Error while importing SBT project:<br/>...<br/><pre>at sbt.MainLoop$.runWithNewLog(MainLoop.scala:65)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:48)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:32)
at sbt.MainLoop$.runLogged(MainLoop.scala:24)
at sbt.StandardMain$.runManaged(Main.scala:53)
at sbt.xMain.run(Main.scala:28)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
[error] sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.
[error] Note that conflicts were resolved for some dependencies:
[error]     org.slf4j:slf4j-api
[error] Use 'last' for the full log.
Invalid response.</pre><br/>See complete log in <a href="file:/Users/Harit.Himanshu/Library/Logs/IntelliJIdea2017.1/sbt.last.log">file:/Users/Harit.Himanshu/Library/Logs/IntelliJIdea2017.1/sbt.last.log</a>
Jan Christopher Vogt
@cvogt
Apr 06 22:08
How can I produce/find that xml-like file that shows the ivy resolution results and can only be opened in firefox? I can’t remember.
ritschwumm
@ritschwumm
Apr 06 22:28
Ruben Fiszel
@rubenfiszel
Apr 06 22:35
@eed3si9n so I've read the doc. But I'd like to find where the run task is defined to make my own custom one. Cause (runMain in compile).toTask("A" + args) is gonna call A but I might not known the name of the main in advance
not know*
eugene yokota
@eed3si9n
Apr 06 22:37
it's in Defaults.scala
in general you can run inspect runfrom the shell to find out where a task was defined
@cvogt under target/resolution-cache/reports
update task creates that as a side effect
show update also should display rich enough info
Jan Christopher Vogt
@cvogt
Apr 06 22:45
@eed3si9n ah, great. And this is obviously not generated when using coursier. Mystery solved. Thx man!
Ruben Fiszel
@rubenfiszel
Apr 06 22:46
@eed3si9n Ok, thanks a lot. So I guess, I should write my custom version of runTask that doesn't call the parser right ?
and call runTask from my custom defined task