These are chat archives for sbt/sbt

24th
Jan 2016
Dale Wijnand
@dwijnand
Jan 24 2016 00:29
@djspiewak I think the issue is giving two projects the same base directory. Instead why don't you create two projects with their own base directory, then add to unmanagedSourceDirectories in Compile the shared sources.
I'm pretty sure I've seen Josh say something about multiple projects sharing base directories is trouble (and should be enforced by sbt).. but then he could've been talking about ids or something else
Perry
@pfn
Jan 24 2016 01:50
hmm, I do something with multi projects sharing same base directory in my plugin
I don't remember encountering any problems with it
they just have different target directories
hmm, looks like I do mangle base, too
but it looks like my situation is saved by virtue of explicitly setting things like sources, etc
Dale Wijnand
@dwijnand
Jan 24 2016 02:13
interesting
Perry
@pfn
Jan 24 2016 02:24
I don't recommend that approach in my plugin anymore though
I prefer the variant approach
but it plays poorly with session settings
Sam Halliday
@fommil
Jan 24 2016 11:40
in scripted, does the sleep action take seconds or millis?
InTheNow
@InTheNow
Jan 24 2016 12:12
@djspiewak This "shared source" issue is not new, as pointed out already goes back a few years with scala.js hitting this first. To summarise, one of the biggest issues is how IDE's deal with this, as they tend to do so in a conflicting way.
No guarantees, but your best bet might be to subclass/copy the relevant scala.js code and create a jvm2 target
Sam Halliday
@fommil
Jan 24 2016 12:18
I've got a project like this... we have a shared projectwith some utility classes in it and its used in both the downstream projects and in a compiler plugin. But the compiler plugin has to include all of its dependencies so I share that source directory in the plugin project. Another workaround for me there would be using the assembly jar as the plugin (not the packageBin) but I don't have access to assembly at work.
@dwijnand thanks! I spent some time looking for those sources and couldn't find them
InTheNow
@InTheNow
Jan 24 2016 12:31

@djspiewak from an old plugin:

