These are chat archives for sbt/sbt

25th
Sep 2015
Perry
@pfn
Sep 25 2015 04:02
    def collectSubAar(ps: Seq[ProjectRef]): Seq[AarLibrary] = ps flatMap { p =>
      val aarlibs = Project.runTask(libraryProjects in(p, Android), st).collect {
        case (_, Value(value)) => value
      }.fold(Seq.empty[AarLibrary])(_ collect {
        case a: AarLibrary => a
      })
      val sub = Project.getProject(p, struct)
      aarlibs ++ sub.fold(Seq.empty[AarLibrary])(s => collectSubAar(s.dependencies.map(_.project)))
    }
my main concern is getting that to run well
but I have no idea how to make it so that runTask doesn't force the task to be run over and over again
or should I be folding over the state
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:19
how does on use the set command in sbt console to set a key for a specific config
stuff like set mainDatabase:flywayDriver := “rawr"
doesn’t seem to work
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:31
neither does set flywayDriver in MainDatabase := “rawr”
MainDatabase is just some config with settings in it
Perry
@pfn
Sep 25 2015 05:32
in works fine
if MainDatabase hasn't been imported, you'll need to qualify it
and as for my recursive runTask, I guess I can solve that with my buildWith() function to do: transitiveAars in Android <++= aars in Android in p,
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:33
@pfn I have something like this
lazy val DatabaseOne = config("DatabaseOne") describedAs "Database migrations for DatabaseOne"

lazy val DatabaseTwo = config("DatabaseTwo") describedAs "Database migrations for DatabaseTwo"

lazy val DatabaseThree = config("DatabaseThree") describedAs "Database migrations DatabaseThree"

inConfig(DatabaseOne)(flywaySettings)
inConfig(DatabaseTwo)(flywaySettings)
inConfig(DatabaseThree)(flywaySettings)

flywayDriver in DatabaseOne := "org.postgresql.Driver"

flywayDriver in DatabaseTwo := "org.postgresql.Driver"

flywayDriver in DatabaseThree := "org.postgresql.Driver"

flywayLocations in DatabaseOne := Seq("db/databaseone/migration/")

flywayLocations in DatabaseTwo := Seq("db/databasetwo/migration/")

flywayLocations in DatabaseThree := Seq("db/databasethree/migration/")
Perry
@pfn
Sep 25 2015 05:34
you should be able to do set flywayDriver in DatabaseOne := "foo" just fine
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:34
yeh, that doesn’t work
Perry
@pfn
Sep 25 2015 05:36
then it's because it's not imported
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:36
so how would you import that into sbt?
Perry
@pfn
Sep 25 2015 05:36
dunno, where do you have that defined
stuff in .sbt doesn't get its namespace shared
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:36
this is just in build.sbt
so how do I share its namespace?
Perry
@pfn
Sep 25 2015 05:37
define it in Build in .scala
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:37
ps, i get something like error: not found: value DatabaseOne
when doing flywayDriver in DatabaseOne := “rawr"
@pfn Okay thanks, where exactly is this documented?
seems really obstrusive to me
Perry
@pfn
Sep 25 2015 05:39
vals in .sbt are not imported to be visible to other things
dunno where it's documented,
you can do set flywayDriver in config("DatabaseOne") := "foo"
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:40
will that reuse the same config thats used in build.sbt?
Perry
@pfn
Sep 25 2015 05:41
that's how it's defined and stored
config("X") == config("X")
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:41
ah cool, thanks
I put it in a .scala file, so will see if that works
Perry
@pfn
Sep 25 2015 05:42
and it needs to be in Build to automatically be in scope, otherwise you'll need to qualify the name
Matthew de Detrich
@mdedetrich
Sep 25 2015 05:59
@pfn Thanks that worked
Sometimes I wish they would have gotten rid of the build.sbt format
There are so many weird edge cases that don’t make sense
Perry
@pfn
Sep 25 2015 06:06
I dunno about so many...
matanster
@matanster
Sep 25 2015 09:19
Is there any way to make a compiler plugin "get" the same classpath as the rest of the compilation? It was hinted at http://www.scala-lang.org/old/node/6664 that sbt can take care of it, but I see no evidence of that in practice, looks like sbt-assembly is the only way to go.
Am I missing something?
matanster
@matanster
Sep 25 2015 09:24
Can I alternatively by some twisted chance leverage -Xplugin-opt for that purpose?
Raúl Raja Martínez
@raulraja
Sep 25 2015 11:19
Hello everyone! I'm using circle CI to build a fairly large project that is currently taking over 1h to build with sbt. I'm attempting to cache the target folder of all the submodules between builds in order to reduce build times. The issue is that Circle is overwriting the sources location alltogether getting rid of the compiled target as well. Is there a way to tell SBT to use other target folders that are not under the actual myModule/target so I can preserve compiled classes between builds and take advantage of SBT's incremental compilation and test reports?
Any help is appreciated, thanks!
Erik LaBianca
@easel
Sep 25 2015 14:07
@raulraja I’ve not had any luck trying to do the same… it would be really cool if you could somehow relocate all the sub-projects target folders under the main project or something but I haven’t found a way.
Raúl Raja Martínez
@raulraja
Sep 25 2015 14:14

@easel Not sure if this will help you but our current super dirty workaround is zipping up all targets after successful compilation and rehydrating it atop the project structure after Circle checkouts from git. Something in these lines:
After succesful compile and test run

tar czfvv targets.tar.gz ./modules/*/target

Then before next compile and test runs

tar xzfv targets.tar.gz
Erik LaBianca
@easel
Sep 25 2015 14:15
Yeah I’ve expiremented doing the same thing except with links into the “cache” directory on codeship. I’m not confident it’s been working though, maybe I’ll try your tar version =p
Dale Wijnand
@dwijnand
Sep 25 2015 14:22
CI loses value when you cache derivatives
Raúl Raja Martínez
@raulraja
Sep 25 2015 14:23
agreed, but this is only for non master builds before merges to quickly test changing tests
merges to master and deployment run without a cache
Erik LaBianca
@easel
Sep 25 2015 14:27
CI also loses value if it slows down your cycle time =p
Dale Wijnand
@dwijnand
Sep 25 2015 14:28
correctness is dog, performance is tail
Erik LaBianca
@easel
Sep 25 2015 14:30
Sure, certainly not something worth argueing over. But that said, SBT’s performance in a CI scenario tends to be painful just due to library resolution time, let alone caching build artifacts.
Dale Wijnand
@dwijnand
Sep 25 2015 14:31
yep... :(
matanster
@matanster
Sep 25 2015 20:00
Just in case my question hadn't caught any attention while everyone were still in bed...
Is there any way to make a compiler plugin "get" the same classpath as the rest of the compilation? It was hinted at http://www.scala-lang.org/old/node/6664 that sbt can take care of it, but I see no evidence of that in practice, looks like sbt-assembly is the only way to go.
Am I missing something?

Some of the folks on the sbt-dev channel participated in that original 2010 thread so they'd probably remember...