These are chat archives for sbt/sbt

11th
Nov 2016
Derek Wickern
@dwickern
Nov 11 2016 00:32

if I have some dependency with lots of artifacts

"group" % "artifact" % "version" artifacts (a, b, c)

... but I want artifact c to be provided scope, would I declare it like this?

"group" % "artifact" % "version" artifacts (a, b)
"group" % "artifact" % "version" % "provided" artifacts (c)
Derek Wickern
@dwickern
Nov 11 2016 00:38
actually I guess scope == configuration, I can specify it on the Artifact
Philipp Meyerhoefer
@barkhorn
Nov 11 2016 09:28

hi all. I'm trying to publish to bintray, but don't see an sha1 checksum being generated.
I have this in build settings

  checksums in publish := Seq("sha1", "md5"),
  checksums in publishLocal := Seq("sha1", "md5"),

and in plugins.sbt

addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")

when I run publishLocal, the .sha1 files end up fine in the ivy cache (~/.ivy2/local/...), but on publish, the bintray repo only contains the md5
any ideas?

RomanIakovlev
@RomanIakovlev
Nov 11 2016 10:05
What would be the best way to get the information about cross-project dependencies in multi-project build? I have the following on my mind: SBT knows the dependencies between projects, so when you run compile it compiles the dependencies first. Now I want to do test in the similar fashion, i.e. when dependent project changes, test all the projects depending on it.
Schmitt Christian
@schmitch
Nov 11 2016 13:38
what's the best way to conditionally add something to a SettingKey like mappings in Universal?
Dale Wijnand
@dwijnand
Nov 11 2016 14:01
Not sure if I understand the question.. use an if?
mappings in Universal ++= (if predicate) Seq(something) else Nil)
Schmitt Christian
@schmitch
Nov 11 2016 14:03

well the question is more like if predicate is a settingkey and the inside is a TaskKey but it should only call the task if the predicate is true, does something like that work?

mappings in Universal ++= Def.taskDyn {
      if (includeDocumentation.value) {
        Def.task{
          val docDirectory = (doc in Compile).value
          val docDirectoryLen = docDirectory.getCanonicalPath.length
          val pathFinder = docDirectory ** "*"
          pathFinder.get map {
            docFile: File =>
              docFile -> ("share/doc/api/" + docFile.getCanonicalPath.substring(docDirectoryLen))
          }
        }
      } else {
        Def.task {
          Seq[(sbt.File, String)]()
        }
      }
    }.value,

or would it be enough without the def.task and taskdyn?

like when does doc in Compile be called?
Dale Wijnand
@dwijnand
Nov 11 2016 14:06
yes, you're right, what you have there is correct
without taskDyn doc in Compile (and all other .value) with be called before the body, regardless of the if
that's the "dyn" part, it makes the execution dynamic
Schmitt Christian
@schmitch
Nov 11 2016 14:07
so my snippet is/was correct?
Dale Wijnand
@dwijnand
Nov 11 2016 14:09
at a glance yes, but it takes me a while to get it right myself.
Schmitt Christian
@schmitch
Nov 11 2016 14:13
well I guess in that case it doesn't help since it will still generate the documentation, guess there is another dependency on it
Dale Wijnand
@dwijnand
Nov 11 2016 14:16
:(
Schmitt Christian
@schmitch
Nov 11 2016 14:17
would now be cool to get depdencies in reverse with inspect :D
Dale Wijnand
@dwijnand
Nov 11 2016 14:18
there's a "Reverse dependencies" in inspect
there's also inspect tree and actually a bunch more, try help inspect
Schmitt Christian
@schmitch
Nov 11 2016 14:23
oh inspect tree looks handy
Dale Wijnand
@dwijnand
Nov 11 2016 14:24
handy and/or verbose, you decide :)
Schmitt Christian
@schmitch
Nov 11 2016 14:28
well unfortunatly a dynTask won't be displayed so if a sub task includes it, it would be impossible
Dale Wijnand
@dwijnand
Nov 11 2016 14:29
yeah, that's the downside of dynamic
it doesn't know
Schmitt Christian
@schmitch
Nov 11 2016 14:31
than the last question is there a way to check the dependency inside a scripted test?
well I guess I can just create a failing documentation and my task should succeed
Dale Wijnand
@dwijnand
Nov 11 2016 14:39
yeah sounds good
Schmitt Christian
@schmitch
Nov 11 2016 14:48
can I set/override a task inside Def.taskDyn? guess that won't work
Dale Wijnand
@dwijnand
Nov 11 2016 14:48
no