object MainBuild extends Build {
lazy val moduleA = file("moduleA")
lazy val moduleB = file("moduleB")
lazy val moduleC = file("moduleC")
lazy val root = Project(id = "main-build", base = file(".")) settings (buildSettings: _*) aggregate( moduleA, moduleB, moduleC)
def buildSettings: Seq[Setting[_]] = Seq( publishLocal := {}, buildDependencies in Global ~= { deps => mapBuildDeps(deps) }, aggregate in libraryDependencies := true, libraryDependencies ~= { deps => mapLibDeps(deps) } )
def mapBuildDeps(deps: BuildDependencies) = { println("\nbuildDependencies.agregate:") for ((p, d) <- deps.aggregate) println(p.project + (for (c <- d) yield c.project).mkString("( ", ",", " )"))
println("\nbuildDependencies.classpath:") for ((p, d) <- deps.classpath) println(p.project + (for (c <- d) yield c.project).mkString("( ", ",", " )"))
deps }
def mapLibDeps(ds: Seq[ModuleID]): Seq[ModuleID] = { println("libraryDependencies")
for(d <- ds) println(d)
ds }
}
object MainBuild extends Build {
lazy val moduleA = file("moduleA")
lazy val moduleB = file("moduleB")
lazy val moduleC = file("moduleC")
lazy val root = Project(id = "main-build",
base = file(".")) aggregate(moduleA, moduleB, moduleC)
override def buildLoaders = super.buildLoaders ++ Seq(BuildLoader.transform(buildTransformer))
def buildTransformer: BuildLoader.TransformInfo => BuildUnit = { t => val defs = t.unit.definitions val newBuilds = for (b <- defs.builds) yield { val newProjects = for (p <- b.projects) yield p.settings( allDependencies ~= (_.filterNot(_.organization == "com.acme")) ) new Build { override def projects: Seq[Project] = newProjects override def settings: Seq[Setting[_]] = b.settings override def buildLoaders: Seq[BuildLoader.Components] = b.buildLoaders } } val newDefs = new LoadedDefinitions(defs.base, defs.target, defs.loader, newBuilds, defs.buildNames) new BuildUnit(t.uri, t.base, newDefs, t.unit.plugins) }}
object MainBuild extends Build {lazy val moduleA = file("moduleA")lazy val moduleB = file("moduleB")lazy val moduleC = file("moduleC")lazy val root = Project(id = "main-build",
base = file(".")) settings (buildSettings: _*) aggregate(moduleA, moduleB, moduleC)def buildSettings: Seq[Setting[_]] = Seq(publishLocal := {},buildDependencies in Global ~= {deps => mapBuildDeps(deps)}
)def mapBuildDeps(deps: BuildDependencies) = {
// there is required to get and process 'libraryDependencies' values for moduleA, moduleB, moduleC respectivelydeps}}
where should be added dependencies between sub-projects, but those dependencies are defined as 'libraryDependencies' settings in those sub-projects.
So far it isn't clear for me how could be got values of 'libraryDependencies' settings for each sub-project in scope of 'buildDependencies in Global' ?
It's just impossible to add any task like 'state' into 'buildDependencies in Global' transformation because 'buildDependencies' is setting (not task), isn't it?
Thanks in advance if there is any possible solutions for that task.