fix plugin depth and project ID auto detection for external dependencies

This commit is contained in:
Mark Harrah 2013-06-28 00:01:19 -04:00
parent 644a2c9d13
commit 220886be80
5 changed files with 12 additions and 4 deletions

View File

@ -122,12 +122,19 @@ final class BuildLoader(
full.setRoot(loaders.full),
loaders.transformAll andThen transformAll
)
def resetPluginDepth: BuildLoader = copyWithNewPM(config.pluginManagement.resetDepth)
def updatePluginManagement(overrides: Set[ModuleID]): BuildLoader =
{
val mgmt = config.pluginManagement
val newConfig = config.copy(pluginManagement = mgmt.copy(overrides = mgmt.overrides ++ overrides))
copyWithNewPM(mgmt.copy(overrides = mgmt.overrides ++ overrides))
}
private[this] def copyWithNewPM(newpm: PluginManagement): BuildLoader =
{
val newConfig = config.copy(pluginManagement = newpm)
new BuildLoader(fail, state, newConfig, resolvers, builders, transformer, full, transformAll)
}
def components = new Components(resolvers.applyFun, builders.applyFun, transformer, full.applyFun, transformAll)
def apply(uri: URI): BuildUnit =
{

View File

@ -312,7 +312,7 @@ object Load
{
val (loadedBuild, refs) = loaded(loaders(b))
checkBuildBase(loadedBuild.unit.localBase)
val newLoader = addOverrides(loadedBuild.unit, addResolvers(loadedBuild.unit, builds.isEmpty, loaders))
val newLoader = addOverrides(loadedBuild.unit, addResolvers(loadedBuild.unit, builds.isEmpty, loaders.resetPluginDepth))
// it is important to keep the load order stable, so we sort the remaining URIs
val remainingBases = (refs.flatMap(Reference.uri) reverse_::: bs).sorted
loadAll(remainingBases, references.updated(b, refs), newLoader, builds.updated(b, loadedBuild))

View File

@ -21,6 +21,7 @@ final case class PluginManagement(overrides: Set[ModuleID], applyOverrides: Set[
Keys.dependencyOverrides ++= overrides
)
def resetDepth: PluginManagement = copy(context = Context(globalPluginProject = false, pluginProjectDepth = 0))
def forGlobalPlugin: PluginManagement = copy(context = Context(globalPluginProject = true, pluginProjectDepth = 0))
def forPlugin: PluginManagement = copy(context = context.copy(pluginProjectDepth = context.pluginProjectDepth + 1))
}

View File

@ -2,6 +2,6 @@ name := "source-plugins"
organization := "org.example"
ProguardPlugin.proguardSettings
proguardSettings
useJGit

View File

@ -2,6 +2,6 @@ import sbt._
object PluginDef extends Build {
override def projects = Seq(root)
lazy val root = Project("plugins", file(".")) dependsOn(proguard, git)
lazy val proguard = uri("git://github.com/jsuereth/xsbt-proguard-plugin.git")
lazy val proguard = uri("git://github.com/sbt/sbt-proguard.git")
lazy val git = uri("git://github.com/sbt/sbt-git.git#master")
}