diff --git a/main/src/main/scala/sbt/BuildLoader.scala b/main/src/main/scala/sbt/BuildLoader.scala index eb32bb20f..6affab1cb 100644 --- a/main/src/main/scala/sbt/BuildLoader.scala +++ b/main/src/main/scala/sbt/BuildLoader.scala @@ -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 = { diff --git a/main/src/main/scala/sbt/Load.scala b/main/src/main/scala/sbt/Load.scala index 6434ce6be..5d0a36123 100755 --- a/main/src/main/scala/sbt/Load.scala +++ b/main/src/main/scala/sbt/Load.scala @@ -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)) diff --git a/main/src/main/scala/sbt/PluginManagement.scala b/main/src/main/scala/sbt/PluginManagement.scala index 634961569..436d009e2 100644 --- a/main/src/main/scala/sbt/PluginManagement.scala +++ b/main/src/main/scala/sbt/PluginManagement.scala @@ -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)) } diff --git a/sbt/src/sbt-test/project/source-plugins/build.sbt b/sbt/src/sbt-test/project/source-plugins/build.sbt index 500e7835b..1e0d4c099 100644 --- a/sbt/src/sbt-test/project/source-plugins/build.sbt +++ b/sbt/src/sbt-test/project/source-plugins/build.sbt @@ -2,6 +2,6 @@ name := "source-plugins" organization := "org.example" -ProguardPlugin.proguardSettings +proguardSettings useJGit \ No newline at end of file diff --git a/sbt/src/sbt-test/project/source-plugins/project/project/Build.scala b/sbt/src/sbt-test/project/source-plugins/project/project/Build.scala index 649e47f8c..a97aac2bd 100644 --- a/sbt/src/sbt-test/project/source-plugins/project/project/Build.scala +++ b/sbt/src/sbt-test/project/source-plugins/project/project/Build.scala @@ -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") } \ No newline at end of file