sharedSrcDir should be a setting
mdedetrich opened this issue · 4 comments
In https://github.com/mdedetrich/scalajson, we have a situation where we want to share the shared
directory across different sbt-crossprojects. Currently the shared
directory is hardcoded in the CrossType
(see https://github.com/scala-native/sbt-crossproject/blob/f4ef45fc4a89a69d60dc438f42a8bbb40c1c1d11/sbt-crossproject/src/main/scala/sbtcrossproject/CrossType.scala#L33-L38).
Ideally there should be some "sharedSource" Setting
which you can override to make it easy to specify your own
Or you can just write your own CrossType
.
we want to share the shared directory across different sbt-crossprojects
That looks very weird. IMO you're doing something wrong, or at least something that is not even supposed to be handled by a crossProject
.
You know you can just add
unmanagedSourceDirectories += whatever
in your settings, right? That would basically be the same as your hypothetical
sharedSource := whatever
@sjrd I am not that familiar with SBT, but my use case can be found when you look in this branch of ScalaJSON https://github.com/mdedetrich/scalajson/tree/safeJNumberConstructor
Basically, I have specific build only for Scala 2.10.x however I still want the shared
of the Scala 2.10.x build to use the generic shared
. i.e. https://github.com/mdedetrich/scalajson/blob/safeJNumberConstructor/shared/src/main/scala-2.10/scalajson.ast/package.scala is the exact same file as https://github.com/mdedetrich/scalajson/blob/safeJNumberConstructor/shared/src/main/scala/scalajson/ast/package.scala and I wan't to remove this duplication
Well in that branch you're completely overriding all the hard work of sbt-crossproject with that line: mdedetrich/scalajson@32b180f#diff-fdc3abdfd754eeb24090dbd90aeec2ceR99
Maybe you wanted +=
instead of :=
there? With :=
there, it doesn't matter what sbt-crossproject does or does not do, because you're overriding it all.