These are chat archives for sbt/sbt

18th
Jul 2016
Denis Mikhaylov
@notxcain
Jul 18 2016 11:13
Hi! brew install sbt says that 0.13.11 is the latest version
cache invalidation? )
Bjørn Madsen
@aeons
Jul 18 2016 11:15
yeah, i have
brew info sbt                                                                                                                                                                                             1sbt: stable 0.13.12, devel 1.0.0-M4
Build tool for Scala projects
Denis Mikhaylov
@notxcain
Jul 18 2016 11:17
Alright
Denis Mikhaylov
@notxcain
Jul 18 2016 11:28
I was on old version of brew
Justin Kaeser
@jastice
Jul 18 2016 12:27
is there a way to find out within a task if a key is defined?
Dale Wijnand
@dwijnand
Jul 18 2016 12:29
@jastice use yourKey.?.value
Justin Kaeser
@jastice
Jul 18 2016 12:35
Thanks!
Bjørn Madsen
@aeons
Jul 18 2016 12:45
hey, i have an issue with a specific package
I am using an Artifactory that proxies both maven and ivy requests
but when I get to com.typesafe.play % routes-compiler
sbt will hang on this line (when sbt run —debug)
[debug] listing revisions from maven-metadata: https://artifactory-host/artifactory/libs-release/com/typesafe/play/routes-compiler_2.11/maven-metadata.xml
any ideas on why it hangs there?
it will successfully fetch everything else
Perry
@pfn
Jul 18 2016 14:14
@jastice, oh, this is where the username is familiar
@notxcain, launcher version doesn't really matter for the most part
Justin Kaeser
@jastice
Jul 18 2016 14:16
@pfn wave
Perry
@pfn
Jul 18 2016 14:16
@jastice, are you assigned to maintain sbt-structure now?
Justin Kaeser
@jastice
Jul 18 2016 14:16
yes, I started working on sbt support in IntelliJ recently
Perry
@pfn
Jul 18 2016 14:16
I'll probably be making a new pr for more android features this week
finally get around to getting aar dependencies imported correctly
Justin Kaeser
@jastice
Jul 18 2016 14:17
Great to hear. I personally haven't done anything with Android
just a heads-up: we might be rewriting sbt-structure in the not-to-distant future
Perry
@pfn
Jul 18 2016 14:20
that's ok
it needs a rewrite :)
especially the tests, they're unusable
Justin Kaeser
@jastice
Jul 18 2016 14:24
Well, I'm still trying to figure out how to even modify it
Perry
@pfn
Jul 18 2016 14:29
I guess there's that
Perry
@pfn
Jul 18 2016 15:13
@jastice, and yeah, it'll be good for sbt-structure to get some love
Perry
@pfn
Jul 18 2016 16:56
ugh, I can't get sbt-structure to behave if I add my synthetic project/aar data :(
for some reason, intellij refuses to recognize android.jar is present in my project sources after importing...
Anthony Garo
@anthony-garo
Jul 18 2016 17:03
hi everyone, does anybody know what this syntax does exactly?
val scalaTest = "org.scalatest" %% "scalatest" % scalaTestVersion % “test->*"
specifically the test->*
Arne Döring
@krux02
Jul 18 2016 17:13
I would like to know, how I can pack an entire directory tree into the jar file, and as soon as I start my jar, the directory tree gets unpacked in /tmp and accessed via file paths
I want to do this, because I am bundling in my program some python dependencies, and I want the entire python project to be a single tar.gz and then run it
Perry
@pfn
Jul 18 2016 17:28
@anthony-garo tells to import the "test" configuration of scalatest into the default imports, or vice versa, I forget the order of ivy config declarations
Anthony Garo
@anthony-garo
Jul 18 2016 17:28
ahh ok thank you @pfn
Perry
@pfn
Jul 18 2016 17:28
@krux02 what?
@anthony-garo mostly useful when you want to import "test" stuff from one dependency into the "test" scope of your own project, etc.
Arne Döring
@krux02
Jul 18 2016 17:29
basically tar -zcvf archive-name.tar.gz directory-name
Perry
@pfn
Jul 18 2016 17:29
@krux02 so do that?
Arne Döring
@krux02
Jul 18 2016 17:29
but since I don't care about windows, I can just do what I just posted
and run it as a process
I just need to add it as a resource file
Perry
@pfn
Jul 18 2016 17:31
resourceGenerators += Def.task { "tar zcvf ..." ! }.taskValue
Arne Döring
@krux02
Jul 18 2016 17:33
is taskValue in this case really a file?
I highly doubt that
Perry
@pfn
Jul 18 2016 17:36
you fill in the correct bits you need
like return the File object from your task
Arne Döring
@krux02
Jul 18 2016 17:36
resourceGenerators += Def.task { "tar zcvf ..." !; new File("...tar.gz") }.taskValue
Arne Döring
@krux02
Jul 18 2016 17:44
what does this mean: home/arne/proj/tensorDslScala/build.sbt:36: error: No implicit for Append.Value[Seq[sbt.Task[Seq[java.io.File]]], sbt.File] found,
so sbt.File cannot be appended to Seq[sbt.Task[Seq[java.io.File]]]
resourceGenerators += packageTTC.value
resourceGenerators += packageTTC does not work
Perry
@pfn
Jul 18 2016 18:11
you need to return a Seq[File]
Arne Döring
@krux02
Jul 18 2016 18:29
this works now: resourceGenerators in Compile <+= packageTTC
Arne Döring
@krux02
Jul 18 2016 18:35
and this is exactly what I really dislike about sbt. Random operator names (<+= instead of ++=), random expressions like resourceGenerators in Compile instead of something common like compile.resourceGenerators and stupid redefinitions of error messages like No implicit for Append.Value[Seq[sbt.Task[Seq[java.io.File]]], Seq[sbt.File]] found instead of
<console>:17: error: type mismatch;
 found   : java.io.File
 required: scala.collection.TraversableOnce[java.io.File]
       resources ++= new File(".")
                     ^