One important difference here is that sbt cannot do the cross-compile for us, we have to do it ourselves (as scalajs comes from the scala team, I suspect that this might change

Sam Halliday
@fommil
Jan 24 2016 12:36
when creating a dynamic task, e.g. https://github.com/sbt/sbt/blob/v0.13.9/main/src/main/scala/sbt/Defaults.scala#L1542-L1545 how can I return a raw value? e.g. lift a File to a Task[File]?
InTheNow
@InTheNow
Jan 24 2016 12:59
A few other quotes:
  • August 2014 "This is such a pain to get both IDE's working together and to be honest, it's not really specific to scaljs at all - scalajs is just presenting a use case that could apply to other build scenarios. With that in mind, I wonder if we should promote this issue on a wider platform? (e.g. scala)"
  • November 2014 "The crazy things alistair is doing to try and make his cross-builds works in all IDEs on all OSs, " where Alistair == InTheNow
Not that I'm moaning or anyfink, honest guv' :wink2:
OlegYch
@OlegYch
Jan 24 2016 13:00
the ide could just invoke sbt
InTheNow
@InTheNow
Jan 24 2016 13:01
@OlegYch not that easy, as the IDE has it's own representation of things for links, errors, etc
OlegYch
@OlegYch
Jan 24 2016 13:02
idea-sbt-plugin does that pretty nicely
InTheNow
@InTheNow
Jan 24 2016 13:03
Not for all shared code setups
OlegYch
@OlegYch
Jan 24 2016 13:03
hm
do you have an example?
InTheNow
@InTheNow
Jan 24 2016 13:04
Sure, once you show it working with eclipse, too
works in all IDEs
OlegYch
@OlegYch
Jan 24 2016 13:04
oh well
InTheNow
@InTheNow
Jan 24 2016 13:04
its also easy to set things up in eclipse
but not both :worried:
OlegYch
@OlegYch
Jan 24 2016 13:06
nobody i've ever worked with use eclipse so i've no idea about it
shouldn't be that as easy as invoiking sbt through external process?
InTheNow
@InTheNow
Jan 24 2016 13:08
building via sbt is easy, but most (all?) IDE's use sbt as the way to setup the project, and can fail just on the initial setup
OlegYch
@OlegYch
Jan 24 2016 13:09
yeah well that's a shame
idea-sbt-plugin works well though
InTheNow
@InTheNow
Jan 24 2016 13:09
Much, much better now than a year ago, I guess my main point is that if cross-compiling were built into SBT (like cross scala versions is), it would be better all round
Intellij built in support is very good, btw.
Sam Halliday
@fommil
Jan 24 2016 13:31
nobody know how to elevate a File into a Task[File]? (without using macros)
Perry
@pfn
Jan 24 2016 13:52
huh
what's wrong with just Def.task (file)
Dale Wijnand
@dwijnand
Jan 24 2016 14:43
@fommil here's one way:
scala> val f: java.io.File = file("/tmp")
f: java.io.File = /tmp

scala> val t: Task[File] = Task[File](Info(), Pure(() => f, true))
t: sbt.Task[sbt.File] = Task(_)
Sam Halliday
@fommil
Jan 24 2016 14:44
@dwijnand cool, thanks!
I probably want to create helper to to taht
Sam Halliday
@fommil
Jan 24 2016 15:43
[error] /home/fommil/Projects/sbt-big-project/src/main/scala/BigProjectSettings.scala:86: method task in trait DefinableTask is deprecated: No longer needed with new task syntax and SettingKey inheriting from Initialize.
[error]     ((artifactPath in packageBin), (streams in packageBin).task, (packageConfiguration in packageBin).task).flatMap { (jar, streamsTask, configTask) =>
[error]
WTF? So I'm not even supposed to use the old style syntax?
I really don't like that at all, because IDEs (and scalac interactive) don't understand the macros, so by forcing me to use the new macros (which I find confusing anyway) I lose all editor support :-/
Perry
@pfn
Jan 24 2016 15:44
intellij understands the macros fine
and flatMap was more. of a corner case. syntax
and deprecation isn't error...
Sam Halliday
@fommil
Jan 24 2016 15:46
sbt/sbt#2417
OlegYch
@OlegYch
Jan 24 2016 15:46
what's so special about 'SettingKey inheriting from Initialize' ?
Sam Halliday
@fommil
Jan 24 2016 15:47
@pfn are you sure it understands the syntax? It's able to do method completion and everything inside a dynamic task?
Perry
@pfn
Jan 24 2016 15:47
I use the macros rather extensively in intellij, haven't seen them not work
Sam Halliday
@fommil
Jan 24 2016 15:47
really?
even when the code's not compiling?
Perry
@pfn
Jan 24 2016 15:47
no idea, I never use dynamic task
Sam Halliday
@fommil
Jan 24 2016 15:47
well that's why you've not seen problems
there is no way it can understand it without hand rolled IDE support
Perry
@pfn
Jan 24 2016 15:47
I don't like dynamic task
Sam Halliday
@fommil
Jan 24 2016 15:48
I need it
Perry
@pfn
Jan 24 2016 15:50
I don't recall ide issues in the one time I tried oh def.taskdyn
Sam Halliday
@fommil
Jan 24 2016 15:54
workaround
  implicit class NoMacroTaskSupport[T](val t: TaskKey[T]) extends AnyVal {
    def theTask: SettingKey[Task[T]] = Scoped.scopedSetting(t.scope, t.key)
  }
Perry
@pfn
Jan 24 2016 15:56
so, you just reimplemented the task function, don't error on deprecation :p
Sam Halliday
@fommil
Jan 24 2016 15:58
yup
Sam Halliday
@fommil
Jan 24 2016 16:06
cool, not using macros really cleans up and simplifies my code.. and now I can abstract away the ability to cache a Task
Paweł Kaczor
@pawelkaczor
Jan 24 2016 16:15
3
Sam Halliday
@fommil
Jan 24 2016 16:16
4
this is why I think the macros confuse things => fommil/sbt-big-project@90995e2
Sam Halliday
@fommil
Jan 24 2016 16:22
I think I can abstract the caching pattern now and save loads of cognitive overhead
heh, there doesn't appear to be an easy way from ResolvedProject to ProjectReference it would appear
Sam Halliday
@fommil
Jan 24 2016 16:39
if I have a Seq[Task[Unit]] how can I turn that into a Task[Unit]? Some kind of join / foldy thing?
I'm trying to write a Task that calls out to a bunch of other projects and gets them to run something
Sam Halliday
@fommil
Jan 24 2016 16:45
got it sbt/sbt#1503
Sam Halliday
@fommil
Jan 24 2016 17:25
nope, I don't got it
I've managed to end up in a situation where I have an Initialize[Task[Unit]] where I need to return a Task[Unit]... hmm
Magnus Andersson
@magnusart
Jan 24 2016 19:58
Hi. I’m using sbt but have limited experience writing plugins (done one). Would it be feasable to write an interactive debugger in Sbt as a plugin? Like an Sbt console/REPL but for debugging. In my mind it sounds quite complex/ambitious, but my dream would be to be able to just get along with using Sbt and a text editor.
Dislike having to launch a IDE just to be able to debug.
Sam Halliday
@fommil
Jan 24 2016 20:02
which is part of ensime.org and currently being integrated ;-)
Magnus Andersson
@magnusart
Jan 24 2016 20:03
@InTheNow didn’t know of that, will have a look. @fommil tried Ensime with SublimeText3 a few years back. I didn’t find it stable at that time.
Rory Graves
@rorygraves
Jan 24 2016 20:04
It's been significantly reworked since then.
Sam Halliday
@fommil
Jan 24 2016 20:04
well, get involved and help make it better! I know a few people using ensime-sublime daily
Rory Graves
@rorygraves
Jan 24 2016 20:05
Scala-debugger plans to support a repl mode in 1.1. I.e. Currently in progress.
InTheNow
@InTheNow
Jan 24 2016 20:05
@magnusart I stand corrected - have fun :)
Magnus Andersson
@magnusart
Jan 24 2016 20:06
@rorygraves That sounds awesome. :)
@fommil didn’t mean to diss Ensime. It’s just I spent a few hours getting it up and running and trying to develop with it in SublimeText and it was very flaky. So the barrier for entry was unfortunaly not low enough for me at that time.
Sam Halliday
@fommil
Jan 24 2016 20:08
a few years is a loooong time in Scala ;-)
Magnus Andersson
@magnusart
Jan 24 2016 20:09
To be fair it could have been the SublimeText plugin that was the flaky part.
Rory Graves
@rorygraves
Jan 24 2016 20:09
It was a bit of both. Things have changed a lot in the last 18 months.
Magnus Andersson
@magnusart
Jan 24 2016 20:09
The repl thing sounds very interesting. Where can I find info about that? Will it be a REPL in sbt?
Rory Graves
@rorygraves
Jan 24 2016 20:10
Not sure ping @chips
Magnus Andersson
@magnusart
Jan 24 2016 20:11
But maybe I should have a look at an Ensime setup again to begin with. If it works well with SBT that would cover me for the time being.
Rory Graves
@rorygraves
Jan 24 2016 20:11
Missed - @chipsenkbeil
Perry
@pfn
Jan 24 2016 20:45
ensime works pretty well on windows and emacs, it was somewhat ok to setup
not exactly straightforward, and it still crashes emacs when exiting...
I mostly use intellij, though
Tim Harper
@timcharper
Jan 24 2016 21:02

