These are chat archives for sbt/sbt

13th
Jul 2017
Alex Reisberg
@a-reisberg
Jul 13 02:35
Hi! I have a quick question about config for dependencies
for ivy dependencies, I can use defaultConfiguration to make a default config
Is there something similar for dependsOn (for subprojects)
Brian Topping
@briantopping
Jul 13 04:49
@a-reisberg: do you mean for a default dependency that all projects would inherit from?
Simon Hafner
@reactormonk
Jul 13 14:06
I want to build multiple independent projects in subfolders (each with their own build.sbt) and the get an output file - how would that work? Needs ProjectRef, or does a regular subproject work for picking up specific build.sbt?
Carlos Quiroz
@cquiroz
Jul 13 14:11
Hi. I have a crossBuilt projects that maintains a specific file in three different versions for scala 2.10, 2.11 and 2.12, placing them on the dir src/main/scala-2.10, etc...
now I’m trying to add support for 2.13.0-M1 but it seems sbt doesn’t pick src/main/scala-2.13
should that work?
I’m on sbt 0.13.15
Simon Hafner
@reactormonk
Jul 13 14:13
... and the interesting part: How can I invoke a task that's only known to the subprojects?
Dale Wijnand
@dwijnand
Jul 13 14:16
@cquiroz it'll be src/main/scala-2.13.0-M1
Carlos Quiroz
@cquiroz
Jul 13 14:19
@dwijnand Thanks, I tried with 2.13.0 but didn’t expect the M1 part :D
Can you target specific minor versions of scala thenL
Dale Wijnand
@dwijnand
Jul 13 14:19
no, it uses the scalaBinaryVersion, which for .0 prereleases is the fully qualified version.
Carlos Quiroz
@cquiroz
Jul 13 14:20
ok, thanks
Simon Hafner
@reactormonk
Jul 13 14:27
Hmm, I can't loop over projects? :-(
Tells me something about "illegal dynamic reference"
I'm currently trying to cheat it with Def.taskDyn, but then I'm not sure about the correct scope.
Dale Wijnand
@dwijnand
Jul 13 14:31
You'll probably have to fallback to writing it as a command
Alex Reisberg
@a-reisberg
Jul 13 15:26
@briantopping For example, if I have
override def projectSettings: Seq[_root_.sbt.Def.Setting[_]] =
    Seq(
      defaultConfiguration := Some(common),
      ...
Where common is some config
Then for all dependencies I add via
libraryDependencies += "smth" %% "smth" % "smth"
if no config is specified, common will be added by default
So my question is whether there exists something parallel to defaultConfiguration but for dependsOn?
Brian Topping
@briantopping
Jul 13 15:29
@a-reisberg: to level set, are you thinking of projectSettings as a Scala Seq?
Alex Reisberg
@a-reisberg
Jul 13 15:29
So that, instead of writing
mySubproj1 = project.settings(...).dependsOn(mySubproj2 % common)
I can make % common automatically there
Brian Topping
@briantopping
Jul 13 15:30
I think I see what you are asking for…
What I generally do for that is create a project plugin
My project plugin is a separate project that all the projects depend on in the plugins.sbt
Inside that project plugin, I have
  override lazy val projectSettings: Seq[Setting[_]] =
    commonSettings ++ gitStampSettings ++ nexusPublishing ++ buildInfo ++ DirtyMoneyPlugin.projectSettings
This does two things: The first is I don’t have to reference the commonSettings in the subprojects at all, the second is I can change the settings in one place, which I think is the main goal you are after, am I understanding correctly?
Alex Reisberg
@a-reisberg
Jul 13 15:33
Not sure. (I don't really know sbt well, but I think we are talking about different things)
I think I'm talking about ivy dependency config
whereas you're talking about some project settings
Brian Topping
@briantopping
Jul 13 15:34
ic, I misunderstood then.
Alex Reisberg
@a-reisberg
Jul 13 15:34
So in my sbt plugin, I have a couple of configs. For eg
object autoImport {
    lazy val common = config("common")
    lazy val ios = config(IOS) extend (common)
    lazy val android = config(ANDROID) extend (common)
    lazy val web = config(WEB) extend (common)
    lazy val CustomCompile = config("compile") extend(ios, android, common)
  }
Brian Topping
@briantopping
Jul 13 15:35
as far as dependencies go, FWIW, I use Nexus and just treat them as actual dependencies
Alex Reisberg
@a-reisberg
Jul 13 15:36

Nexus is smth different from adding

libraryDependencies += ...

?

Brian Topping
@briantopping
Jul 13 15:36
but if one SBT project is dependent on the internal configuration of another project, that won’t help (and I might recommend against that kind of thing out of intuition)
a remote repository (nexus is just an implementation) provides a remote filesystem for compiled binary artifacts
the publish task is configured in builds for where to push artifacts (jar, etc) that are created
Alex Reisberg
@a-reisberg
Jul 13 15:38
right, ok
I think it's different from what I was asking about
Brian Topping
@briantopping
Jul 13 15:38
:)
Alex Reisberg
@a-reisberg
Jul 13 15:38
:)
Brian Topping
@briantopping
Jul 13 15:39
I think (at least at this point) what you are asking is if a common project’s dependencies can be inherited by other projects
library dependencies are just a setting, so if I am correct, you are looking to inherit a specific setting
Alex Reisberg
@a-reisberg
Jul 13 15:43
No. I think I'm talking about default scoping for dependencies :)
scoping per config
so I can do that for ivy dependencies
but don't know how to do it for subproj