These are chat archives for sbt/sbt

8th
Jul 2015
Denis Mikhaylov
@notxcain
Jul 08 2015 08:14
@jsuereth thanks!
Sam Halliday
@fommil
Jul 08 2015 12:57
is there a way to filter out a value from a Seq[Setting[_]] that has been set by something else?
Dale Wijnand
@dwijnand
Jul 08 2015 13:00
define value, settings are functions to set a key, they've not been applied yet
Sam Halliday
@fommil
Jul 08 2015 13:01
@dwijnand then to attach a filter that will run when the whole thing is materialised
Dale Wijnand
@dwijnand
Jul 08 2015 13:02
you can map them
Sam Halliday
@fommil
Jul 08 2015 13:03
@dwijnand well I want to delete an element, so I'd need a flatmap at least
@dwijnand bugger it, I'll ask for the value and filter on that. sbt is too clever for its own good.
Dale Wijnand
@dwijnand
Jul 08 2015 13:05
if you can provide more context (on SO too) I'd be happy to help
Sam Halliday
@fommil
Jul 08 2015 13:11
@dwijnand sbt/sbt-native-packager#620
I'm doing this... linuxPackageMappings := linuxPackageMappings.value.filterNot
feels wrong, but seems to work
Dale Wijnand
@dwijnand
Jul 08 2015 13:33
I see. Yeah that's the way I'd do it. Have you seen -= in upcoming 0.13.9? It currently only supports removing elements (using ==) but I originally had it also accept predicates, so it would look like:
linuxPackageMappings -=
  (_.mappings.exists(_._2 == (defaultLinuxLogsLocation.value + "/" + packageName.value)))
Dale Wijnand
@dwijnand
Jul 08 2015 14:01
or
linuxPackageMappings -=
  (_.mappings.map(_._2).contains(defaultLinuxLogsLocation.value + "/" + packageName.value))
Sam Halliday
@fommil
Jul 08 2015 15:02
@dwijnand cool, I guess it's ambiguous because you don't know when in the materialisation chain it's going to be called.
e.g. I want to "mutate" some existing value, what should I filter on... before or after the setting
Dale Wijnand
@dwijnand
Jul 08 2015 15:05
the order they're defined is the order they're executed
Sam Halliday
@fommil
Jul 08 2015 15:25
@dwijnand across multiple files, plugins, and whatnot?
Josh Suereth
@jsuereth
Jul 08 2015 15:50
@fommil I created a document for that order
basically: AutoPlugins -> .scala files -> build.sbt files
And build.sbt files are done alphabetically
Dale Wijnand
@dwijnand
Jul 08 2015 16:13
which makes sense, as it's: remote plugins -> local plugins -> local build setup
Sam Halliday
@fommil
Jul 08 2015 16:42
ok cool, that gives me some confidence that what I've done is not going to randomly break
nafg
@nafg
Jul 08 2015 18:13
@dwijnand I guess -= predicate is not going in?
Dale Wijnand
@dwijnand
Jul 08 2015 19:10
no @eed3si9n wanted it to mirror += so it doesn't do predicates out the box, but it is typeclass based so you can write your own predicate based one