I'm so glad that other people are working on ensime integrations; and, they are sorely behind the Emacs integration, by at least it seems an order of magnitude.

I'd try and help improve things... but emacs user :) and vimscript is awful. lol.

I'm completely happy with emacs / ensime. It works really well. @fommil and folks have done an outstanding job.
The Scala-IDE folks have done a really great job too, don't mean to diminish their efforts... I wish that Eclipse wasn't so clunky.
Sam Halliday
@fommil
Jan 24 2016 21:41
we reuse all the best bits of scala-ide via the scala-refactoring library (and scalariform)
there is still more than we could share, especially when talking to the interactive compiler
@pfn it crashes emacs? Did you raise a ticket for that?
I use ENSIME on Emacs at work (tried 32 bit and 64 builds) and it works fine.
Sam Halliday
@fommil
Jan 24 2016 22:30
Work == Windows
Chip Senkbeil
@chipsenkbeil
Jan 24 2016 22:35
@rorygraves @magnusart no documentation for the REPL yet. Still in development in a branch right now. Been a bit busy, so not been able to work on it as much as I'd like. Also starting to work on updating Ensime to use debugger api; so, going to split time between those two things.
Chip Senkbeil
@chipsenkbeil
Jan 24 2016 22:51
Oh, and, no, it won't be a REPL in sbt.
Magnus Andersson
@magnusart
Jan 24 2016 23:10
@chipsenkbeil OK. I’m trying to setup Ensime for debugging now.
Magnus Andersson
@magnusart
Jan 24 2016 23:24
So I installed Ensime earlier, had to take a break, but now I went through the config instructions. Code completion etc works which is cool, but debugging is not working as far as I can see. I run testonly but it will not break on breakpoints. Tests are set to fork. What can I do to trobuleshoot this, any logging that would give me a hint?
Chip Senkbeil
@chipsenkbeil
Jan 24 2016 23:25
@magnusart you should move this over to an Ensime channel. Also, I haven't integrated the debugger api with ensime yet, so you'd be better off asking @rorygraves since I think he has a better understanding of the current implementation.
Magnus Andersson
@magnusart
Jan 24 2016 23:27
@chipsenkbeil sure. You’re right, this is off topic for this channel now.