These are chat archives for sbt/sbt

20th
Jan 2017
nafg
@nafg
Jan 20 02:19
on CI, sbt hangs (freezes) after this:

[debug] Framework implementation 'org.specs.runner.SpecsFramework' not present.
[debug] Subclass fingerprints: List((org.scalacheck.Properties,false,org.scalacheck.ScalaCheckFramework$$anon$3@78288a7c), (org.scalacheck.Prop,false,org.scalacheck.ScalaCheckFramework$$anon$3@55f8b68a), (org.scalacheck.Properties,true,org.scalacheck.ScalaCheckFramework$$anon$3@3f793a22), (org.scalacheck.Prop,true,org.scalacheck.ScalaCheckFramework$$anon$3@12ff155), (org.specs2.specification.core.SpecificationStructure,true,specs2 Specification fingerprint), (org.specs2.specification.core.SpecificationStructure,false,specs2 Specification fingerprint), (org.scalatest.Suite,false,org.scalatest.tools.Framework$$anon$1@3d68f066), (junit.framework.TestCase,false,com.novocode.junit.JUnit3Fingerprint@2d344da7))
[debug] Annotation fingerprints: List((org.scalatest.WrapWith,false,org.scalatest.tools.Framework$$anon$2@5b6ada09), (org.junit.runner.RunWith,false,com.novocode.junit.RunWithFingerprint@25312d68), (org.junit.Test,false,com.novocode.junit.JUnitFingerprint@5f201268))
[debug] javaOptions: List()
[debug] Forking tests - parallelism = false
[debug] Create a single-thread test executor
[error] Uncaught exception when running tests: java.lang.IllegalStateException: Cannot instantiate configuration from URL 'null'.
Anyone around that can help?
Pradyuman Vig
@pradyuman
Jan 20 05:20
Is there any way for me to create a basic build.sbt that I can then import into other build.sbts? The majority of my build.sbt's look very similar and it would be nice to just have a base build that I can include in a common library and import that
Pradyuman Vig
@pradyuman
Jan 20 05:46
basically I'm wondering how to create a plugin that can import the commands from other plugins and set build settings
marios iliofotou
@imarios
Jan 20 05:50
Yes a plugin is what you need. The docs online are pretty good
nafg
@nafg
Jan 20 06:26
If project A aggregates project B, is there any way to get sbt to run a command on A without running it on B?
so how do I enable a plugin that isn't an auto plugin in an object that extends AutoImport?
I want to add settings for that plugin
but I need to explicitly enable it
Pradyuman Vig
@pradyuman
Jan 20 06:46
@imarios any idea about this?
marios iliofotou
@imarios
Jan 20 06:50
enablePlugin(nameofplugin)
Pradyuman Vig
@pradyuman
Jan 20 06:51
can I just do this in the constructor?
holy shit I'm stupid
not found: value enablePlugins
that's the error I get
actually sbt docker is an auto plugin
so why can sbt not see those keys?
marios iliofotou
@imarios
Jan 20 06:53
Wait, maybe post a gist or show some code snippet
Pradyuman Vig
@pradyuman
Jan 20 06:54
on it
marios iliofotou
@imarios
Jan 20 06:54
Where? Are you in a build.sbt file? R u inside your plugin code? Where r u?
that's my scala file for the plugin
this is my plugins.sbt
marios iliofotou
@imarios
Jan 20 06:57
Ok so u need to add the plugin in you sbt file. The build.sbt of your plugin project
Pradyuman Vig
@pradyuman
Jan 20 06:58
yup it's also there
marios iliofotou
@imarios
Jan 20 06:58
Not the project/plugin.sbt
Pradyuman Vig
@pradyuman
Jan 20 06:58
it's in both places
also I'm using the "name" key on line 46 of the plugin file
marios iliofotou
@imarios
Jan 20 06:58
You can then use its settings as if they were another library u use
Pradyuman Vig
@pradyuman
Jan 20 06:58
that's something I want the project using my plugin to define
oh hmm, I'm not sure why it's not working then
marios iliofotou
@imarios
Jan 20 06:59
Import it
Pradyuman Vig
@pradyuman
Jan 20 06:59
ohh how do I import it?
import sbtdocker;?
I'm not sure where to get the path of those dependencies
marios iliofotou
@imarios
Jan 20 07:00
Yes, add the full path as u see in itsplugins project
Let me find this out
in this case it's just sbtdocker
but importing that doesn't work
marios iliofotou
@imarios
Jan 20 07:02
yes, that should be it
Pradyuman Vig
@pradyuman
Jan 20 07:02
I also tried import sbtdocker._
marios iliofotou
@imarios
Jan 20 07:02
(remove the enablePlugin() thing we discussed before)
Pradyuman Vig
@pradyuman
Jan 20 07:02
thanks for all the help so far by the way
yeah I removed that
marios iliofotou
@imarios
Jan 20 07:03
np I tried something similar few weeks back and I can relate
u try to access a particular setting?
Pradyuman Vig
@pradyuman
Jan 20 07:04
gimme a sec I'll upload my errors
not found: value dockerfile
dockerfile in docker := {
value Argument is not a member of sbt.Configuration
testOptions in Test += Test.Argument("-oDF"),
things like that
marios iliofotou
@imarios
Jan 20 07:06
import sbtdocker.DockerPlugin
...
DockerPlugin.dockerfile
Pradyuman Vig
@pradyuman
Jan 20 07:07
value dockerfile is not a member of object sbtdocker.DockerPlugin
marios iliofotou
@imarios
Jan 20 07:08
DockerPlugin.autoImport.dockerfile?
sbtdocker.DockerKeys.dockerfile?
Pradyuman Vig
@pradyuman
Jan 20 07:10
checking one sec
import sbtdocker.DockerPlugin.autoImport._
this worked
holy shit
thanks
I wonder why it isn't autoimporting
also I still have this error: value Argument is not a member of sbt.Configuration
testOptions in Test += Test.Argument("-oDF"),
marios iliofotou
@imarios
Jan 20 07:12
The plugin author didn't do the import autoImport._ as he/she should have
not sure why
so the settings are not freely visible in the DockerPlugin object
Pradyuman Vig
@pradyuman
Jan 20 07:12
oh wow
same for sbt-assembly
and for sbt-buildinfo
all of them didn't do that I guess
marios iliofotou
@imarios
Jan 20 07:13
maybe they know something more ... I wonder
Pradyuman Vig
@pradyuman
Jan 20 07:13
yea I'll make a task to look into it later
marios iliofotou
@imarios
Jan 20 07:13
haha, oh well, I hope it had a happy ending for you
Pradyuman Vig
@pradyuman
Jan 20 07:14
yea haha
also do you know how to get the "name" key from the project using my plugin?
I want to use it but I'm not sure how to get that
right now I'm just using it like s"$name.hi"
but I'm not sure if that's actually the way to get it
marios iliofotou
@imarios
Jan 20 07:15
you should access it as a regular sbt key. name.value
Pradyuman Vig
@pradyuman
Jan 20 07:16
nice
cool
thanks so much
I'll do some research into the test options thing that wasn't working
and then I should be good
marios iliofotou
@imarios
Jan 20 07:16
sound good, have fun!
Pradyuman Vig
@pradyuman
Jan 20 07:16
thanks!
Olli Helenius
@liff
Jan 20 13:19
is it possible to use sbt-assembly to build a jar with dependencies included in /lib as jar files inside the jar?
instead of just extracted
OlegYch
@OlegYch
Jan 20 13:48
that would require unsavory classloading magic
sbt-onejar does that afaik
Olli Helenius
@liff
Jan 20 13:49
i'm building a plugin for a system that takes care of the magic
sbt-onejar looks more like it, thanks
Olli Helenius
@liff
Jan 20 14:15
well onejar does a bit too much
but turns out i can do just:
mappings in (Compile, packageBin) ++= {
  (dependencyClasspath in Runtime).value map { lib =>
    lib.data -> s"lib/${lib.data.name}"
  }
}
roughly
Andreas
@amuttsch
Jan 20 15:28
I have two separate sbt projects, one project and one dependency. Can I trigger the build of the project after the dependency was compiled with sbt compile? I found ProjectRef and added it to the build.scala of the dependency, but wasn't sure how to use it for my purpose. Adding it as a Project didn't work either, because import statements didn't find the classes. Thanks
Francisco R. Arias
@ariasf
Jan 20 16:41
Does anyone knows how to make the compille (sbt assembly) multi threaded ?
so it downloads dependecies faster ?
OlegYch
@OlegYch
Jan 20 16:45
so compile, assembly, or downloading dependencies?
sbt-coursier might help with downloading dependencies
Francisco R. Arias
@ariasf
Jan 20 16:51
thanks @OlegYch I will google it and see what's up
Francisco R. Arias
@ariasf
Jan 20 17:04
does it make dowloading dependecies faster ?
Justin Kaeser
@jastice
Jan 20 17:08
yes
Francisco R. Arias
@ariasf
Jan 20 17:08
awesome
Sam Halliday
@fommil
Jan 20 17:25
hmm, how come this isn't affecting the doc flags scalacOptions in (Compile, doc) -= "-Xfatal-warnings"
the new scaladoc tool doesn't match javac behaviour
Sam Halliday
@fommil
Jan 20 17:34
even scalacOptions in (Compile, doc) := Nil seems to be ignored show doc:scalacOptions is showing a lot of parameters
OlegYch
@OlegYch
Jan 20 18:17
perhaps you're setting it for wrong project
Sam Halliday
@fommil
Jan 20 18:17
nope, definitely in the settings of teh project
run show monkeys/doc:scalacOptions it will show the full scalacOptions
(btw you'll only see -Xfatal-warnings in this repo if you start sbt with CI=true)
OlegYch
@OlegYch
Jan 20 18:28
scalacOptions in (Compile, doc) := List("-blabla") correctly errors out for me
i mean causes doc to fail
Sam Halliday
@fommil
Jan 20 18:29
but is it removing flags that are used by scalac?
it seems this adds to, not redefines, those flags
because of regressions in scaladoc, we need to tell it to not have certain warning checks
try putting fatal-warnings in scalacOptions, and try to remove it in scaladoc. I can't see how to do it
OlegYch
@OlegYch
Jan 20 18:31
scalacOptions in (Compile, doc) -= ("-blabla") fixes doc
Sam Halliday
@fommil
Jan 20 18:31
that doesn't work for me
OlegYch
@OlegYch
Jan 20 18:32
;set scalacOptions in (Compile) in common := List("-ololo"); set scalacOptions in (Compile, doc) in common -= ("-ololo"); common/doc; common/compile
doc works, compile fails
Sam Halliday
@fommil
Jan 20 18:34
my scalacOptions are being set in an sbt plugin, I wonder if the semantics are different there (they shouldn't be!)
OlegYch
@OlegYch
Jan 20 18:35
scalacOptions in (Compile, doc) in common -= ("-ololo") actually is a noop here because (Compile, doc) overrides Compile if set
(i believe)
perhaps you wanted scalacOptions in (Compile, doc) := (scalacOptions in Compile).value.filterNot(_ == "-Xfatal-warnings"`)
Sam Halliday
@fommil
Jan 20 18:38
yeah, that might be it because my code might be running to filter before the value is put in there
nope, that doesn't work either
show monkeys/doc:scalacOptions
...
[info] * -Xfatal-warnings
OlegYch
@OlegYch
Jan 20 18:43
yeah, i was wrong, scalacOptions in (Compile, doc) actually inherits from scalacOptions in (Compile)
Sam Halliday
@fommil
Jan 20 18:43
that's what I would have assumed
OlegYch
@OlegYch
Jan 20 18:46
scalacOptions in (Compile, doc) is compile:doc::scalacOptions
no idea what doc:scalacOptions is
Sam Halliday
@fommil
Jan 20 18:46
ah, interesting, so maybe I should be testing by doing doc instead of reading the wrong thing
OlegYch
@OlegYch
Jan 20 18:47
yeah
Dale Wijnand
@dwijnand
Jan 20 18:47
having a look
Sam Halliday
@fommil
Jan 20 18:48
ok, thanks @OlegYch I had the answer all along, I've just been looking in the wrong setting to confirm my change
Dale Wijnand
@dwijnand
Jan 20 18:50
all good now?
Sam Halliday
@fommil
Jan 20 18:50
looks like it!
Dale Wijnand
@dwijnand
Jan 20 18:50
cool
OlegYch
@OlegYch
Jan 20 18:51
what's doc:scalacOptions though?
Dale Wijnand
@dwijnand
Jan 20 18:52
the scalac options that are passed to scaladoc
OlegYch
@OlegYch
Jan 20 18:53
doesn't look like it
i thought : separates config from key
Dale Wijnand
@dwijnand
Jan 20 19:18
doc is the scaladoc task
actualy you're right Oleg, it's doc::scalacOptions
OlegYch
@OlegYch
Jan 20 19:21
right
Dale Wijnand
@dwijnand
Jan 20 19:21

so @fommil's

show monkeys/doc:scalacOptions
...
[info] * -Xfatal-warnings

is basically show monkeys/doc:scalacOptions or show monkeys/compile:scalacOptions

he meant to do show monkeys/doc::scalacOptions
Dan Di Spaltro
@dispalt
Jan 20 19:25
Does sbt 0.13.13 use nio file watcher?
Sam Halliday
@fommil
Jan 20 19:25
no, it is java 6
Dan Di Spaltro
@dispalt
Jan 20 19:25
thought so my ssd must be wearing down =(
will 1.0 use nio?
Sam Halliday
@fommil
Jan 20 19:27
ensime has an impl, we offered (an older Apache 2 version) it if they want it. Probably me and alex would be happy to relicence the updated gpl3 one too as apache2
the ensime workflow recommends file hooks rather than file watchers, so compile/test actions are push rather than pull
Dan Di Spaltro
@dispalt
Jan 20 19:33
not sure what the last point means, I am looking to speed up ~compile and the like.
Sam Halliday
@fommil
Jan 20 19:33
I mean, setting up your editor to run compile when you save a file is a more efficient way of doing that
even if you have nio file watchers implementing ~compile
Dan Di Spaltro
@dispalt
Jan 20 19:34
oh right, yes, I agree
Dale Wijnand
@dwijnand
Jan 20 19:34
1.0 can use nio, as it's java 8
Dan Di Spaltro
@dispalt
Jan 20 19:34
@fommil i use intellij at the moment, but only for nav
Sam Halliday
@fommil
Jan 20 19:34
@dwijnand doesn't the sbt server mean that the ~ feature is irrelevant? all editors could support sending the command
will simplify the codebase
Dale Wijnand
@dwijnand
Jan 20 19:35
sbt shell will still be a thing
also, all editors "could" support sending the command, but they might not, so we probably should keep ~
it's probably an insignificant amount of code in the codebase
Dan Di Spaltro
@dispalt
Jan 20 21:17
@dwijnand is there a plan to move ~ functionality to nio?
Dale Wijnand
@dwijnand
Jan 20 21:42
Not from the Lightbend team. It's a nice to have, anyone's free to contribute it.
Dan Di Spaltro
@dispalt
Jan 20 22:38
it’s the only that keeps me on play, the fast reload
And to finish that thought, I think sbt-revolver’s slowness is related to how it watches
Ben McCann
@benmccann
Jan 20 22:54
I believe that SBT watches file while the Java API only supports directories. I had some discussion on this here: https://groups.google.com/forum/#!topic/play-framework-dev/3Ef79jtP48g
Also you only need java 7 to use java's WatchService: https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html
Dale Wijnand
@dwijnand
Jan 20 23:00
except that still polls on macOS IIUC
Sam Halliday
@fommil
Jan 20 23:29
We have an impl in ensime, nobody needs to write any new code, somebody just needs to port the code to sbt 1.0
Osx works i think but it's quite laggy