Perry
@pfn
Jul 18 2016 18:39
++ is for adding collections
you're adding a single file
yes, the error messages suck, but that's all of scala, not sbt
as for random operator names, ++= works fine
you want += not ++= for what you pasted
Arne Döring
@krux02
Jul 18 2016 18:41
Error:Error while importing SBT project:<br/><pre>[info] Loading global plugins from /home/arne/.sbt/0.13/plugins
[info] Loading project definition from /home/arne/proj/tensorDslScala/project
[info] Updating default:tensordslscala-build:0.1-SNAPSHOT
[info] Resolved default:tensordslscala-build:0.1-SNAPSHOT dependencies
[info] Fetching artifacts of default:tensordslscala-build:0.1-SNAPSHOT
[info] Fetched artifacts of default:tensordslscala-build:0.1-SNAPSHOT
/home/arne/proj/tensorDslScala/build.sbt:36: error: No implicit for Append.Values[Seq[sbt.Task[Seq[java.io.File]]], sbt.TaskKey[Seq[sbt.File]]] found,
so sbt.TaskKey[Seq[sbt.File]] cannot be appended to Seq[sbt.Task[Seq[java.io.File]]]
resourceGenerators in Compile ++= packageTTC
^
[error] Type error in expression
Invalid response.
Invalid response.
Invalid response.
Invalid response.
</pre>
no ++= does not work in sbt
Perry
@pfn
Jul 18 2016 18:43
++= works fine in SBT
Arne Döring
@krux02
Jul 18 2016 18:43
And my pasted code is intentionally wrong to give you an example of an error message a scala developer is familiar with. I know exactly that I need to use += there.
can you give me an example?
Perry
@pfn
Jul 18 2016 18:44
the problem is, you're thinking of resourceGenerators incorrectly
++= would be a list of tasks to add
not a list of files
resourceGenerators = List[Task]
resourceGenerators ++= List(Def.task { Seq.empty[File]}.taskValue)
would compile
Arne Döring
@krux02
Jul 18 2016 18:46
but then why is resource generators not of type List[Task] and documented as such?
Perry
@pfn
Jul 18 2016 18:46
it is
inspect resourceGenerators
Arne Döring
@krux02
Jul 18 2016 18:46
sorry I develop by documentation
the documentation did not say anthing about that it is a list of Files
OlegYch
@OlegYch
Jul 18 2016 18:49
how can you claim to 'develop by documentation' if you ignore the types..
Arne Döring
@krux02
Jul 18 2016 18:49
and no it's not a list of Task, it is a settings key buried in a settings key
sorry if I am a bit rude, it's not intended, it's just that sbt costed me so much frustration, because the documentation always talks away from what was important to me to understand it, all I could think was why sbt obfuscates all the things that could be really easy
Josh Suereth
@jsuereth
Jul 18 2016 18:50
resourceGenerators are a Seq[Task[Seq[File]]] essentially, but they're kind of confusing to begin with
Even in sbt in Action, we had trouble making sure we covered it correctly. I'm not suprised the docs are cofnusing
Also, you're reading the 0.12.4 docs, which are pretty old at this point
^ @krux02 We did rewrite that section, so you should read the up-to-date docs
Arne Döring
@krux02
Jul 18 2016 18:58
thank you so much, but one last question I still have: Why are tasks not just methods of the Project with the annotation to be a task?
something like:
Josh Suereth
@jsuereth
Jul 18 2016 18:59
long and complicated answer
They were in old sbt
Arne Döring
@krux02
Jul 18 2016 18:59
I did sbt since 0.7
(with a big break in the middle)
Josh Suereth
@jsuereth
Jul 18 2016 19:00
the long gist is: 1. deadly diamond inheritance is a real problem. 2. explicitly tracking task->task dependencies is now done via the macros (before the applicative functor interface) which gives us a lot more flexibiltiy in execution and inspection of what the hell is going on in a build
not just flexibility in exeuction/inspection but in overriding
Which people wanted and requested but were impossible in 0.7
Perry
@pfn
Jul 18 2016 19:01
cbt does this
Josh Suereth
@jsuereth
Jul 18 2016 19:01
That said, I actually think trait parameters may "fix" a lot of the issues of sbt 0.7, or at least give you a decent workaround
yeah, I think cbt will have all the same problems. The question is if the tradeoff sbt made is worthwhile for the things youc an't do
some would say no, some would say yes
I'm not sure people understand my opinion on this, so I'll refrain from giving it.
Arne Döring
@krux02
Jul 18 2016 19:08
I think sbt was once the "simple build tool" when I thought it was everything but simple. It had nice defaults, but if you needed to change anything in the build file, plan an hour per line you want to write.
I just took a look at cbt, and I instantly like it. It looks like sbt but simple
Perry
@pfn
Jul 18 2016 19:10
I generally say yes, about the tradeoffs sbt made, just a few flaws that are pretty annoying
mostly around config scoping
@krux02 eh, it really takes little time if you understand basic concepts and how sbt works
Perry
@pfn
Jul 18 2016 19:15
more complex changes do require some digging, though
Arne Döring
@krux02
Jul 18 2016 19:15
The problem is, that I am not really open to learn new concepts just to get the build done.
I thought I try out sbt, becaues the build is in scala, so I don't need to learn new concepts. I couldn't be more wrong.
Perry
@pfn
Jul 18 2016 19:17
there are no new concepts...
Arne Döring
@krux02
Jul 18 2016 19:18
there are
for example TaskKey is something new, it could have been just a method, the interpreter could be the default scala repl, and not talking of all the newly introduced operators
Justin Kaeser
@jastice
Jul 18 2016 19:21
I felt like I had to learn a lot before being able to do anything beyond writing a basic build file. and look at me now, Stockholm Syndrome!
Perry
@pfn
Jul 18 2016 19:21
the build needs a language
it can't be just "scala"
because there's nothing in just "scala" to build
if you think you can run a build using just the scala interpreter...
it's not possible
Arne Döring
@krux02
Jul 18 2016 19:22
why?
Of coures you need a library of helpers to get the job done, but is there any serious reason why the scala interpreter would not be able to run a task?
Justin Kaeser
@jastice
Jul 18 2016 19:23
there's not too many operators in 0.13. but the documentation and examples you find out there muddle it all up
Perry
@pfn
Jul 18 2016 19:24
running arbitrary methods isn't a build tool
Arne Döring
@krux02
Jul 18 2016 19:24
then what is the sbt interpreter?
Perry
@pfn
Jul 18 2016 19:25
not running arbitrary methods
Josh Suereth
@jsuereth
Jul 18 2016 19:25
the sbt interpreter is sbt consoleProject
Perry
@pfn
Jul 18 2016 19:25
but carefully packaged pieces of code in tasks
Josh Suereth
@jsuereth
Jul 18 2016 19:25
where you run arbitrary methods
sbt is a build-level interpreter. It doesn't take "scala" it takes a "build language"
my nuanced opinion on build tools is you want a custom build language, but the closer that is to your langauge of choice the less headache you have creating new tasks
Perry
@pfn
Jul 18 2016 19:27
even if you didn't have to learn any of sbt's constructs, if something were written purely with the scala repl in mind, you'd still have to learn its entire library of functionality
Josh Suereth
@jsuereth
Jul 18 2016 19:27
Also, FYI - sbt seems to be a better fit for people who want to learn the build tool and dive in
Perry
@pfn
Jul 18 2016 19:27
@jsuereth eh, disagree, everyone that doesn't know scala doesn't want to touch sbt
Josh Suereth
@jsuereth
Jul 18 2016 19:27
it's a lot harder sell for peopel who dont' care about the build, although we spent years trying to make it easier for those folks too
Arne Döring
@krux02
Jul 18 2016 19:28
I know sbt is a build language interpreter, but is there any reason, this "build languare" may not be just scala with build commands in the import path?
Perry
@pfn
Jul 18 2016 19:28
@krux02 it's impractical
OlegYch
@OlegYch
Jul 18 2016 19:28
"build language"?
Josh Suereth
@jsuereth
Jul 18 2016 19:29
@krux02 I'd suggest you try to write such a thing. There's good learning in doing.
Perry
@pfn
Jul 18 2016 19:29
you can always use cbt which aims to be more along the lines of what you want
Arne Döring
@krux02
Jul 18 2016 19:32
But don't want to be just negative about sbt. There are things about it that I like, too. For example it has nice defaults that let's be build a project without any build script at all, and I like the plugin system, so that I can just import the plugin for assembly and have a runable jar file with all dependencies.
Perry
@pfn
Jul 18 2016 19:33
plugin system is ok, I wish it were a little more like maven's with regard to auto-discovery
Josh Suereth
@jsuereth
Jul 18 2016 19:33
@pfn wdym?
Perry
@pfn
Jul 18 2016 19:33
only big flaw I find in sbt is the management of setting scopes and never knowing when one sets something in the wrong config
@jsuereth maven automatically searches for artifacts by the name of maven-XXX-plugin when looking to use plugin XXX
I understand that ivy plays into this limitation somewhat
or XXX-maven-plugin (depending on whether it's a 1st-party or 3rd party plugin)
Josh Suereth
@jsuereth
Jul 18 2016 19:35
ah, gotcha
yeah, that was nice
Perry
@pfn
Jul 18 2016 19:35
so you can just use any plugin available on central without any configuration at all, that is killer
Josh Suereth
@jsuereth
Jul 18 2016 19:35
and the setting scope problem is.... fun
Perry
@pfn
Jul 18 2016 19:35
I don't know how the setting scope problem could be solved
Josh Suereth
@jsuereth
Jul 18 2016 19:35
There was a detector for unused settings in scopes once
Perry
@pfn
Jul 18 2016 19:35
I think about it from time to time
Josh Suereth
@jsuereth
Jul 18 2016 19:35
it turns out it was SUPER noisy because we set a ton of things where we couldn't detect whether they are used (flatMap issue)
or it's actually useful to place defaults in configurations the user will override
sorry, the user will use (optionally) but not realize
Perry
@pfn
Jul 18 2016 20:12
anyway, hope my new PRs into sbt-structure go in soon, it'll be nice to have more support in intellij for android
@jsuereth oh, what things "can't you do" in sbt? seems like not much (some things cumbersome, yes, but no can'ts)