These are chat archives for sbt/sbt

22nd
Jun 2016
Shane Delmore
@ShaneDelmore
Jun 22 2016 17:22
Is there a way to display options in sbt? I am working on a plugin today and see it references options in many places, but can't really tell what is in options. I tried sbt inspect options or sbt inspect global.options but there don't seem to be any references to global or options in the sbt terminal.
I am messing around with sbt-clippy and while it definitely exists and works in my build.sbt, once I start sbt I can't find any evidence that sbt-clippy is even a plugin or has settings.
Shane Delmore
@ShaneDelmore
Jun 22 2016 17:36
Finally found the answer is to use consoleProject. That advice is not prominent in search engines.
Dale Wijnand
@dwijnand
Jun 22 2016 17:46
What options?
Shane Delmore
@ShaneDelmore
Jun 22 2016 17:48
There are many references to "options" but I have so far been unable to tell what they are set to, how to set them, or even what valid settings are. For example, https://github.com/softwaremill/scala-clippy/blob/master/plugin/src/main/scala/com/softwaremill/clippy/ClippyPlugin.scala#L20
My specific goals are eventually to figure out how to get the clippy plugin to look for a file in the root directory and load it. Not even close to that point yet though. Currently just trying to understand how it works.
consoleProject didn't really get me going, but does seem to at least show me that for example ClippySbtPlugin.projectSettings is a thing that exists, but I can't actually yet see what they are made of.
I am taking a wild guess that if I wanted to supply options to clippy I would do something like clippy.options :+ SomeOption but I am still at the wild guessing stage.
Dale Wijnand
@dwijnand
Jun 22 2016 19:06
That's a compiler plugin you linked, not an SBT plugin
No idea what processOptions does there, would have to look at the sources
Josh Suereth
@jsuereth
Jun 22 2016 19:46
@ShaneDelmore Plugins can get options. I forget exactly how they work, IIRC they have some kind of namespace, like -Xplugin:opt=value
and that is a scalac compiler option
so you have to pass options to THAT via scalacOption key in sbt
err options
Valentin Kasas
@vil1
Jun 22 2016 19:47
I there, I have a semi-noob question. It relates to sbt-native-packager but I fell my question is general enough to ask it here rather than on the plugin's channel.
My build uses the DockerPlugin from sbt-native-packager and has two Configurations : Local and Jenkins.
I want to be able to set different values for version in both configurations, but I fail to achieve that.
My problem is, you tell the docker plugin how to build the docker image typically by setting : dockerImageCreationTask := (publishLocal in Docker) where Docker is a Configuration
So my question is (poorly stated as) is it possible to change the value of a key in a Configuration from another one ?
I've seen that on can "extend" configuration like in val Local = config("local") extend Docker but I'm not sure I understand the semantic
Josh Suereth
@jsuereth
Jun 22 2016 19:52
You can treat the two keys as disparate units, e.g. you can have a key from one configuration user the value from another: version in Docker := (version in Jenkins).value
The extend mechanism is about default values, i.e. if you haven't explicity told sbt how to handle that key, it'll look up the "configuration hierarchy" for a value rather than just erroring out
Valentin Kasas
@vil1
Jun 22 2016 19:55
ok for the extend (good to know BTW)
but I'm not sure for the previous one, I would like to state something like version in Docker in Local := "local", version in Docker in Jenkins := (version in ThisProject).value,
Valentin Kasas
@vil1
Jun 22 2016 20:10
The docker plugin works such that docker:publishLocal triggers the construction of a docker image rather than publishing jars to the local ivy store. What I would like to have is local:publishLocal doing the same thing but with an altered value for version
(I can live without a Jenkins configuration and let jenkins use the regular docker:publishLocal)
David Kelly
@kellydavid
Jun 22 2016 20:32

Hey, could someone help me configure a sequential custom sbt task? I'm trying to set up a task that will run assembly from sbt-assembly on all the modules in the project. It should then execute a shell script, passing the file names from assembly as parameters. This is a pseudo code example of what I'm trying to achieve:

lazy val listOfFiles = taskKey[Unit]("Run script passing jar file names as parameters.")

listOfFiles := {
    val files = List[File]()
    files :+ assembly
    // run script passing file names as parameters
}

Is this type of thing possible to do?

Dale Wijnand
@dwijnand
Jun 22 2016 21:17
@kellydavid sure, you just need to understand what key assembly uses for its artefacts
David Kelly
@kellydavid
Jun 22 2016 21:32
@dwijnand The key is assembly but the problem is that this task is parallelised when I call it in my custom task meaning that my task becomes parallelised. Is there a way to define this type of task to be executed in a sequential way?
Dale Wijnand
@dwijnand
Jun 22 2016 21:45
There are code snippets I've seen about running a task in all projects.. But I've no experience there