These are chat archives for sbt/sbt

10th
Feb 2016
Tim Harper
@timcharper
Feb 10 2016 00:12
So, this appears to work!
eugene yokota
@eed3si9n
Feb 10 2016 00:38
nice
Tim Harper
@timcharper
Feb 10 2016 00:38
lol so wow all I needed to do is change it from a SettingKey to a TaskKey
that's it
or at least that way it compiles. And I can either append tasks that output values or values themselves to the key.
eugene yokota
@eed3si9n
Feb 10 2016 00:42
would it make sense to reuse sourceGenerators key and have your plugin implement tasks that feeds into that?
scalaxb for example works like this:
sourceGenerators in Compile += (scalaxb in Compile).taskValue
Tim Harper
@timcharper
Feb 10 2016 00:43
There's more arguments than just a file (need packageName, libName, too); and the values are correlated, so putting them into different settings would be worse.
TaskKey[Seq[Jnaerator.Target]] seems to do exactly what I want.
eugene yokota
@eed3si9n
Feb 10 2016 00:45
i see
Adelbert Chang
@adelbertc
Feb 10 2016 01:41
Is there a way to exlude a namespace from a JAR dropped in lib/ ?
e.g. lib/foo.jar contains com.foo. and com.bar. and i only want the classloader to see com.foo.*
Tim Harper
@timcharper
Feb 10 2016 01:41
Do you know how to do that in Java ?
Adelbert Chang
@adelbertc
Feb 10 2016 01:42
@timcharper nope
Tim Harper
@timcharper
Feb 10 2016 01:43
(I don't know... only things that come to mind are unpacking the JAR and repacking without those files... which you can implement with sbt...)
Eric K Richardson
@ekrich
Feb 10 2016 02:49
I really like SBT too. Is there a plan for a SBT website more like Scala-JS or something? SBT in Action has some nice comparisons with Maven and Gradle and it seems SBT needs some good press. The company I am in started using Gradle even after I gave them a working Spark project with a SBT build. :worried: :-1:
Perry
@pfn
Feb 10 2016 03:06
why would they even choose gradle
gradle sucks...
@adelbertc yeah, can't really implement that, unless you reimplement URLClassLoader or something, best approach aside from that would be to extract/re-pack the jar
Tim Harper
@timcharper
Feb 10 2016 05:04
I will say... I've been using SBT for 2 years now, and I've gotten along just fine without understanding the internals. But... it wasn't until I really dove in and did things more complicated than fetch dependencies, compile projects and publish artifacts that I started to appreciate the beauty of it.
It took some significant investment and commitment to learn the tool better
I don't think many are as willing to do that.
Dale Wijnand
@dwijnand
Feb 10 2016 09:20
to me the beauty isn't the internals but the features: ~, console, warm JVM, consoleProject, typechecked build setup, etc..
I'd say the incremental compilation, but by the time I properly started with Scala zinc was available for Maven.
Sam Halliday
@fommil
Feb 10 2016 09:27
yeah, definitely all in the features
I love the concept of a compute graph, but the implementation in sbt of it... not so much...
that said, I think the choice of a compute graph is the right one for a build tool. If I were ever to write a build tool from scratch, it would probably take a lot of ideas from sbt.
Java 7+ filewatchers open up a lot of possibilities, such as cache invalidation policies for Tasks, which would give a huge scalability to boost
Dale Wijnand
@dwijnand
Feb 10 2016 09:33
virtual files :)
Sam Halliday
@fommil
Feb 10 2016 09:41
ooooh yeah
Dale Wijnand
@dwijnand
Feb 10 2016 09:41
:)
Jason Zaugg
@retronym
Feb 10 2016 13:23

A few days back, I was asking for help with a SBT input parser. Got something working well in the end, here’s the result. https://github.com/scala/scala/pull/4950/files

The FileParser might be handy for other SBT plugins, builds, or SBT itself. Basically works like tab completion of paths in your shell, with the ability to configure filters on the directories it descends into and the files it suggests. It also allows arbitrary input (ie it doesn’t restrict you to the suggestions).

Took me quite a while to figure this out, so thought I’d post it here. Maybe someone with an interest in this part of SBT could contribute a version of this as an example in the docs?

