Open eed3si9n opened 7 years ago
Cross-linking: @Duhemm tried to implement this in #2183.
Here's a workaround.
import sbt._
object Root {
def rootProject: Project = Project("root", file("."), aggregate = nonRoots)
def nonRoots: List[ProjectReference] =
projectsFix filter {
case LocalProject(p) => p != "root"
case _ => false
}
def projectsFix: List[ProjectReference] =
ReflectUtilities.allVals[Project](this).values.toList map { p =>
p: ProjectReference
}
}
import Root._
lazy val root = rootProject
.settings(
organization in ThisBuild := "com.example",
scalaVersion in ThisBuild := "2.12.1",
version in ThisBuild := "0.1.0-SNAPSHOT",
name := "root_name"
)
lazy val app1 = (project in file("app1"))
.settings(
name := "app1"
)
lazy val app2 = (project in file("app2"))
.settings(
name := "app2"
)
I would suggest to add a new optional parameter to project called root
and force users to do root = true
from now on to any project that is supposed to be a root. I think we could have a better solution than exposing yet another project constructor called rootProject
:wink:.
Then, I would hide completely those utils to get the projects reflectively, and even cache them. It does not seem a cheap operation.
More cross-linking (:D) there's a feature request from @cunei for explicit indication of which project is the root/default project: https://github.com/sbt/sbt/issues/2789.
steps
problem
There's no way to aggregate all projects automatically.
expectation
Either read-only def projects or let me use ScopeFilter.