These are chat archives for sbt/sbt

11th
Dec 2016
Shane Delmore
@ShaneDelmore
Dec 11 2016 19:57
I want to share a Versions object between sbt projects. I added it to the root/project folder and can successfully reference it in build.sbt, but when I do show sources I see
[info] root/compile:sources
[info]     ArrayBuffer()
Is there a better way to access a scalafile to share between projects?
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:03
@ScalaWilliam thanks for that - I'm familiar with shell redirection - my problem was solved with that last line of my comment - you gotta put quotes around the full command passed to sbt, e.g. sbt show test:managedClasspath will fail, and sbt "show test:managedClasspath" will work...
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:14
@ShaneDelmore each project gets its sources via project in file(".") - you should be able to add the file directly or put the file in an unmanaged directory and add it to both projects via unmanagedSourceDirectories in Compile += baseDirectory.value / "extra-src" (http://www.scala-sbt.org/0.13/docs/Howto-Customizing-Paths.html)
or something like that
now I have a question for the room - I have a custom resource generator which I pass the log stream (e.g. Codegen.generateMappings(elasticMappingsFilesRoot.value, streams.value.log).toSeq) - when this task is called explicitly, I get the log output, but when it's called via the normal task resolution and execution process, I see no output. What gives?
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:48
@rbellamy Thanks, was doing something like that but it's not playing well with IntelliJ. Dug a bit though and it is an intellij but, not SBT.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:48
@ShaneDelmore remember that IntelliJ just uses the *.sbt as the single source of truth for a project
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:50
@rbellamy It's just so frequently incompatible. In the past few months I have had trouble building nearly every open source project I try to contribute to with Intellij. It makes it frustrating to contribute to open source when the tools I enjoy using don't work. I just don't have fun writing Scala in emacs, and I do open source on the weekends for fun, not as work.
Just this month, scalafix, scalafmt, and scala-clippy don't build correctly with intellij.
Before that it was Circe.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:51
@ShaneDelmore I pretty much stay away from trying to build with IntelliJ - I usually have a both a terminal and IDE open at the same time - compile and run in terminal, edit in IDE
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:51
@rbellamy IntelliJ does a poor job of using *.sbt as a single source of truth for a project when it cannot correctly set interproject dependencies to match SBT.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:52
if I need to debug, I use sbt -jvm-debug 5005
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:52
That's what I am doing, which means incorrect linting, no running tests from IntelliJ and most painfully, no debugging.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:52
^--- which expects that you're using sbt-extras
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:52
Hmmm.......
I am using set-extras.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:52
so create an IntelliJ remote run/debug configuration that connects to port 5005
also, the scalafmt plugin is working with IntelliJ - reads the .scalafmt.conf file just fine, and surfaces as expected in the editor
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:54
Not plugin. Project. Clone scalafmt, run sbt compile and watch it work, then run rebuild in intellij and watch it fail.
Today I am not trying to use scalafix, I am trying to contribute to it.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:55
I was referring to your comment, "incorrect linting, no running tests from IntelliJ and most painfully, no debugging."
the linting in particular
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:55
But scalafmt is not a linter, I missed the connection.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:55
yeah
my bad...
Shane Delmore
@ShaneDelmore
Dec 11 2016 23:56
Just confused me is all, no problem. Someday I will meet the JetBrains / SBT whisperer who will teach me how to make it all happy together.
If I ever figure it out, I will contribute back fixes to make it play well both ways, which would expand the number of contributors to a project.
G. Richard Bellamy
@rbellamy
Dec 11 2016 23:58
the process I described has been working pretty well for me... I can debug both scala AND sbt files that way