These are chat archives for sbt/sbt

1st
Aug 2016
Simon Hafner
@reactormonk
Aug 01 2016 09:40
IS there a way to enable logging implicits in console?
Dale Wijnand
@dwijnand
Aug 01 2016 10:11
scalacOptions in (Compile, console)
There's also a way while in the REPL but I forget how that's done
felher
@felher
Aug 01 2016 13:33
Hey folks, can I run the compiler error messages through some pipe/function to do some simple search-and-replace operations before sbt prints them?
Alexey Alekhin
@laughedelic
Aug 01 2016 13:47
@felher probably this is what you want?
felher
@felher
Aug 01 2016 14:01
laughedelic: yeah, that's exactly it. It's a bit more heavy-weight than I thought, so. I'll just pipe sbt to sed for now. Thanks :)
Alexey Alekhin
@laughedelic
Aug 01 2016 14:02
:+1:
Alexey Alekhin
@laughedelic
Aug 01 2016 19:39
by the way, when did compilerReporter become a private key? is there a way to set it now?
Perry
@pfn
Aug 01 2016 19:51
@laughedelic, just define the key yourself
val creporter = SettingKey[CompilerReporter]("compilerReporter", "")
Dale Wijnand
@dwijnand
Aug 01 2016 19:59
hehehe
Alexey Alekhin
@laughedelic
Aug 01 2016 21:23
Thanks @pfn! I didn't know that I can do it like this.
Mike Mazur
@mikem
Aug 01 2016 22:43

I have a multi-project. In my root build.sbt file I have some common settings and two subproject definitions:

lazy val commonSettings = Seq(/* … */)

lazy val core = (project in file(“core”)).settings(commonSettings: _*)

lazy val web = (project in file(“web”)).settings(commonSettings: _*).
  dependsOn(core % “compile->compile;test->test”)

lazy val root = (project in file(“.”)).settings(commonSettings: _*).
  aggregate(core, web)

In core/build.sbt and web/build.sbt I define name and append to libraryDependencies. Both subprojects have the same dependency and I’d like to extract that dependency’s version into a variable somehow. Something like this works locally (within the same build.sbt file):

val libVersion = “1.2.3”

libraryDependencies += “org” %% “lib” % libVersion

This doesn’t work when libVersion is defined in build.sbt and referenced in core/build.sbt. I also tried to define a settingsKey in the root build.sbt and access libVersion.value in the subproject build.sbt but that failed as well.

Why is this happening? I’d like to understand how sbt separates the scope of the build.sbt files between subprojects. Maybe there’s something about scopes I’m not understanding?

Perry
@pfn
Aug 01 2016 23:34
local variables don't cross file boundaries in sbt files, @mikem
@mikem if you want to have shared variables, define them in a scala file within any arbitrary object of your choosing