Jason Zaugg
@retronym
Feb 10 2016 13:40
Just opened a ticket questioning a usability detail of SBT’s tab completion for keys: sbt/sbt#2454
Sam Halliday
@fommil
Feb 10 2016 13:44
cool, of course we don't need this in emacs ;-)
(it has a vast array of completion and search prompts when you type anywhere)
(with context / scope minimisation and fuzzy / flex matching)
Jason Zaugg
@retronym
Feb 10 2016 13:57
SBT’s shell has a meta command to ask for completions, so if you embed SBT into emacs and call that, this might still be relevant.
> completions library/test:compile
[completions] library/test:compileIncremental
[completions] library/test:compile::
[completions] library/test:compilerCache
[completions] library/test:compileAnalysisFilename
[completions] library/test:compile
oh, you were talking about the file parser..
Sam Halliday
@fommil
Feb 10 2016 14:03
actually, now that you mention it, it would be great if sbt were able to export a file containing all known keys. Emacs would be able to perform the completions natively
eugene yokota
@eed3si9n
Feb 10 2016 14:04
there's settings command
Sam Halliday
@fommil
Feb 10 2016 14:04
interesting
eugene yokota
@eed3si9n
Feb 10 2016 14:05
you might also find completions te command to be interesting too then
Sam Halliday
@fommil
Feb 10 2016 14:05
indeed
eugene yokota
@eed3si9n
Feb 10 2016 14:06
that's what @retronym just demo'ed above
Josh Suereth
@jsuereth
Feb 10 2016 14:06
completions are actually dynamic, it can include things on the file system
Sam Halliday
@fommil
Feb 10 2016 14:06
oh, we use that. No I was thinking about a way of getting the full list and letting emacs do it natively
it's very clunky when you go to sbt
Josh Suereth
@jsuereth
Feb 10 2016 14:06
And @retronym's comments are accurate, but that was a conscious choice
Sam Halliday
@fommil
Feb 10 2016 14:07
I can't find a screencast of what emacs completions look like, but you'd see what I mean if I showed you. Nothing against sbt's completions, it's just that "the emacs way" is so amazing
they really take general concepts, like "completion" and take it to the next level
Josh Suereth
@jsuereth
Feb 10 2016 14:08
AFAIk, that is. The completions are truncated because they can get extroardinarily long
eugene yokota
@eed3si9n
Feb 10 2016 14:09
there's been some interesting development around vim plugins on completing everything too, like detecting file path and completing directory names
Sam Halliday
@fommil
Feb 10 2016 14:11
there are a few options in emacs, but one of the most popular is company-mode (which is like a pluggable completion backend framework), then there are all kinds of things for filtering the suggestions, the most popular being flx-ido and helm
eugene yokota
@eed3si9n
Feb 10 2016 14:17
in case of
> organization<TAB>
organizationHomepage   organizationName
wouldn't it make sense to display organization as a candidate?
(plz don't suggest organisation)
Sam Halliday
@fommil
Feb 10 2016 14:18
in emacs you wouldn't even press TAB
ozhRET would probably be all you need for the first
eugene yokota
@eed3si9n
Feb 10 2016 14:20
@fommil yea. that's true for Sublime (or Vim with lots of plugins) experience as well. you'd probably type a few characters and completion candidate would pop up somehow
with @jsuereth ANSI-foo, he can probably make it happen
Matthew de Detrich
@mdedetrich
Feb 10 2016 14:44
Bah I knew this was going to happen
How does one make a setting like this
Work properly for non root projects
I am trying to get that plugin to work with this (https://github.com/hussachai/play-scalajs-showcase), the problem I am having is that assets in Compile isn’t referring to the right directory
i.e. server/assets:sourceDirectory when run in SBT points to /Users/matthewdedetrich/github/professional-scala-chapter12-play-demo/jvm/src
its meant to point to /Users/matthewdedetrich/github/professional-scala-chapter12-play-demo/jvm/app/assets
(which is its defined in what I linked earlier, i.e. sourceDirectory in Assets := (sourceDirectory in Compile).value / “assets”)
Matthew de Detrich
@mdedetrich
Feb 10 2016 14:51
Any ideas?
Matthew de Detrich
@mdedetrich
Feb 10 2016 15:04
For some reason it seems like enablePlugins doesn’t properly put the settings in project
(specifically the SbtWeb auto plugin)
If anyone has some ideas, let me know
eugene yokota
@eed3si9n
Feb 10 2016 17:15
@mdedetrich I think this is more of a Play question than sbt question, could you try > web-assets:sourceDirectory?
Matthew de Detrich
@mdedetrich
Feb 10 2016 23:26
@eed3si9n
[info] client/web-assets:sourceDirectory
[info]  /Users/matthewdedetrich/github/professional-scala-chapter12-play-demo/js/src
[info] server/web-assets:sourceDirectory
[info]  /Users/matthewdedetrich/github/professional-scala-chapter12-play-demo/jvm/app/assets
Hmm, that appearst o be correct, not sure why its not picking up the coffeescript file then